1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-01-03 16:13:22 +08:00
hl2sdk/tier1/processor_detect_linux.cpp
Benoist 8a6d1c6cd2
TF2 win64 + Ambuild tier1/mathlib + long=devil (#198)
* Fix compilation for windows, setup ambuild

* Add built tier1 and mathlib for win64

* Ensure compilation is working on windows and linux

* Add -fPIC

* Add compiled libs, with optimisation enabled

* Added windows lib

* Fix hl2sdk for windows

* Longs are the devil

* Fix up threadtools functions

* Add updated libs

* Rework lib naming, and package script

* Update lib directory according to new packaging

---------

Co-authored-by: Kenzzer <kenzzer@users.noreply.github.com>
2024-03-09 03:57:12 +00:00

65 lines
1.4 KiB
C++
Raw Blame History

//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: linux dependant ASM code for CPU capability detection
//
// $Workfile: $
// $NoKeywords: $
//=============================================================================//
#include <cstdint>
#define cpuid(in,a,b,c,d) \
asm("pushl %%ebx\n\t" "cpuid\n\t" "movl %%ebx,%%esi\n\t" "pop %%ebx": "=a" (a), "=S" (b), "=c" (c), "=d" (d) : "a" (in));
bool CheckMMXTechnology(void)
{
#ifndef PLATFORM_64BITS
uint32_t eax,ebx,edx,unused;
cpuid(1,eax,ebx,unused,edx);
return edx & 0x800000;
#else
return true;
#endif
}
bool CheckSSETechnology(void)
{
#ifndef PLATFORM_64BITS
uint32_t eax,ebx,edx,unused;
cpuid(1,eax,ebx,unused,edx);
return edx & 0x2000000L;
#else
return true;
#endif
}
bool CheckSSE2Technology(void)
{
#ifndef PLATFORM_64BITS
uint32_t eax,ebx,edx,unused;
cpuid(1,eax,ebx,unused,edx);
return edx & 0x04000000;
#else
return true;
#endif
}
bool Check3DNowTechnology(void)
{
#ifndef PLATFORM_64BITS
uint32_t eax, unused;
cpuid(0x80000000,eax,unused,unused,unused);
if ( eax > 0x80000000L )
{
cpuid(0x80000001,unused,unused,unused,eax);
return ( eax & 1<<31 );
}
return false;
#else
return true;
#endif
}