mirror of https://github.com/AxioDL/zeus.git
Add highestFeature check to cpuid users
This commit is contained in:
parent
10d389ffda
commit
c466fd21d1
|
@ -45,6 +45,7 @@ void detectCPU()
|
||||||
|
|
||||||
int regs[4];
|
int regs[4];
|
||||||
getCpuInfo(0, regs);
|
getCpuInfo(0, regs);
|
||||||
|
int highestFeature = regs[0];
|
||||||
*reinterpret_cast<int*>((char*)g_cpuFeatures.cpuVendor) = regs[1];
|
*reinterpret_cast<int*>((char*)g_cpuFeatures.cpuVendor) = regs[1];
|
||||||
*reinterpret_cast<int*>((char*)g_cpuFeatures.cpuVendor + 4) = regs[3];
|
*reinterpret_cast<int*>((char*)g_cpuFeatures.cpuVendor + 4) = regs[3];
|
||||||
*reinterpret_cast<int*>((char*)g_cpuFeatures.cpuVendor + 8) = regs[2];
|
*reinterpret_cast<int*>((char*)g_cpuFeatures.cpuVendor + 8) = regs[2];
|
||||||
|
@ -64,8 +65,9 @@ void detectCPU()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (highestFeature >= 1)
|
||||||
|
{
|
||||||
getCpuInfo(1, regs);
|
getCpuInfo(1, regs);
|
||||||
|
|
||||||
memset((bool*)&g_cpuFeatures.AESNI, ((regs[2] & 0x02000000) != 0), 1);
|
memset((bool*)&g_cpuFeatures.AESNI, ((regs[2] & 0x02000000) != 0), 1);
|
||||||
memset((bool*)&g_cpuFeatures.SSE1, ((regs[3] & 0x02000000) != 0), 1);
|
memset((bool*)&g_cpuFeatures.SSE1, ((regs[3] & 0x02000000) != 0), 1);
|
||||||
memset((bool*)&g_cpuFeatures.SSE2, ((regs[3] & 0x04000000) != 0), 1);
|
memset((bool*)&g_cpuFeatures.SSE2, ((regs[3] & 0x04000000) != 0), 1);
|
||||||
|
@ -74,10 +76,13 @@ void detectCPU()
|
||||||
memset((bool*)&g_cpuFeatures.SSE41, ((regs[2] & 0x00080000) != 0), 1);
|
memset((bool*)&g_cpuFeatures.SSE41, ((regs[2] & 0x00080000) != 0), 1);
|
||||||
memset((bool*)&g_cpuFeatures.SSE42, ((regs[2] & 0x00100000) != 0), 1);
|
memset((bool*)&g_cpuFeatures.SSE42, ((regs[2] & 0x00100000) != 0), 1);
|
||||||
memset((bool*)&g_cpuFeatures.AVX, ((regs[2] & 0x10000000) != 0), 1);
|
memset((bool*)&g_cpuFeatures.AVX, ((regs[2] & 0x10000000) != 0), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (highestFeature >= 7)
|
||||||
|
{
|
||||||
getCpuInfoEx(7, 0, regs);
|
getCpuInfoEx(7, 0, regs);
|
||||||
|
|
||||||
memset((bool*)&g_cpuFeatures.AVX2, ((regs[1] & 0x00000020) != 0), 1);
|
memset((bool*)&g_cpuFeatures.AVX2, ((regs[1] & 0x00000020) != 0), 1);
|
||||||
|
}
|
||||||
|
|
||||||
isCPUInit = true;
|
isCPUInit = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue