Use x86 highest basic before calling a leaf function
This was a latent bug that just surfaced on a Sun Core2 workstation. RDSEED caused an illegal instruction exception on the Core2. It seems we managed to miss it because old processors had family and stepping values so low they never set CPUID.EBX.RDSEED[bit 18] = 1. Newer processors had the feature so CPUID.EBX.RDSEED[bit 18] = 1 was accurate.pull/566/head
parent
591d70f1c7
commit
788cd1794d
4
cpu.cpp
4
cpu.cpp
|
|
@ -240,7 +240,7 @@ void DetectX86Features()
|
||||||
g_cacheLineSize = 8 * GETBYTE(cpuid1[1], 1);
|
g_cacheLineSize = 8 * GETBYTE(cpuid1[1], 1);
|
||||||
g_hasRDRAND = !!(cpuid1[2] /*ECX*/ & RDRAND_FLAG);
|
g_hasRDRAND = !!(cpuid1[2] /*ECX*/ & RDRAND_FLAG);
|
||||||
|
|
||||||
if (cpuid1[0] /*EAX*/ >= 7)
|
if (cpuid0[0] /*EAX*/ >= 7)
|
||||||
{
|
{
|
||||||
if (CpuId(7, 0, cpuid2))
|
if (CpuId(7, 0, cpuid2))
|
||||||
{
|
{
|
||||||
|
|
@ -261,7 +261,7 @@ void DetectX86Features()
|
||||||
g_cacheLineSize = GETBYTE(cpuid2[2], 0);
|
g_cacheLineSize = GETBYTE(cpuid2[2], 0);
|
||||||
g_hasRDRAND = !!(cpuid1[2] /*ECX*/ & RDRAND_FLAG);
|
g_hasRDRAND = !!(cpuid1[2] /*ECX*/ & RDRAND_FLAG);
|
||||||
|
|
||||||
if (cpuid1[0] /*EAX*/ >= 7)
|
if (cpuid0[0] /*EAX*/ >= 7)
|
||||||
{
|
{
|
||||||
if (CpuId(7, 0, cpuid2))
|
if (CpuId(7, 0, cpuid2))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue