diff options
| author | pierre <pierre@pirsoft.de> | 2011-02-12 18:40:02 +0000 |
|---|---|---|
| committer | pierre <pierre@pirsoft.de> | 2011-02-12 18:40:02 +0000 |
| commit | e81ccd7f33a3bac7453f63008c8343cc02ebaa57 (patch) | |
| tree | 010111f8dc1e0b718578b90e956a7f0008ead84d /Source/Core/Common/Src/CPUDetect.cpp | |
| parent | 94176c02a86e3bf623596ec2c5ffdce0c93318db (diff) | |
Common: Change cpuid code again
Looks like compilers tend to use EBX for parameters if not told otherwise and
don't bother to update SP in leaf functions, so PUSH/POP kill local variables.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7151 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common/Src/CPUDetect.cpp')
| -rw-r--r-- | Source/Core/Common/Src/CPUDetect.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/Source/Core/Common/Src/CPUDetect.cpp b/Source/Core/Common/Src/CPUDetect.cpp index bb3cc28220..45aed22d17 100644 --- a/Source/Core/Common/Src/CPUDetect.cpp +++ b/Source/Core/Common/Src/CPUDetect.cpp @@ -37,29 +37,31 @@ static inline void do_cpuid(unsigned int *eax, unsigned int *ebx, { #ifdef _LP64 // 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__( - "push %%rbx;" + // restored at the end of the asm block. + __asm__ ( + "mov %%rbx,%%rdi;" "cpuid;" "movl %%ebx,%1;" - "pop %%rbx;" + "mov %%rdi,%%rbx;" : "=a" (*eax), - "=r" (*ebx), + "=g" (*ebx), "=c" (*ecx), "=d" (*edx) - : "a" (*eax) + : "a" (*eax) + : "rdi", "rbx" ); #else __asm__( - "pushl %%ebx;" + "movl %%ebx,%%edi;" "cpuid;" "movl %%ebx,%1;" - "popl %%ebx;" + "movl %%edi,%%ebx;" : "=a" (*eax), - "=r" (*ebx), + "=g" (*ebx), "=c" (*ecx), "=d" (*edx) - : "a" (*eax) + : "a" (*eax) + : "edi", "ebx" ); #endif } |
