summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Src/CPUDetect.cpp
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2012-03-22 15:21:52 +0100
committerPierre Bourdon <delroth@gmail.com>2012-03-22 15:21:52 +0100
commit0ffc12bbfd6ac44b3030ec30f400a58e951087b7 (patch)
tree53a6fac9ec79bcd71fe2046d8fb579478da12fd2 /Source/Core/Common/Src/CPUDetect.cpp
parent006923e871e496a7c6c0fe9ba76da4ee939ce14e (diff)
parentd95e31af3f779bfa3141047e8b6275e1fd2e4bbb (diff)
Merge branch 'master' into zcomploc-support
Conflicts: Source/Core/VideoCommon/Src/PixelShaderGen.cpp
Diffstat (limited to 'Source/Core/Common/Src/CPUDetect.cpp')
-rw-r--r--Source/Core/Common/Src/CPUDetect.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/Source/Core/Common/Src/CPUDetect.cpp b/Source/Core/Common/Src/CPUDetect.cpp
index 810c5d2a59..93e9d25087 100644
--- a/Source/Core/Common/Src/CPUDetect.cpp
+++ b/Source/Core/Common/Src/CPUDetect.cpp
@@ -32,6 +32,10 @@
//#include <config/i386/cpuid.h>
#include <xmmintrin.h>
+#if defined __FreeBSD__
+#include <sys/types.h>
+#include <machine/cpufunc.h>
+#else
static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
unsigned int *ecx, unsigned int *edx)
{
@@ -39,41 +43,42 @@ static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
// 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__ (
- "mov %%rbx,%%rdi;"
"cpuid;"
"movl %%ebx,%1;"
- "mov %%rdi,%%rbx;"
: "=a" (*eax),
- "=g" (*ebx),
+ "=S" (*ebx),
"=c" (*ecx),
"=d" (*edx)
: "a" (*eax)
- : "rdi", "rbx"
+ : "rbx"
);
#else
- __asm__(
- "movl %%ebx,%%edi;"
+ __asm__ (
"cpuid;"
- "movl %%ebx,%1;"
- "movl %%edi,%%ebx;"
+ "movl %%ebx,%1;"
: "=a" (*eax),
- "=g" (*ebx),
+ "=S" (*ebx),
"=c" (*ecx),
"=d" (*edx)
: "a" (*eax)
- : "edi", "ebx"
+ : "ebx"
);
#endif
}
+#endif /* defined __FreeBSD__ */
static void __cpuid(int info[4], int x)
{
+#if defined __FreeBSD__
+ do_cpuid((unsigned int)x, (unsigned int*)info);
+#else
unsigned 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
}
#endif