Fixed bug #734
authorSam Lantinga <slouken@libsdl.org>
Fri, 30 Oct 2009 04:45:01 +0000
changeset 3420935f36ec1844
parent 3419 e00d6ecb5d4b
child 3421 7bc83a9e09fd
Fixed bug #734

Save and restore the PIC register %ebx/%rbx using push/pop instead of %edi/%rdi
src/cpuinfo/SDL_cpuinfo.c
     1.1 --- a/src/cpuinfo/SDL_cpuinfo.c	Thu Oct 29 09:20:50 2009 +0000
     1.2 +++ b/src/cpuinfo/SDL_cpuinfo.c	Fri Oct 30 04:45:01 2009 +0000
     1.3 @@ -153,7 +153,7 @@
     1.4  /* *INDENT-OFF* */
     1.5  #if defined(__GNUC__) && defined(i386)
     1.6  	__asm__ (
     1.7 -"        movl    %%ebx,%%edi\n"
     1.8 +"        pushl   %%ebx\n"
     1.9  "        xorl    %%eax,%%eax         # Set up for CPUID instruction    \n"
    1.10  "        cpuid                       # Get and save vendor ID          \n"
    1.11  "        cmpl    $1,%%eax            # Make sure 1 is valid input for CPUID\n"
    1.12 @@ -163,14 +163,14 @@
    1.13  "        cpuid                       # Get family/model/stepping/features\n"
    1.14  "        movl    %%edx,%0                                              \n"
    1.15  "1:                                                                    \n"
    1.16 -"        movl    %%edi,%%ebx\n"
    1.17 +"        popl    %%ebx\n"
    1.18  	: "=m" (features)
    1.19  	:
    1.20 -	: "%eax", "%ecx", "%edx", "%edi"
    1.21 +	: "%eax", "%ecx", "%edx", "cc"
    1.22  	);
    1.23  #elif defined(__GNUC__) && defined(__x86_64__)
    1.24  	__asm__ (
    1.25 -"        movq    %%rbx,%%rdi\n"
    1.26 +"        pushq   %%rbx\n"
    1.27  "        xorl    %%eax,%%eax         # Set up for CPUID instruction    \n"
    1.28  "        cpuid                       # Get and save vendor ID          \n"
    1.29  "        cmpl    $1,%%eax            # Make sure 1 is valid input for CPUID\n"
    1.30 @@ -180,10 +180,10 @@
    1.31  "        cpuid                       # Get family/model/stepping/features\n"
    1.32  "        movl    %%edx,%0                                              \n"
    1.33  "1:                                                                    \n"
    1.34 -"        movq    %%rdi,%%rbx\n"
    1.35 +"        popq    %%rbx\n"
    1.36  	: "=m" (features)
    1.37  	:
    1.38 -	: "%rax", "%rbx", "%rcx", "%rdx", "%rdi"
    1.39 +	: "%rax", "%rcx", "%rdx", "cc"
    1.40  	);
    1.41  #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
    1.42  	__asm {
    1.43 @@ -226,7 +226,7 @@
    1.44  /* *INDENT-OFF* */
    1.45  #if defined(__GNUC__) && defined(i386)
    1.46  	__asm__ (
    1.47 -"        movl    %%ebx,%%edi\n"
    1.48 +"        pushl   %%ebx\n"
    1.49  "        movl    $0x80000000,%%eax   # Query for extended functions    \n"
    1.50  "        cpuid                       # Get extended function limit     \n"
    1.51  "        cmpl    $0x80000001,%%eax                                     \n"
    1.52 @@ -235,14 +235,14 @@
    1.53  "        cpuid                       # and get the information         \n"
    1.54  "        movl    %%edx,%0                                              \n"
    1.55  "1:                                                                    \n"
    1.56 -"        movl    %%edi,%%ebx\n"
    1.57 +"        popl    %%ebx\n"
    1.58  	: "=m" (features)
    1.59  	:
    1.60 -	: "%eax", "%ecx", "%edx", "%edi"
    1.61 +	: "%eax", "%ecx", "%edx", "cc"
    1.62  	);
    1.63  #elif defined(__GNUC__) && defined (__x86_64__)
    1.64  	__asm__ (
    1.65 -"        movq    %%rbx,%%rdi\n"
    1.66 +"        pushq   %%rbx\n"
    1.67  "        movl    $0x80000000,%%eax   # Query for extended functions    \n"
    1.68  "        cpuid                       # Get extended function limit     \n"
    1.69  "        cmpl    $0x80000001,%%eax                                     \n"
    1.70 @@ -251,10 +251,10 @@
    1.71  "        cpuid                       # and get the information         \n"
    1.72  "        movl    %%edx,%0                                              \n"
    1.73  "1:                                                                    \n"
    1.74 -"        movq    %%rdi,%%rbx\n"
    1.75 +"        popq    %%rbx\n"
    1.76  	: "=m" (features)
    1.77  	:
    1.78 -	: "%rax", "%rbx", "%rcx", "%rdx", "%rdi"
    1.79 +	: "%rax", "%rcx", "%rdx", "cc"
    1.80  	);
    1.81  #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
    1.82  	__asm {