summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorMaarten ter Huurne <maarten@treewalker.org>2011-12-12 02:14:56 +0100
committerMaarten ter Huurne <maarten@treewalker.org>2011-12-12 02:14:56 +0100
commitee5a29e6f2010eea7d9953a875f5ff7dc8149fda (patch)
tree3b74b4e7c63e9007ca5c18326432f7d98c703cd6 /Source
parentd75f45979b236713a232b7e86c481548eaa7fa5d (diff)
For CPUID, save EBX on the stack instead of in a register.
This fixes GCC running out of registers when compiling for x86 in release mode. Thanks to kiesel.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Common/Src/CPUDetect.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/Source/Core/Common/Src/CPUDetect.cpp b/Source/Core/Common/Src/CPUDetect.cpp
index 33efef7c01..99e43f5c46 100644
--- a/Source/Core/Common/Src/CPUDetect.cpp
+++ b/Source/Core/Common/Src/CPUDetect.cpp
@@ -43,29 +43,27 @@ static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
// Note: EBX is reserved on Mac OS X and in PIC on Linux, so it has to
// restored at the end of the asm block.
__asm__ (
- "mov %%rbx,%%rdi;"
+ "pushq %%rbx;"
"cpuid;"
"movl %%ebx,%1;"
- "mov %%rdi,%%rbx;"
+ "popq %%rbx;"
: "=a" (*eax),
- "=r" (*ebx),
+ "=S" (*ebx),
"=c" (*ecx),
"=d" (*edx)
: "a" (*eax)
- : "rdi", "rbx"
);
#else
- __asm__(
- "movl %%ebx,%%edi;"
+ __asm__ (
+ "pushl %%ebx;"
"cpuid;"
- "movl %%ebx,%1;"
- "movl %%edi,%%ebx;"
+ "movl %%ebx,%1;"
+ "popl %%ebx;"
: "=a" (*eax),
- "=r" (*ebx),
+ "=S" (*ebx),
"=c" (*ecx),
"=d" (*edx)
: "a" (*eax)
- : "edi", "ebx"
);
#endif
}