summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Src/CPUDetect.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/Common/Src/CPUDetect.cpp')
-rw-r--r--Source/Core/Common/Src/CPUDetect.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/Source/Core/Common/Src/CPUDetect.cpp b/Source/Core/Common/Src/CPUDetect.cpp
index d11a9fbe18..bbcee7c9eb 100644
--- a/Source/Core/Common/Src/CPUDetect.cpp
+++ b/Source/Core/Common/Src/CPUDetect.cpp
@@ -26,7 +26,14 @@
// 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__
+ __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.
__asm__(
@@ -38,6 +45,7 @@ static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
"=r" (*ebx),
"=c" (*ecx),
"=d" (*edx));
+ #endif
}
void __cpuid(int info[4], int x)
@@ -174,4 +182,4 @@ std::string CPUInfo::Summarize()
if (bLongMode) sum += ", 64-bit support";
sum += " (wrong? report)";
return sum;
-} \ No newline at end of file
+}