diff options
| author | hrydgard <hrydgard@gmail.com> | 2008-08-15 20:48:40 +0000 |
|---|---|---|
| committer | hrydgard <hrydgard@gmail.com> | 2008-08-15 20:48:40 +0000 |
| commit | a077e1e1de21fce509b9db3a40fecb57889d5bad (patch) | |
| tree | d71bc2653fbe222fc8772ec9d490000bde12a53f /Source/Core/Common/Src/CPUDetect.cpp | |
| parent | 99c0d7b899be68eed5b13220f3b3b291dd0bcbd3 (diff) | |
untested cpu_id for linux/macosx
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@222 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common/Src/CPUDetect.cpp')
| -rw-r--r-- | Source/Core/Common/Src/CPUDetect.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/Source/Core/Common/Src/CPUDetect.cpp b/Source/Core/Common/Src/CPUDetect.cpp index 552e4bb1a1..5f2ce3baa9 100644 --- a/Source/Core/Common/Src/CPUDetect.cpp +++ b/Source/Core/Common/Src/CPUDetect.cpp @@ -22,8 +22,27 @@ //#include <config/i386/cpuid.h>
#include <xmmintrin.h>
-// fake cpuid for linux. todo: make a real one. EAX EBX ECX EDX is the right order.
-void __cpuid(int info[4], int x) {memset(info, 0, sizeof(info));}
+
+// 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)
+{
+ __asm__("cpuid"
+ : "=a" (*eax),
+ "=b" (*ebx),
+ "=c" (*ecx),
+ "=d" (*edx));
+}
+
+void __cpuid(int info[4], int x)
+{
+ int eax = x, ebx = 0, ecx = 0, edx = 0;
+ do_cpuid(&eax, &ebx, &ecx, &edx);
+ info[0] = eax;
+ info[1] = ebx;
+ info[2] = ecx;
+ info[3] = edx;
+}
#endif
|
