Author: dgorbachev Date: Thu Feb 16 07:37:27 2012 New Revision: 55628
URL: http://svn.reactos.org/svn/reactos?rev=55628&view=rev Log: [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.
Modified: trunk/reactos/lib/pseh/i386/framebased-gcchack.c trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c trunk/reactos/subsystems/win32/win32k/dib/dib24bpp.c
Modified: trunk/reactos/lib/pseh/i386/framebased-gcchack.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/pseh/i386/framebased-gc... ============================================================================== --- trunk/reactos/lib/pseh/i386/framebased-gcchack.c [iso-8859-1] (original) +++ trunk/reactos/lib/pseh/i386/framebased-gcchack.c [iso-8859-1] Thu Feb 16 07:37:27 2012 @@ -94,13 +94,14 @@ { __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 @@
__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 @@ 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"); } }
Modified: trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/dib... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c [iso-8859-1] Thu Feb 16 07:37:27 2012 @@ -413,24 +413,24 @@ 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); }
Modified: trunk/reactos/subsystems/win32/win32k/dib/dib24bpp.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/dib... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/dib/dib24bpp.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/dib/dib24bpp.c [iso-8859-1] Thu Feb 16 07:37:27 2012 @@ -344,37 +344,37 @@ * 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--) {