diff options
| author | gnick79 <gnick79@gmail.com> | 2011-02-07 19:08:19 +0000 |
|---|---|---|
| committer | gnick79 <gnick79@gmail.com> | 2011-02-07 19:08:19 +0000 |
| commit | a4754956cb6e04bae3626fe9dc40021efba09195 (patch) | |
| tree | 2e50ecac3a20bbb4596e597fba8aae013581b9a6 /Source/Core/Common/Src/CPUDetect.cpp | |
| parent | b1a63e3e8e467d8e5d05118edf04a9e414e8dea8 (diff) | |
- CPUID
restored inline assembly code
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7099 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, 17 insertions, 7 deletions
diff --git a/Source/Core/Common/Src/CPUDetect.cpp b/Source/Core/Common/Src/CPUDetect.cpp index 6a9a234071..65dc8d700b 100644 --- a/Source/Core/Common/Src/CPUDetect.cpp +++ b/Source/Core/Common/Src/CPUDetect.cpp @@ -35,19 +35,29 @@ static inline void do_cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { -// Note: EBX is reserved on Mac OS X and in PIC on Linux, so it has to be -// restored at the end of the asm block. -__asm__( +#ifdef _LP64 + __asm__("cpuid" + : "=a" (*eax), + "=b" (*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) - : "a" (*eax) + "=r" (*ebx), + "=c" (*ecx), + "=d" (*edx) + : "a" (*eax) ); +#endif } static void __cpuid(int info[4], int x) |
