mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-07 17:29:36 +00:00
amd64: fix multithread, fix vgui, fix physmodels
This commit is contained in:
+32
-18
@@ -20,11 +20,23 @@
|
||||
|
||||
const tchar* GetProcessorVendorId();
|
||||
|
||||
static bool cpuid(unsigned long function, unsigned long& out_eax, unsigned long& out_ebx, unsigned long& out_ecx, unsigned long& out_edx)
|
||||
static bool cpuid(uint32 function, uint32& out_eax, uint32& out_ebx, uint32& out_ecx, uint32& out_edx)
|
||||
{
|
||||
#if defined (__arm__) || defined (__arm64__) || defined( _X360 )
|
||||
return false;
|
||||
#elif defined(GNUC)
|
||||
|
||||
#if defined(PLATFORM_64BITS)
|
||||
asm("mov %%rbx, %%rsi\n\t"
|
||||
"cpuid\n\t"
|
||||
"xchg %%rsi, %%rbx"
|
||||
: "=a" (out_eax),
|
||||
"=S" (out_ebx),
|
||||
"=c" (out_ecx),
|
||||
"=d" (out_edx)
|
||||
: "a" (function)
|
||||
);
|
||||
#else
|
||||
asm("mov %%ebx, %%esi\n\t"
|
||||
"cpuid\n\t"
|
||||
"xchg %%esi, %%ebx"
|
||||
@@ -34,7 +46,9 @@ static bool cpuid(unsigned long function, unsigned long& out_eax, unsigned long&
|
||||
"=d" (out_edx)
|
||||
: "a" (function)
|
||||
);
|
||||
#endif
|
||||
return true;
|
||||
|
||||
#elif defined(_WIN64)
|
||||
int pCPUInfo[4];
|
||||
__cpuid( pCPUInfo, (int)function );
|
||||
@@ -45,7 +59,7 @@ static bool cpuid(unsigned long function, unsigned long& out_eax, unsigned long&
|
||||
return true;
|
||||
#else
|
||||
bool retval = true;
|
||||
unsigned long local_eax, local_ebx, local_ecx, local_edx;
|
||||
uint32 local_eax, local_ebx, local_ecx, local_edx;
|
||||
_asm pushad;
|
||||
|
||||
__try
|
||||
@@ -83,7 +97,7 @@ static bool CheckMMXTechnology(void)
|
||||
#if defined( _X360 ) || defined( _PS3 )
|
||||
return true;
|
||||
#else
|
||||
unsigned long eax,ebx,edx,unused;
|
||||
uint32 eax,ebx,edx,unused;
|
||||
if ( !cpuid(1,eax,ebx,unused,edx) )
|
||||
return false;
|
||||
|
||||
@@ -151,7 +165,7 @@ static bool CheckSSETechnology(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned long eax,ebx,edx,unused;
|
||||
uint32 eax,ebx,edx,unused;
|
||||
if ( !cpuid(1,eax,ebx,unused,edx) ) {
|
||||
return false;
|
||||
}
|
||||
@@ -165,7 +179,7 @@ static bool CheckSSE2Technology(void)
|
||||
#if defined( _X360 ) || defined( _PS3 ) || defined(__SANITIZE_ADDRESS__) || defined (__arm__)
|
||||
return false;
|
||||
#else
|
||||
unsigned long eax,ebx,edx,unused;
|
||||
uint32 eax,ebx,edx,unused;
|
||||
if ( !cpuid(1,eax,ebx,unused,edx) )
|
||||
return false;
|
||||
|
||||
@@ -178,7 +192,7 @@ bool CheckSSE3Technology(void)
|
||||
#if defined( _X360 ) || defined( _PS3 ) || defined(__SANITIZE_ADDRESS__) || defined (__arm__)
|
||||
return false;
|
||||
#else
|
||||
unsigned long eax,ebx,edx,ecx;
|
||||
uint32 eax,ebx,edx,ecx;
|
||||
if( !cpuid(1,eax,ebx,ecx,edx) )
|
||||
return false;
|
||||
|
||||
@@ -193,7 +207,7 @@ bool CheckSSSE3Technology(void)
|
||||
#else
|
||||
// SSSE 3 is implemented by both Intel and AMD
|
||||
// detection is done the same way for both vendors
|
||||
unsigned long eax,ebx,edx,ecx;
|
||||
uint32 eax,ebx,edx,ecx;
|
||||
if( !cpuid(1,eax,ebx,ecx,edx) )
|
||||
return false;
|
||||
|
||||
@@ -209,7 +223,7 @@ bool CheckSSE41Technology(void)
|
||||
// SSE 4.1 is implemented by both Intel and AMD
|
||||
// detection is done the same way for both vendors
|
||||
|
||||
unsigned long eax,ebx,edx,ecx;
|
||||
uint32 eax,ebx,edx,ecx;
|
||||
if( !cpuid(1,eax,ebx,ecx,edx) )
|
||||
return false;
|
||||
|
||||
@@ -228,7 +242,7 @@ bool CheckSSE42Technology(void)
|
||||
if ( 0 != V_tier0_stricmp( pchVendor, "GenuineIntel" ) )
|
||||
return false;
|
||||
|
||||
unsigned long eax,ebx,edx,ecx;
|
||||
uint32 eax,ebx,edx,ecx;
|
||||
if( !cpuid(1,eax,ebx,ecx,edx) )
|
||||
return false;
|
||||
|
||||
@@ -248,7 +262,7 @@ bool CheckSSE4aTechnology( void )
|
||||
if ( 0 != V_tier0_stricmp( pchVendor, "AuthenticAMD" ) )
|
||||
return false;
|
||||
|
||||
unsigned long eax,ebx,edx,ecx;
|
||||
uint32 eax,ebx,edx,ecx;
|
||||
if( !cpuid( 0x80000001,eax,ebx,ecx,edx) )
|
||||
return false;
|
||||
|
||||
@@ -262,7 +276,7 @@ static bool Check3DNowTechnology(void)
|
||||
#if defined( _X360 ) || defined( _PS3 ) || defined (__arm__) || defined(__SANITIZE_ADDRESS__)
|
||||
return false;
|
||||
#else
|
||||
unsigned long eax, unused;
|
||||
uint32 eax, unused;
|
||||
if ( !cpuid(0x80000000,eax,unused,unused,unused) )
|
||||
return false;
|
||||
|
||||
@@ -282,7 +296,7 @@ static bool CheckCMOVTechnology()
|
||||
#if defined( _X360 ) || defined( _PS3 ) || defined (__arm__) || defined(__SANITIZE_ADDRESS__)
|
||||
return false;
|
||||
#else
|
||||
unsigned long eax,ebx,edx,unused;
|
||||
uint32 eax,ebx,edx,unused;
|
||||
if ( !cpuid(1,eax,ebx,unused,edx) )
|
||||
return false;
|
||||
|
||||
@@ -295,7 +309,7 @@ static bool CheckFCMOVTechnology(void)
|
||||
#if defined( _X360 ) || defined( _PS3 ) || defined (__arm__) || defined(__SANITIZE_ADDRESS__)
|
||||
return false;
|
||||
#else
|
||||
unsigned long eax,ebx,edx,unused;
|
||||
uint32 eax,ebx,edx,unused;
|
||||
if ( !cpuid(1,eax,ebx,unused,edx) )
|
||||
return false;
|
||||
|
||||
@@ -308,7 +322,7 @@ static bool CheckRDTSCTechnology(void)
|
||||
#if defined( _X360 ) || defined( _PS3 ) || defined (__arm__) || defined(__SANITIZE_ADDRESS__)
|
||||
return false;
|
||||
#else
|
||||
unsigned long eax,ebx,edx,unused;
|
||||
uint32 eax,ebx,edx,unused;
|
||||
if ( !cpuid(1,eax,ebx,unused,edx) )
|
||||
return false;
|
||||
|
||||
@@ -324,7 +338,7 @@ const tchar* GetProcessorVendorId()
|
||||
#elif defined ( __arm__ )
|
||||
return "ARM";
|
||||
#else
|
||||
unsigned long unused, VendorIDRegisters[3];
|
||||
uint32 unused, VendorIDRegisters[3];
|
||||
|
||||
static tchar VendorID[13];
|
||||
|
||||
@@ -365,7 +379,7 @@ static bool HTSupported(void)
|
||||
const unsigned int EXT_FAMILY_ID = 0x0f00000; // EAX[23:20] - Bit 23 thru 20 contains extended family processor id
|
||||
const unsigned int PENTIUM4_ID = 0x0f00; // Pentium 4 family processor id
|
||||
|
||||
unsigned long unused,
|
||||
uint32 unused,
|
||||
reg_eax = 0,
|
||||
reg_edx = 0,
|
||||
vendor_id[3] = {0, 0, 0};
|
||||
@@ -393,7 +407,7 @@ static uint8 LogicalProcessorsPerPackage(void)
|
||||
// EBX[23:16] indicate number of logical processors per package
|
||||
const unsigned NUM_LOGICAL_BITS = 0x00FF0000;
|
||||
|
||||
unsigned long unused, reg_ebx = 0;
|
||||
uint32 unused, reg_ebx = 0;
|
||||
|
||||
if ( !HTSupported() )
|
||||
return 1;
|
||||
@@ -582,7 +596,7 @@ const CPUInformation* GetCPUInformation()
|
||||
pi.m_szProcessorID = (tchar*)GetProcessorVendorId();
|
||||
pi.m_bHT = HTSupported();
|
||||
|
||||
unsigned long eax, ebx, edx, ecx;
|
||||
uint32 eax, ebx, edx, ecx;
|
||||
if (cpuid(1, eax, ebx, ecx, edx))
|
||||
{
|
||||
pi.m_nModel = eax; // full CPU model info
|
||||
|
||||
+1
-2
@@ -49,7 +49,6 @@
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// internal structures
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -152,7 +151,7 @@ struct SpewInfo_t
|
||||
int m_nSpewOutputLevel;
|
||||
};
|
||||
|
||||
CThreadLocalPtr<SpewInfo_t> g_pSpewInfo;
|
||||
CTHREADLOCALPTR(SpewInfo_t) g_pSpewInfo;
|
||||
|
||||
|
||||
// Standard groups
|
||||
|
||||
+1861
-1012
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user