[cairo-commit] cairo/pixman/src fbmmx.c,1.3,1.4
Owen Taylor
commit at pdx.freedesktop.org
Sat Aug 27 18:36:11 PDT 2005
Committed by: otaylor
Update of /cvs/cairo/cairo/pixman/src
In directory gabe:/tmp/cvs-serv18287/src
Modified Files:
fbmmx.c
Log Message:
2005-08-27 Owen Taylor <otaylor at redhat.com>
* src/fbmmx.c (detectCPUFeatures): Make the code work with
-fomit-frame-pointer by making sure that %esp isn't modified at
the point where we access output operands. (#4269, Patch from
Ronald Wahl)
Index: fbmmx.c
===================================================================
RCS file: /cvs/cairo/cairo/pixman/src/fbmmx.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- fbmmx.c 19 Aug 2005 02:13:06 -0000 1.3
+++ fbmmx.c 28 Aug 2005 01:36:09 -0000 1.4
@@ -2488,28 +2488,38 @@
vendor[0] = 0;
vendor[12] = 0;
/* see p. 118 of amd64 instruction set manual Vol3 */
- __asm__ ("push %%ebx\n"
- "pushf\n"
+ /* We need to be careful about the handling of %ebx and
+ * %esp here. We can't declare either one as clobbered
+ * since they are special registers (%ebx is the "PIC
+ * register" holding an offset to global data, %esp the
+ * stack pointer), so we need to make sure they have their
+ * original values when we access the output operands.
+ */
+ __asm__ ("pushf\n"
"pop %%eax\n"
- "mov %%eax, %%ebx\n"
+ "mov %%eax, %%ecx\n"
"xor $0x00200000, %%eax\n"
"push %%eax\n"
"popf\n"
"pushf\n"
"pop %%eax\n"
"mov $0x0, %%edx\n"
- "xor %%ebx, %%eax\n"
+ "xor %%ecx, %%eax\n"
"jz skip\n"
"mov $0x00000000, %%eax\n"
+ "push %%ebx\n"
"cpuid\n"
- "mov %%ebx, %1\n"
+ "mov %%ebx, %%eax\n"
+ "pop %%ebx\n"
+ "mov %%eax, %1\n"
"mov %%edx, %2\n"
"mov %%ecx, %3\n"
"mov $0x00000001, %%eax\n"
+ "push %%ebx\n"
"cpuid\n"
+ "pop %%ebx\n"
"skip:\n"
- "pop %%ebx\n"
"mov %%edx, %0\n"
: "=r" (result),
"=m" (vendor[0]),
@@ -2543,8 +2553,8 @@
"mov $0x80000001, %%eax\n"
"cpuid\n"
"skip2:\n"
- "mov %%edx, %0\n"
"pop %%ebx\n"
+ "mov %%edx, %0\n"
: "=r" (result)
:
: "%eax", "%ecx", "%edx"
More information about the cairo-commit
mailing list