diff --git a/neo/sys/osx/DOOMController.mm b/neo/sys/osx/DOOMController.mm index 4c293170..274be04a 100644 --- a/neo/sys/osx/DOOMController.mm +++ b/neo/sys/osx/DOOMController.mm @@ -475,7 +475,7 @@ int Sys_GetProcessorId( void ) { #if defined(__ppc__) cpuid |= CPUID_ALTIVEC; #elif defined(__i386__) - cpuid |= CPUID_INTEL | CPUID_MMX | CPUID_SSE | CPUID_SSE2 | CPUID_SSE3 | CPUID_HTT | CPUID_CMOV | CPUID_FTZ | CPUID_DAZ; + cpuid |= CPUID_MMX | CPUID_SSE | CPUID_SSE2 | CPUID_SSE3 | CPUID_FTZ | CPUID_DAZ; #endif return cpuid; } diff --git a/neo/sys/sys_public.h b/neo/sys/sys_public.h index 1a070319..17af79ea 100644 --- a/neo/sys/sys_public.h +++ b/neo/sys/sys_public.h @@ -33,16 +33,12 @@ typedef enum { CPUID_NONE = 0x00000, CPUID_UNSUPPORTED = 0x00001, // unsupported (386/486) CPUID_GENERIC = 0x00002, // unrecognized processor - CPUID_INTEL = 0x00004, // Intel - CPUID_AMD = 0x00008, // AMD CPUID_MMX = 0x00010, // Multi Media Extensions CPUID_3DNOW = 0x00020, // 3DNow! CPUID_SSE = 0x00040, // Streaming SIMD Extensions CPUID_SSE2 = 0x00080, // Streaming SIMD Extensions 2 CPUID_SSE3 = 0x00100, // Streaming SIMD Extentions 3 aka Prescott's New Instructions CPUID_ALTIVEC = 0x00200, // AltiVec - CPUID_HTT = 0x01000, // Hyper-Threading Technology - CPUID_CMOV = 0x02000, // Conditional Move (CMOV) and fast floating point comparison (FCOMI) instructions CPUID_FTZ = 0x04000, // Flush-To-Zero mode (denormal results are flushed to zero) CPUID_DAZ = 0x08000 // Denormals-Are-Zero mode (denormal source operands are set to zero) } cpuid_t; diff --git a/neo/sys/win32/win_cpu.cpp b/neo/sys/win32/win_cpu.cpp index 09270ff6..224b4ae8 100644 --- a/neo/sys/win32/win_cpu.cpp +++ b/neo/sys/win32/win_cpu.cpp @@ -115,55 +115,6 @@ static void CPUID( int func, unsigned regs[4] ) { #endif } -/* -================ -IsAMD -================ -*/ -static bool IsAMD( void ) { - char pstring[16]; - char processorString[13]; - - // get name of processor - CPUID( 0, ( unsigned int * ) pstring ); - processorString[0] = pstring[4]; - processorString[1] = pstring[5]; - processorString[2] = pstring[6]; - processorString[3] = pstring[7]; - processorString[4] = pstring[12]; - processorString[5] = pstring[13]; - processorString[6] = pstring[14]; - processorString[7] = pstring[15]; - processorString[8] = pstring[8]; - processorString[9] = pstring[9]; - processorString[10] = pstring[10]; - processorString[11] = pstring[11]; - processorString[12] = 0; - - if ( strcmp( processorString, "AuthenticAMD" ) == 0 ) { - return true; - } - return false; -} - -/* -================ -HasCMOV -================ -*/ -static bool HasCMOV( void ) { - unsigned regs[4]; - - // get CPU feature bits - CPUID( 1, regs ); - - // bit 15 of EDX denotes CMOV existence - if ( regs[_REG_EDX] & ( 1 << 15 ) ) { - return true; - } - return false; -} - /* ================ Has3DNow @@ -261,176 +212,7 @@ static bool HasSSE3( void ) { /* ================ -LogicalProcPerPhysicalProc -================ -*/ -#define NUM_LOGICAL_BITS 0x00FF0000 // EBX[23:16] Bit 16-23 in ebx contains the number of logical - // processors per physical processor when execute cpuid with - // eax set to 1 -static unsigned char LogicalProcPerPhysicalProc( void ) { -#ifdef _MSC_VER - unsigned int regebx = 0; - __asm { - mov eax, 1 - cpuid - mov regebx, ebx - } - return (unsigned char) ((regebx & NUM_LOGICAL_BITS) >> 16); -#else - return 0; -#endif -} - -/* -================ -GetAPIC_ID -================ -*/ -#define INITIAL_APIC_ID_BITS 0xFF000000 // EBX[31:24] Bits 24-31 (8 bits) return the 8-bit unique - // initial APIC ID for the processor this code is running on. - // Default value = 0xff if HT is not supported -static unsigned char GetAPIC_ID( void ) { -#ifdef _MSC_VER - unsigned int regebx = 0; - __asm { - mov eax, 1 - cpuid - mov regebx, ebx - } - return (unsigned char) ((regebx & INITIAL_APIC_ID_BITS) >> 24); -#else - return '\0'; -#endif -} - -/* -================ -CPUCount - - logicalNum is the number of logical CPU per physical CPU - physicalNum is the total number of physical processor - returns one of the HT_* flags -================ -*/ -#define HT_NOT_CAPABLE 0 -#define HT_ENABLED 1 -#define HT_DISABLED 2 -#define HT_SUPPORTED_NOT_ENABLED 3 -#define HT_CANNOT_DETECT 4 - -int CPUCount( int &logicalNum, int &physicalNum ) { - int statusFlag; - SYSTEM_INFO info; - - physicalNum = 1; - logicalNum = 1; - statusFlag = HT_NOT_CAPABLE; - - info.dwNumberOfProcessors = 0; - GetSystemInfo (&info); - - // Number of physical processors in a non-Intel system - // or in a 32-bit Intel system with Hyper-Threading technology disabled - physicalNum = info.dwNumberOfProcessors; - - unsigned char HT_Enabled = 0; - - logicalNum = LogicalProcPerPhysicalProc(); - - if ( logicalNum >= 1 ) { // > 1 doesn't mean HT is enabled in the BIOS - HANDLE hCurrentProcessHandle; - DWORD dwProcessAffinity; - DWORD dwSystemAffinity; - DWORD dwAffinityMask; - - // Calculate the appropriate shifts and mask based on the - // number of logical processors. - - unsigned char i = 1, PHY_ID_MASK = 0xFF, PHY_ID_SHIFT = 0; - - while( i < logicalNum ) { - i *= 2; - PHY_ID_MASK <<= 1; - PHY_ID_SHIFT++; - } - - hCurrentProcessHandle = GetCurrentProcess(); - GetProcessAffinityMask( hCurrentProcessHandle, &dwProcessAffinity, &dwSystemAffinity ); - - // Check if available process affinity mask is equal to the - // available system affinity mask - if ( dwProcessAffinity != dwSystemAffinity ) { - statusFlag = HT_CANNOT_DETECT; - physicalNum = -1; - return statusFlag; - } - - dwAffinityMask = 1; - while ( dwAffinityMask != 0 && dwAffinityMask <= dwProcessAffinity ) { - // Check if this CPU is available - if ( dwAffinityMask & dwProcessAffinity ) { - if ( SetProcessAffinityMask( hCurrentProcessHandle, dwAffinityMask ) ) { - unsigned char APIC_ID, LOG_ID, PHY_ID; - - Sleep( 0 ); // Give OS time to switch CPU - - APIC_ID = GetAPIC_ID(); - LOG_ID = APIC_ID & ~PHY_ID_MASK; - PHY_ID = APIC_ID >> PHY_ID_SHIFT; - - if ( LOG_ID != 0 ) { - HT_Enabled = 1; - } - } - } - dwAffinityMask = dwAffinityMask << 1; - } - - // Reset the processor affinity - SetProcessAffinityMask( hCurrentProcessHandle, dwProcessAffinity ); - - if ( logicalNum == 1 ) { // Normal P4 : HT is disabled in hardware - statusFlag = HT_DISABLED; - } else { - if ( HT_Enabled ) { - // Total physical processors in a Hyper-Threading enabled system. - physicalNum /= logicalNum; - statusFlag = HT_ENABLED; - } else { - statusFlag = HT_SUPPORTED_NOT_ENABLED; - } - } - } - return statusFlag; -} - -/* -================ -HasHTT -================ -*/ -static bool HasHTT( void ) { - unsigned regs[4]; - int logicalNum, physicalNum, HTStatusFlag; - - // get CPU feature bits - CPUID( 1, regs ); - - // bit 28 of EDX denotes HTT existence - if ( !( regs[_REG_EDX] & ( 1 << 28 ) ) ) { - return false; - } - - HTStatusFlag = CPUCount( logicalNum, physicalNum ); - if ( HTStatusFlag != HT_ENABLED ) { - return false; - } - return true; -} - -/* -================ -HasHTT +HasDAZ ================ */ static bool HasDAZ( void ) { @@ -476,13 +258,6 @@ int Sys_GetCPUId( void ) { return CPUID_UNSUPPORTED; } - // check for an AMD - if ( IsAMD() ) { - flags = CPUID_AMD; - } else { - flags = CPUID_INTEL; - } - // check for Multi Media Extensions if ( HasMMX() ) { flags |= CPUID_MMX; @@ -508,16 +283,6 @@ int Sys_GetCPUId( void ) { flags |= CPUID_SSE3; } - // check for Hyper-Threading Technology - if ( HasHTT() ) { - flags |= CPUID_HTT; - } - - // check for Conditional Move (CMOV) and fast floating point comparison (FCOMI) instructions - if ( HasCMOV() ) { - flags |= CPUID_CMOV; - } - // check for Denormals-Are-Zero mode if ( HasDAZ() ) { flags |= CPUID_DAZ; diff --git a/neo/sys/win32/win_main.cpp b/neo/sys/win32/win_main.cpp index c2fee804..f947794c 100644 --- a/neo/sys/win32/win_main.cpp +++ b/neo/sys/win32/win_main.cpp @@ -856,14 +856,10 @@ void Sys_Init( void ) { string.Clear(); - if ( win32.cpuid & CPUID_AMD ) { - string += "AMD CPU"; - } else if ( win32.cpuid & CPUID_INTEL ) { - string += "Intel CPU"; - } else if ( win32.cpuid & CPUID_UNSUPPORTED ) { + if ( win32.cpuid & CPUID_UNSUPPORTED ) { string += "unsupported CPU"; } else { - string += "generic CPU"; + string += "CPU"; } string += " with "; @@ -882,9 +878,6 @@ void Sys_Init( void ) { if ( win32.cpuid & CPUID_SSE3 ) { string += "SSE3 & "; } - if ( win32.cpuid & CPUID_HTT ) { - string += "HTT & "; - } string.StripTrailing( " & " ); string.StripTrailing( " with " ); win32.sys_cpustring.SetString( string ); @@ -897,10 +890,6 @@ void Sys_Init( void ) { while( src.ReadToken( &token ) ) { if ( token.Icmp( "generic" ) == 0 ) { id |= CPUID_GENERIC; - } else if ( token.Icmp( "intel" ) == 0 ) { - id |= CPUID_INTEL; - } else if ( token.Icmp( "amd" ) == 0 ) { - id |= CPUID_AMD; } else if ( token.Icmp( "mmx" ) == 0 ) { id |= CPUID_MMX; } else if ( token.Icmp( "3dnow" ) == 0 ) { @@ -911,8 +900,6 @@ void Sys_Init( void ) { id |= CPUID_SSE2; } else if ( token.Icmp( "sse3" ) == 0 ) { id |= CPUID_SSE3; - } else if ( token.Icmp( "htt" ) == 0 ) { - id |= CPUID_HTT; } } if ( id == CPUID_NONE ) {