summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2005-08-27 18:36:09 +0000
committerOwen Taylor <otaylor@redhat.com>2005-08-27 18:36:09 +0000
commitc0da73e1b8e5933ca117512499ccac4e208bd8e0 (patch)
tree98c833709e50bc2f4869aed304dc022a43fe32e7
parent03c3935471ad69e8e2d0e6543b7667f972ef1f0c (diff)
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)
-rw-r--r--pixman/ChangeLog7
-rw-r--r--pixman/src/fbmmx.c24
2 files changed, 24 insertions, 7 deletions
diff --git a/pixman/ChangeLog b/pixman/ChangeLog
index 0e9f96849..c4cd4c6dd 100644
--- a/pixman/ChangeLog
+++ b/pixman/ChangeLog
@@ -1,3 +1,10 @@
+2005-08-27 Owen Taylor <otaylor@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)
+
2005-08-22 Owen Taylor <otaylor@redhat.com>
* src/pixregion.c (pixman_region_union_rect): When width/height
diff --git a/pixman/src/fbmmx.c b/pixman/src/fbmmx.c
index 42ba4162b..2523b622d 100644
--- a/pixman/src/fbmmx.c
+++ b/pixman/src/fbmmx.c
@@ -2488,28 +2488,38 @@ static unsigned int detectCPUFeatures(void) {
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 @@ static unsigned int detectCPUFeatures(void) {
"mov $0x80000001, %%eax\n"
"cpuid\n"
"skip2:\n"
- "mov %%edx, %0\n"
"pop %%ebx\n"
+ "mov %%edx, %0\n"
: "=r" (result)
:
: "%eax", "%ecx", "%edx"