|
|
@ -6,24 +6,48 @@ |
|
|
|
// $NoKeywords: $
|
|
|
|
// $NoKeywords: $
|
|
|
|
//=============================================================================//
|
|
|
|
//=============================================================================//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "platform.h" |
|
|
|
|
|
|
|
|
|
|
|
#if defined __SANITIZE_ADDRESS__ |
|
|
|
#if defined __SANITIZE_ADDRESS__ |
|
|
|
bool CheckMMXTechnology(void) { return false; } |
|
|
|
bool CheckMMXTechnology(void) { return false; } |
|
|
|
bool CheckSSETechnology(void) { return false; } |
|
|
|
bool CheckSSETechnology(void) { return false; } |
|
|
|
bool CheckSSE2Technology(void) { return false; } |
|
|
|
bool CheckSSE2Technology(void) { return false; } |
|
|
|
bool Check3DNowTechnology(void) { return false; } |
|
|
|
bool Check3DNowTechnology(void) { return false; } |
|
|
|
#elif defined (__arm__) |
|
|
|
#elif defined (__arm__) || defined (__arm64__) |
|
|
|
bool CheckMMXTechnology(void) { return false; } |
|
|
|
bool CheckMMXTechnology(void) { return false; } |
|
|
|
bool CheckSSETechnology(void) { return false; } |
|
|
|
bool CheckSSETechnology(void) { return false; } |
|
|
|
bool CheckSSE2Technology(void) { return false; } |
|
|
|
bool CheckSSE2Technology(void) { return false; } |
|
|
|
bool Check3DNowTechnology(void) { return false; } |
|
|
|
bool Check3DNowTechnology(void) { return false; } |
|
|
|
#else |
|
|
|
#else |
|
|
|
|
|
|
|
|
|
|
|
#define cpuid(in,a,b,c,d) \ |
|
|
|
static void cpuid(uint32 function, uint32& out_eax, uint32& out_ebx, uint32& out_ecx, uint32& out_edx) |
|
|
|
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)); |
|
|
|
{ |
|
|
|
|
|
|
|
#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" |
|
|
|
|
|
|
|
: "=a" (out_eax), |
|
|
|
|
|
|
|
"=S" (out_ebx), |
|
|
|
|
|
|
|
"=c" (out_ecx), |
|
|
|
|
|
|
|
"=d" (out_edx) |
|
|
|
|
|
|
|
: "a" (function) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool CheckMMXTechnology(void) |
|
|
|
bool CheckMMXTechnology(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
unsigned long eax,ebx,edx,unused; |
|
|
|
uint32 eax,ebx,edx,unused; |
|
|
|
cpuid(1,eax,ebx,unused,edx); |
|
|
|
cpuid(1,eax,ebx,unused,edx); |
|
|
|
|
|
|
|
|
|
|
|
return edx & 0x800000; |
|
|
|
return edx & 0x800000; |
|
|
@ -31,7 +55,7 @@ bool CheckMMXTechnology(void) |
|
|
|
|
|
|
|
|
|
|
|
bool CheckSSETechnology(void) |
|
|
|
bool CheckSSETechnology(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
unsigned long eax,ebx,edx,unused; |
|
|
|
uint32 eax,ebx,edx,unused; |
|
|
|
cpuid(1,eax,ebx,unused,edx); |
|
|
|
cpuid(1,eax,ebx,unused,edx); |
|
|
|
|
|
|
|
|
|
|
|
return edx & 0x2000000L; |
|
|
|
return edx & 0x2000000L; |
|
|
@ -39,7 +63,7 @@ bool CheckSSETechnology(void) |
|
|
|
|
|
|
|
|
|
|
|
bool CheckSSE2Technology(void) |
|
|
|
bool CheckSSE2Technology(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
unsigned long eax,ebx,edx,unused; |
|
|
|
uint32 eax,ebx,edx,unused; |
|
|
|
cpuid(1,eax,ebx,unused,edx); |
|
|
|
cpuid(1,eax,ebx,unused,edx); |
|
|
|
|
|
|
|
|
|
|
|
return edx & 0x04000000; |
|
|
|
return edx & 0x04000000; |
|
|
@ -47,7 +71,7 @@ bool CheckSSE2Technology(void) |
|
|
|
|
|
|
|
|
|
|
|
bool Check3DNowTechnology(void) |
|
|
|
bool Check3DNowTechnology(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
unsigned long eax, unused; |
|
|
|
uint32 eax, unused; |
|
|
|
cpuid(0x80000000,eax,unused,unused,unused); |
|
|
|
cpuid(0x80000000,eax,unused,unused,unused); |
|
|
|
|
|
|
|
|
|
|
|
if ( eax > 0x80000000L ) |
|
|
|
if ( eax > 0x80000000L ) |
|
|
|