Use one cpuid implementation.

This commit is contained in:
Bartosz Taudul 2020-05-06 18:52:36 +02:00
parent 322e39d9ad
commit f13413922d

View File

@ -170,7 +170,7 @@ struct ThreadHandleWrapper
#endif #endif
#if defined TRACY_HW_TIMER && ( defined __i386 || defined _M_IX86 || defined __x86_64__ || defined _M_X64 ) #if defined __i386 || defined _M_IX86 || defined __x86_64__ || defined _M_X64
static inline void CpuId( uint32_t* regs, uint32_t leaf ) static inline void CpuId( uint32_t* regs, uint32_t leaf )
{ {
#if defined _WIN32 || defined __CYGWIN__ #if defined _WIN32 || defined __CYGWIN__
@ -410,12 +410,7 @@ static const char* GetHostInfo()
auto modelPtr = cpuModel; auto modelPtr = cpuModel;
for( uint32_t i=0x80000002; i<0x80000005; ++i ) for( uint32_t i=0x80000002; i<0x80000005; ++i )
{ {
# if defined _WIN32 || defined __CYGWIN__ CpuId( regs, i );
__cpuidex( (int*)regs, i, 0 );
# else
int zero = 0;
asm volatile ( "cpuid" : "=a" (regs[0]), "=b" (regs[1]), "=c" (regs[2]), "=d" (regs[3]) : "a" (i), "c" (zero) );
# endif
memcpy( modelPtr, regs, sizeof( regs ) ); modelPtr += sizeof( regs ); memcpy( modelPtr, regs, sizeof( regs ) ); modelPtr += sizeof( regs );
} }