summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Src/CPUDetect.cpp
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2012-01-01 20:45:15 +0100
committerPierre Bourdon <delroth@gmail.com>2012-01-02 00:59:37 +0100
commit59e93bff78f54a0cff3f2c6558ed1a69b47a9534 (patch)
tree020ab0798728782979e3c98009daf8353d5bd2e6 /Source/Core/Common/Src/CPUDetect.cpp
parent0d9e87da1844238672c0152312789404e9f7d686 (diff)
Fix a crash at startup with Dolphin on Linux compiled in debug mode
Use the clobber list instead of the stack to save rbx when executing the cpuid instruction with inline assembly. This avoids breaking GCC assumptions about the stack pointer location.
Diffstat (limited to 'Source/Core/Common/Src/CPUDetect.cpp')
-rw-r--r--Source/Core/Common/Src/CPUDetect.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/Source/Core/Common/Src/CPUDetect.cpp b/Source/Core/Common/Src/CPUDetect.cpp
index 99e43f5c46..93e9d25087 100644
--- a/Source/Core/Common/Src/CPUDetect.cpp
+++ b/Source/Core/Common/Src/CPUDetect.cpp
@@ -43,27 +43,25 @@ 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__ (
- "pushq %%rbx;"
"cpuid;"
"movl %%ebx,%1;"
- "popq %%rbx;"
: "=a" (*eax),
"=S" (*ebx),
"=c" (*ecx),
"=d" (*edx)
: "a" (*eax)
+ : "rbx"
);
#else
__asm__ (
- "pushl %%ebx;"
"cpuid;"
"movl %%ebx,%1;"
- "popl %%ebx;"
: "=a" (*eax),
"=S" (*ebx),
"=c" (*ecx),
"=d" (*edx)
: "a" (*eax)
+ : "ebx"
);
#endif
}