diff options
| author | Glenn Rice <glennricster@gmail.com> | 2010-11-30 02:56:44 +0000 |
|---|---|---|
| committer | Glenn Rice <glennricster@gmail.com> | 2010-11-30 02:56:44 +0000 |
| commit | b5863da915b5dd62d8ae38cb7bef858d8c3c879e (patch) | |
| tree | 4f637f85b388e128af2eefd28d120891a1e4be8b /Source/Core | |
| parent | eda716b16496ec339da5640325b3d418cd872f1a (diff) | |
Possible fix for the rdtsc call in JitIL.cpp on macosx (issue 3531). This also fixes issue 3595 (although that issue was invalid -- we don't suport scons on linux anymore).
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6498 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/Src/PowerPC/Jit64IL/JitIL.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL.cpp index e45048df49..2bba5878f0 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL.cpp @@ -165,16 +165,22 @@ ps_adds1 #include <stdint.h> static inline uint64_t __rdtsc() { -#ifdef __linux__ uint32_t lo, hi; +#ifdef _LP64 __asm__ __volatile__ ("xorl %%eax,%%eax \n cpuid" ::: "%rax", "%rbx", "%rcx", "%rdx"); __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); return (uint64_t)hi << 32 | lo; #else - // TODO: Figure out what is wrong with clobbering the rbx register on OSX - return 0; + __asm__ __volatile__ ( + "xor %%eax,%%eax;" + "push %%ebx;" + "cpuid;" + "pop %%ebx;" + ::: "%eax", "%ecx", "%edx"); + __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); #endif + return (uint64_t)hi << 32 | lo; } #endif |
