From 1b1f0ecae965e58babaa8092d056f74c4344c610 Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Sun, 24 Aug 2008 20:13:49 +0000 Subject: [PATCH] The simple form of "cpuid" should work on 64-bit platforms; on 32-bit platforms it is safer to use the version that does not modify EBX. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@297 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/CPUDetect.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Source/Core/Common/Src/CPUDetect.cpp b/Source/Core/Common/Src/CPUDetect.cpp index bbcee7c9eb..f15b1adba7 100644 --- a/Source/Core/Common/Src/CPUDetect.cpp +++ b/Source/Core/Common/Src/CPUDetect.cpp @@ -23,24 +23,23 @@ //#include #include -// if you are on linux and this doesn't build, plz fix :) static inline void do_cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { - #ifdef __linux__ + #ifdef _LP64 __asm__("cpuid" : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)); - #else - // Note: EBX is reserved on Mac OS X, so it has to be restored at the end - // of the asm block. + #else + // 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__( - "pushl %%ebx;" - "cpuid;" - "movl %%ebx,%1;" - "popl %%ebx;" + "pushl %%ebx;" + "cpuid;" + "movl %%ebx,%1;" + "popl %%ebx;" : "=a" (*eax), "=r" (*ebx), "=c" (*ecx),