# HG changeset patch # User Sam Lantinga # Date 1260981724 0 # Node ID 41d01d70659c4f245c77636eb0eec4a945af3ff9 # Parent 65f66674b7fb8ce33b360809e97023eb774f8e69 Fixed cpuid assembly to work on PIC code diff -r 65f66674b7fb -r 41d01d70659c src/cpuinfo/SDL_cpuinfo.c --- a/src/cpuinfo/SDL_cpuinfo.c Wed Dec 16 16:08:17 2009 +0000 +++ b/src/cpuinfo/SDL_cpuinfo.c Wed Dec 16 16:42:04 2009 +0000 @@ -122,16 +122,16 @@ #elif defined(__sun) && defined(__i386) __asm ( " pushfl \n" -" popl %eax \n" -" movl %eax,%ecx \n" -" xorl $0x200000,%eax \n" -" pushl %eax \n" -" popfl \n" -" pushfl \n" -" popl %eax \n" -" xorl %ecx,%eax \n" -" jz 1f \n" -" movl $1,-8(%ebp) \n" +" popl %eax \n" +" movl %eax,%ecx \n" +" xorl $0x200000,%eax \n" +" pushl %eax \n" +" popfl \n" +" pushfl \n" +" popl %eax \n" +" xorl %ecx,%eax \n" +" jz 1f \n" +" movl $1,-8(%ebp) \n" "1: \n" ); #elif defined(__sun) && defined(__amd64) @@ -156,8 +156,12 @@ #if defined(__GNUC__) && (defined(i386) || defined(__x86_64__)) #define cpuid(func, a, b, c, d) \ - __asm__ __volatile__ ("cpuid": \ - "=a" (a), "=b" (b), "=c" (c), "=d" (d) : "a" (func)) + __asm__ __volatile__ ( \ +" pushl %%ebx \n" \ +" cpuid \n" \ +" movl %%ebx, %%esi \n" \ +" popl %%ebx \n" : \ + "=a" (a), "=S" (b), "=c" (c), "=d" (d) : "a" (func)) #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__) #define cpuid(func, a, b, c, d) \ __asm { \