diff options
| author | gnick79 <gnick79@gmail.com> | 2011-02-07 20:14:22 +0000 |
|---|---|---|
| committer | gnick79 <gnick79@gmail.com> | 2011-02-07 20:14:22 +0000 |
| commit | d373258517900511af1073479398d38a49437ee0 (patch) | |
| tree | 3e51a3fd90344a726b10c71fa7747db4fdb9deb6 /Source/Core/Common/Src/CPUDetect.cpp | |
| parent | a4754956cb6e04bae3626fe9dc40021efba09195 (diff) | |
- CPUID asm changes for x64 systems.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7100 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common/Src/CPUDetect.cpp')
| -rw-r--r-- | Source/Core/Common/Src/CPUDetect.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/Source/Core/Common/Src/CPUDetect.cpp b/Source/Core/Common/Src/CPUDetect.cpp index 65dc8d700b..b7e85a7301 100644 --- a/Source/Core/Common/Src/CPUDetect.cpp +++ b/Source/Core/Common/Src/CPUDetect.cpp @@ -36,25 +36,29 @@ static inline void do_cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { #ifdef _LP64 - __asm__("cpuid" + // 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__( + "pushl %%rbx;" + "cpuid;" + "movl %%rbx,%1;" + "popl %%rbx;" : "=a" (*eax), - "=b" (*ebx), - "=c" (*ecx), - "=d" (*edx) - : "a" (*eax) + "=r" (*ebx), + "=c" (*ecx), + "=d" (*edx) + : "a" (*eax) ); #else - // 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__( "pushl %%ebx;" "cpuid;" "movl %%ebx,%1;" "popl %%ebx;" : "=a" (*eax), - "=r" (*ebx), - "=c" (*ecx), - "=d" (*edx) + "=r" (*ebx), + "=c" (*ecx), + "=d" (*edx) : "a" (*eax) ); #endif |
