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
This commit is contained in:
Glenn Rice 2010-11-30 02:56:44 +00:00
parent eda716b164
commit b5863da915
1 changed files with 9 additions and 3 deletions

View File

@ -165,16 +165,22 @@ ps_adds1
#include <stdint.h> #include <stdint.h>
static inline uint64_t __rdtsc() static inline uint64_t __rdtsc()
{ {
#ifdef __linux__
uint32_t lo, hi; uint32_t lo, hi;
#ifdef _LP64
__asm__ __volatile__ ("xorl %%eax,%%eax \n cpuid" __asm__ __volatile__ ("xorl %%eax,%%eax \n cpuid"
::: "%rax", "%rbx", "%rcx", "%rdx"); ::: "%rax", "%rbx", "%rcx", "%rdx");
__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
return (uint64_t)hi << 32 | lo; return (uint64_t)hi << 32 | lo;
#else #else
// TODO: Figure out what is wrong with clobbering the rbx register on OSX __asm__ __volatile__ (
return 0; "xor %%eax,%%eax;"
"push %%ebx;"
"cpuid;"
"pop %%ebx;"
::: "%eax", "%ecx", "%edx");
__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
#endif #endif
return (uint64_t)hi << 32 | lo;
} }
#endif #endif