Fixed Nazara compilation on 64bits compiler
Former-commit-id: 5b9d8208691c34e30f4184c6a35f82a690c221f5
This commit is contained in:
parent
229f634e01
commit
abb2db1c7d
|
|
@ -37,45 +37,49 @@ unsigned int NzHardwareInfoImpl::GetProcessorCount()
|
||||||
|
|
||||||
bool NzHardwareInfoImpl::IsCpuidSupported()
|
bool NzHardwareInfoImpl::IsCpuidSupported()
|
||||||
{
|
{
|
||||||
#if defined(NAZARA_COMPILER_MSVC)
|
#ifdef NAZARA_PLATFORM_x64
|
||||||
int supported;
|
return true; // Toujours supporté sur un processeur 64 bits
|
||||||
__asm
|
|
||||||
{
|
|
||||||
pushfd
|
|
||||||
pop eax
|
|
||||||
mov ecx, eax
|
|
||||||
xor eax, 0x200000
|
|
||||||
push eax
|
|
||||||
popfd
|
|
||||||
pushfd
|
|
||||||
pop eax
|
|
||||||
xor eax, ecx
|
|
||||||
mov supported, eax
|
|
||||||
push ecx
|
|
||||||
popfd
|
|
||||||
};
|
|
||||||
|
|
||||||
return supported != 0;
|
|
||||||
#elif defined(NAZARA_COMPILER_CLANG) || defined(NAZARA_COMPILER_GCC) || defined(NAZARA_COMPILER_INTEL)
|
|
||||||
int supported;
|
|
||||||
asm volatile (" pushfl\n"
|
|
||||||
" pop %%eax\n"
|
|
||||||
" mov %%eax, %%ecx\n"
|
|
||||||
" xor $0x200000, %%eax\n"
|
|
||||||
" push %%eax\n"
|
|
||||||
" popfl\n"
|
|
||||||
" pushfl\n"
|
|
||||||
" pop %%eax\n"
|
|
||||||
" xor %%ecx, %%eax\n"
|
|
||||||
" mov %%eax, %0\n"
|
|
||||||
" push %%ecx\n"
|
|
||||||
" popfl"
|
|
||||||
: "=m" (supported) // output
|
|
||||||
: // input
|
|
||||||
: "eax", "ecx", "memory"); // clobbered register
|
|
||||||
|
|
||||||
return supported != 0;
|
|
||||||
#else
|
#else
|
||||||
return false;
|
#if defined(NAZARA_COMPILER_MSVC)
|
||||||
|
int supported;
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
pushfd
|
||||||
|
pop eax
|
||||||
|
mov ecx, eax
|
||||||
|
xor eax, 0x200000
|
||||||
|
push eax
|
||||||
|
popfd
|
||||||
|
pushfd
|
||||||
|
pop eax
|
||||||
|
xor eax, ecx
|
||||||
|
mov supported, eax
|
||||||
|
push ecx
|
||||||
|
popfd
|
||||||
|
};
|
||||||
|
|
||||||
|
return supported != 0;
|
||||||
|
#elif defined(NAZARA_COMPILER_CLANG) || defined(NAZARA_COMPILER_GCC) || defined(NAZARA_COMPILER_INTEL)
|
||||||
|
int supported;
|
||||||
|
asm volatile (" pushfl\n"
|
||||||
|
" pop %%eax\n"
|
||||||
|
" mov %%eax, %%ecx\n"
|
||||||
|
" xor $0x200000, %%eax\n"
|
||||||
|
" push %%eax\n"
|
||||||
|
" popfl\n"
|
||||||
|
" pushfl\n"
|
||||||
|
" pop %%eax\n"
|
||||||
|
" xor %%ecx, %%eax\n"
|
||||||
|
" mov %%eax, %0\n"
|
||||||
|
" push %%ecx\n"
|
||||||
|
" popfl"
|
||||||
|
: "=m" (supported) // output
|
||||||
|
: // input
|
||||||
|
: "eax", "ecx", "memory"); // clobbered register
|
||||||
|
|
||||||
|
return supported != 0;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue