Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed bug #734
Browse files Browse the repository at this point in the history
Save and restore the PIC register %ebx/%rbx using push/pop instead of %edi/%rdi
  • Loading branch information
slouken committed Oct 30, 2009
1 parent 685dcb6 commit 6ee369a
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/cpuinfo/SDL_cpuinfo.c
Expand Up @@ -153,7 +153,7 @@ CPU_getCPUIDFeatures(void)
/* *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"
Expand All @@ -163,14 +163,14 @@ CPU_getCPUIDFeatures(void)
" 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"
Expand All @@ -180,10 +180,10 @@ CPU_getCPUIDFeatures(void)
" 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 {
Expand Down Expand Up @@ -226,7 +226,7 @@ CPU_getCPUIDFeaturesExt(void)
/* *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"
Expand All @@ -235,14 +235,14 @@ CPU_getCPUIDFeaturesExt(void)
" 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"
Expand All @@ -251,10 +251,10 @@ CPU_getCPUIDFeaturesExt(void)
" 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 {
Expand Down

0 comments on commit 6ee369a

Please sign in to comment.