mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 11:02:16 +00:00
[WIN32K]
Use local labels in the inline asm code to avoid a clash when building with link-time code generation. [PSEH] Do not push memory operands with ESP as the base register (can happen when compiling with some GCC options), load arguments into registers. Fix formatting. svn path=/trunk/; revision=55628
This commit is contained in:
parent
84d86eb242
commit
426717cc3c
3 changed files with 62 additions and 61 deletions
|
@ -94,13 +94,14 @@ void _SEH2GlobalUnwind(void * target)
|
|||
{
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"push %%ebp\n"
|
||||
"push $0\n"
|
||||
"push $0\n"
|
||||
"push $Return%=\n"
|
||||
"push %[target]\n"
|
||||
"push %%ebp\n\t"
|
||||
"push $0\n\t"
|
||||
"push $0\n\t"
|
||||
"push $Return%=\n\t"
|
||||
"push %[target]\n\t"
|
||||
"call %c[RtlUnwind]\n"
|
||||
"Return%=: pop %%ebp\n" :
|
||||
"Return%=:\n\t"
|
||||
"pop %%ebp" :
|
||||
:
|
||||
[target] "g" (target), [RtlUnwind] "g" (&RtlUnwind) :
|
||||
"eax", "ebx", "ecx", "edx", "esi", "edi", "flags", "memory"
|
||||
|
@ -131,13 +132,13 @@ __SEH_EXCEPT_RET _SEH2Except(_SEH2Frame_t * frame, volatile _SEH2TryLevel_t * tr
|
|||
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"push %[ep]\n"
|
||||
"push %[frame]\n"
|
||||
"call *%[filter]\n"
|
||||
"pop %%edx\n"
|
||||
"pop %%edx\n" :
|
||||
"push %[ep]\n\t"
|
||||
"push %[frame]\n\t"
|
||||
"call *%[filter]\n\t"
|
||||
"pop %%edx\n\t"
|
||||
"pop %%edx" :
|
||||
[ret] "=a" (ret) :
|
||||
"c" (context), [filter] "r" (filter), [frame] "g" (frame), [ep] "g" (ep) :
|
||||
"c" (context), [filter] "r" (filter), [frame] "r" (frame), [ep] "r" (ep) :
|
||||
"edx", "flags", "memory"
|
||||
);
|
||||
|
||||
|
@ -158,7 +159,7 @@ void _SEH2Finally(_SEH2Frame_t * frame, volatile _SEH2TryLevel_t * trylevel)
|
|||
body = _SEHFunctionFromTrampoline((_SEHTrampoline_t *)body);
|
||||
}
|
||||
|
||||
__asm__ __volatile__("call *%1\n" : : "c" (context), "r" (body) : "eax", "edx", "flags", "memory");
|
||||
__asm__ __volatile__("call *%1" : : "c" (context), "r" (body) : "eax", "edx", "flags", "memory");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -413,24 +413,24 @@ DIB_16BPP_ColorFill(SURFOBJ* DestSurface, RECTL* DestRect, ULONG color)
|
|||
for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
" cld\n"
|
||||
" mov %1,%%ebx\n"
|
||||
" mov %2,%%edi\n"
|
||||
" test $0x03, %%edi\n" /* Align to fullword boundary */
|
||||
" jz .FL1\n"
|
||||
" stosw\n"
|
||||
" dec %%ebx\n"
|
||||
" jz .FL2\n"
|
||||
".FL1:\n"
|
||||
" mov %%ebx,%%ecx\n" /* Setup count of fullwords to fill */
|
||||
" shr $1,%%ecx\n"
|
||||
" rep stosl\n" /* The actual fill */
|
||||
" test $0x01, %%ebx\n" /* One left to do at the right side? */
|
||||
" jz .FL2\n"
|
||||
" stosw\n"
|
||||
".FL2:\n"
|
||||
"cld\n\t"
|
||||
"mov %1,%%ebx\n\t"
|
||||
"mov %2,%%edi\n\t"
|
||||
"test $0x03, %%edi\n\t" /* Align to fullword boundary */
|
||||
"jz 1f\n\t"
|
||||
"stosw\n\t"
|
||||
"dec %%ebx\n\t"
|
||||
"jz 2f\n"
|
||||
"1:\n\t"
|
||||
"mov %%ebx,%%ecx\n\t" /* Setup count of fullwords to fill */
|
||||
"shr $1,%%ecx\n\t"
|
||||
"rep stosl\n\t" /* The actual fill */
|
||||
"test $0x01, %%ebx\n\t" /* One left to do at the right side? */
|
||||
"jz 2f\n\t"
|
||||
"stosw\n"
|
||||
"2:"
|
||||
:
|
||||
: "a" (color), "r" (width), "m" (pos)
|
||||
: "a" (color), "r" (width), "m" (pos)
|
||||
: "%ecx", "%ebx", "%edi");
|
||||
pos =(PULONG)((ULONG_PTR)pos + delta);
|
||||
}
|
||||
|
|
|
@ -344,37 +344,37 @@ DIB_24BPP_ColorFill(SURFOBJ* DestSurface, RECTL* DestRect, ULONG color)
|
|||
* So, taking endianness into account again, we need to fill with these
|
||||
* ULONGs: CABC BCAB ABCA */
|
||||
|
||||
/* This is about 30% faster than the generic C code below */
|
||||
__asm__ __volatile__ (
|
||||
" movl %1, %%ecx\n"
|
||||
" andl $0xffffff, %%ecx\n" /* 0ABC */
|
||||
" movl %%ecx, %%ebx\n" /* Construct BCAB in ebx */
|
||||
" shrl $8, %%ebx\n"
|
||||
" movl %%ecx, %%eax\n"
|
||||
" shll $16, %%eax\n"
|
||||
" orl %%eax, %%ebx\n"
|
||||
" movl %%ecx, %%edx\n" /* Construct ABCA in edx */
|
||||
" shll $8, %%edx\n"
|
||||
" movl %%ecx, %%eax\n"
|
||||
" shrl $16, %%eax\n"
|
||||
" orl %%eax, %%edx\n"
|
||||
" movl %%ecx, %%eax\n" /* Construct CABC in eax */
|
||||
" shll $24, %%eax\n"
|
||||
" orl %%ecx, %%eax\n"
|
||||
" movl %2, %%ecx\n" /* Load count */
|
||||
" shr $2, %%ecx\n"
|
||||
" movl %3, %%edi\n" /* Load dest */
|
||||
".FL1:\n"
|
||||
" movl %%eax, (%%edi)\n" /* Store 4 pixels, 12 bytes */
|
||||
" movl %%ebx, 4(%%edi)\n"
|
||||
" movl %%edx, 8(%%edi)\n"
|
||||
" addl $12, %%edi\n"
|
||||
" dec %%ecx\n"
|
||||
" jnz .FL1\n"
|
||||
" movl %%edi, %0\n"
|
||||
: "=m"(addr)
|
||||
: "m"(color), "m"(Count), "m"(addr)
|
||||
: "%eax", "%ebx", "%ecx", "%edx", "%edi");
|
||||
/* This is about 30% faster than the generic C code below */
|
||||
__asm__ __volatile__ (
|
||||
"movl %1, %%ecx\n\t"
|
||||
"andl $0xffffff, %%ecx\n\t" /* 0ABC */
|
||||
"movl %%ecx, %%ebx\n\t" /* Construct BCAB in ebx */
|
||||
"shrl $8, %%ebx\n\t"
|
||||
"movl %%ecx, %%eax\n\t"
|
||||
"shll $16, %%eax\n\t"
|
||||
"orl %%eax, %%ebx\n\t"
|
||||
"movl %%ecx, %%edx\n\t" /* Construct ABCA in edx */
|
||||
"shll $8, %%edx\n\t"
|
||||
"movl %%ecx, %%eax\n\t"
|
||||
"shrl $16, %%eax\n\t"
|
||||
"orl %%eax, %%edx\n\t"
|
||||
"movl %%ecx, %%eax\n\t" /* Construct CABC in eax */
|
||||
"shll $24, %%eax\n\t"
|
||||
"orl %%ecx, %%eax\n\t"
|
||||
"movl %2, %%ecx\n\t" /* Load count */
|
||||
"shr $2, %%ecx\n\t"
|
||||
"movl %3, %%edi\n" /* Load dest */
|
||||
"1:\n\t"
|
||||
"movl %%eax, (%%edi)\n\t" /* Store 4 pixels, 12 bytes */
|
||||
"movl %%ebx, 4(%%edi)\n\t"
|
||||
"movl %%edx, 8(%%edi)\n\t"
|
||||
"addl $12, %%edi\n\t"
|
||||
"dec %%ecx\n\t"
|
||||
"jnz 1b\n\t"
|
||||
"movl %%edi, %0"
|
||||
: "=m"(addr)
|
||||
: "m"(color), "m"(Count), "m"(addr)
|
||||
: "%eax", "%ebx", "%ecx", "%edx", "%edi");
|
||||
Count = Count & 0x03;
|
||||
while (0 != Count--)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue