changeset 3420:935f36ec1844

Fixed bug #734 Save and restore the PIC register %ebx/%rbx using push/pop instead of %edi/%rdi
author Sam Lantinga <slouken@libsdl.org>
date Fri, 30 Oct 2009 04:45:01 +0000
parents e00d6ecb5d4b
children 7bc83a9e09fd
files src/cpuinfo/SDL_cpuinfo.c
diffstat 1 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpuinfo/SDL_cpuinfo.c	Thu Oct 29 09:20:50 2009 +0000
+++ b/src/cpuinfo/SDL_cpuinfo.c	Fri Oct 30 04:45:01 2009 +0000
@@ -153,7 +153,7 @@
 /* *INDENT-OFF* */
 #if defined(__GNUC__) && defined(i386)
 	__asm__ (
-"        movl    %%ebx,%%edi\n"
+"        pushl   %%ebx\n"
 "        xorl    %%eax,%%eax         # Set up for CPUID instruction    \n"
 "        cpuid                       # Get and save vendor ID          \n"
 "        cmpl    $1,%%eax            # Make sure 1 is valid input for CPUID\n"
@@ -163,14 +163,14 @@
 "        cpuid                       # Get family/model/stepping/features\n"
 "        movl    %%edx,%0                                              \n"
 "1:                                                                    \n"
-"        movl    %%edi,%%ebx\n"
+"        popl    %%ebx\n"
 	: "=m" (features)
 	:
-	: "%eax", "%ecx", "%edx", "%edi"
+	: "%eax", "%ecx", "%edx", "cc"
 	);
 #elif defined(__GNUC__) && defined(__x86_64__)
 	__asm__ (
-"        movq    %%rbx,%%rdi\n"
+"        pushq   %%rbx\n"
 "        xorl    %%eax,%%eax         # Set up for CPUID instruction    \n"
 "        cpuid                       # Get and save vendor ID          \n"
 "        cmpl    $1,%%eax            # Make sure 1 is valid input for CPUID\n"
@@ -180,10 +180,10 @@
 "        cpuid                       # Get family/model/stepping/features\n"
 "        movl    %%edx,%0                                              \n"
 "1:                                                                    \n"
-"        movq    %%rdi,%%rbx\n"
+"        popq    %%rbx\n"
 	: "=m" (features)
 	:
-	: "%rax", "%rbx", "%rcx", "%rdx", "%rdi"
+	: "%rax", "%rcx", "%rdx", "cc"
 	);
 #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
 	__asm {
@@ -226,7 +226,7 @@
 /* *INDENT-OFF* */
 #if defined(__GNUC__) && defined(i386)
 	__asm__ (
-"        movl    %%ebx,%%edi\n"
+"        pushl   %%ebx\n"
 "        movl    $0x80000000,%%eax   # Query for extended functions    \n"
 "        cpuid                       # Get extended function limit     \n"
 "        cmpl    $0x80000001,%%eax                                     \n"
@@ -235,14 +235,14 @@
 "        cpuid                       # and get the information         \n"
 "        movl    %%edx,%0                                              \n"
 "1:                                                                    \n"
-"        movl    %%edi,%%ebx\n"
+"        popl    %%ebx\n"
 	: "=m" (features)
 	:
-	: "%eax", "%ecx", "%edx", "%edi"
+	: "%eax", "%ecx", "%edx", "cc"
 	);
 #elif defined(__GNUC__) && defined (__x86_64__)
 	__asm__ (
-"        movq    %%rbx,%%rdi\n"
+"        pushq   %%rbx\n"
 "        movl    $0x80000000,%%eax   # Query for extended functions    \n"
 "        cpuid                       # Get extended function limit     \n"
 "        cmpl    $0x80000001,%%eax                                     \n"
@@ -251,10 +251,10 @@
 "        cpuid                       # and get the information         \n"
 "        movl    %%edx,%0                                              \n"
 "1:                                                                    \n"
-"        movq    %%rdi,%%rbx\n"
+"        popq    %%rbx\n"
 	: "=m" (features)
 	:
-	: "%rax", "%rbx", "%rcx", "%rdx", "%rdi"
+	: "%rax", "%rcx", "%rdx", "cc"
 	);
 #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
 	__asm {