[pypy-commit] pypy default: Found out again why the source I copied this from pushes

arigo noreply at buildbot.pypy.org
Fri Mar 9 20:53:05 CET 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r53289:e34422c0871f
Date: 2012-03-09 11:52 -0800
http://bitbucket.org/pypy/pypy/changeset/e34422c0871f/

Log:	Found out again why the source I copied this from pushes and pops
	%ebx instead of listing it in the clobbered registers: on some
	machines (OS/X 32 for example) gcc complains that %ebx may not be
	clobbered.

diff --git a/pypy/translator/c/src/asm_gcc_x86.h b/pypy/translator/c/src/asm_gcc_x86.h
--- a/pypy/translator/c/src/asm_gcc_x86.h
+++ b/pypy/translator/c/src/asm_gcc_x86.h
@@ -124,10 +124,12 @@
 {
     //Read the CPU features.
     int features;
-    asm("mov $1, %%eax\n"
+    asm("movl $1, %%eax\n"
+        "pushl %%ebx\n"
         "cpuid\n"
-        "mov %%edx, %0"
-        : "=g"(features) : : "eax", "ebx", "edx", "ecx");
+        "popl %%ebx\n"
+        "movl %%edx, %0"
+        : "=g"(features) : : "eax", "edx", "ecx");
     
     //Check bits 25 and 26, this indicates SSE2 support
     if (((features & (1 << 25)) == 0) || ((features & (1 << 26)) == 0))


More information about the pypy-commit mailing list