mirror of https://github.com/PCSX2/pcsx2.git
Use 64-bit compatible rdtsc for Linux. Remove some more intrin_x86 functions.
This commit is contained in:
parent
999eb83de8
commit
b47a4da81f
|
@ -99,20 +99,6 @@ static __inline__ __attribute__((always_inline)) unsigned long long __xgetbv(uns
|
||||||
return ((unsigned long long)edx << 32) | eax;
|
return ((unsigned long long)edx << 32) | eax;
|
||||||
}
|
}
|
||||||
|
|
||||||
// gcc 4.8 define __rdtsc but unfortunately the compiler crash...
|
|
||||||
// The redefine allow to skip the gcc __rdtsc version -- Gregory
|
|
||||||
#ifdef __linux__
|
|
||||||
static __inline__ __attribute__((always_inline)) unsigned long long __pcsx2__rdtsc(void)
|
|
||||||
#else
|
|
||||||
static __inline__ __attribute__((always_inline)) unsigned long long __rdtsc(void)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
unsigned long long retval;
|
|
||||||
__asm__ __volatile__("rdtsc" : "=A"(retval));
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*** Interrupts ***/
|
/*** Interrupts ***/
|
||||||
#ifndef __linux__
|
#ifndef __linux__
|
||||||
static __inline__ __attribute__((always_inline)) void __debugbreak(void)
|
static __inline__ __attribute__((always_inline)) void __debugbreak(void)
|
||||||
|
|
|
@ -102,21 +102,30 @@ s64 x86capabilities::_CPUSpeedHz( u64 time ) const
|
||||||
|
|
||||||
// Align the cpu execution to a cpuTick boundary.
|
// Align the cpu execution to a cpuTick boundary.
|
||||||
|
|
||||||
|
// GCC 4.8 has __rdtsc but apparently it causes a crash. Only known working on MSVC
|
||||||
do {
|
do {
|
||||||
timeStart = GetCPUTicks();
|
timeStart = GetCPUTicks();
|
||||||
#ifdef __linux__
|
#ifdef _MSC_VER
|
||||||
startCycle = __pcsx2__rdtsc();
|
|
||||||
#else
|
|
||||||
startCycle = __rdtsc();
|
startCycle = __rdtsc();
|
||||||
|
#elif defined(_M_X86_64)
|
||||||
|
unsigned long long low, high;
|
||||||
|
__asm__ __volatile__("rdtsc" : "=a"(low), "=d"(high));
|
||||||
|
startCycle = low | (high << 32);
|
||||||
|
#else
|
||||||
|
__asm__ __volatile__("rdtsc" : "=A"(startCycle));
|
||||||
#endif
|
#endif
|
||||||
} while( GetCPUTicks() == timeStart );
|
} while( GetCPUTicks() == timeStart );
|
||||||
|
|
||||||
do {
|
do {
|
||||||
timeStop = GetCPUTicks();
|
timeStop = GetCPUTicks();
|
||||||
#ifdef __linux__
|
#ifdef _MSC_VER
|
||||||
endCycle = __pcsx2__rdtsc();
|
|
||||||
#else
|
|
||||||
endCycle = __rdtsc();
|
endCycle = __rdtsc();
|
||||||
|
#elif defined(_M_X86_64)
|
||||||
|
unsigned long long low, high;
|
||||||
|
__asm__ __volatile__("rdtsc" : "=a"(low), "=d"(high));
|
||||||
|
endCycle = low | (high << 32);
|
||||||
|
#else
|
||||||
|
__asm__ __volatile__("rdtsc" : "=A"(endCycle));
|
||||||
#endif
|
#endif
|
||||||
} while( ( timeStop - timeStart ) < time );
|
} while( ( timeStop - timeStart ) < time );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue