diff --git a/src/arch/x86/X86ISA.py b/src/arch/x86/X86ISA.py index aa5c29a98e..aa48d1aa6e 100644 --- a/src/arch/x86/X86ISA.py +++ b/src/arch/x86/X86ISA.py @@ -85,6 +85,20 @@ class X86ISA(BaseISA): ExtendedFeatures = VectorParam.UInt32( [0x00000000, 0x01800000, 0x00000000, 0x00000000], "feature flags" ) + # 0000_000Dh - This uses ECX index, so the last entry must be all zeros + ExtendedState = VectorParam.UInt32( + [ + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + ], + "extended state enumeration", + ) # 8000_0001h FamilyModelSteppingBrandFeatures = VectorParam.UInt32( [0x00020F51, 0x00000405, 0xEBD3FBFF, 0x00020001], diff --git a/src/arch/x86/cpuid.cc b/src/arch/x86/cpuid.cc index 75e69735c1..2ce9ec9289 100644 --- a/src/arch/x86/cpuid.cc +++ b/src/arch/x86/cpuid.cc @@ -146,6 +146,18 @@ X86CPUID::stringToRegister(const char *str) bool X86CPUID::hasSignificantIndex(uint32_t function) { + uint16_t family = bits(function, 31, 16); + uint16_t funcNum = bits(function, 15, 0); + + if (family == 0x0000) { + switch (funcNum) { + case ExtendedState: + return true; + default: + return false; + } + } + return false; } diff --git a/src/arch/x86/cpuid.hh b/src/arch/x86/cpuid.hh index 71e8d3c626..1c932980d2 100644 --- a/src/arch/x86/cpuid.hh +++ b/src/arch/x86/cpuid.hh @@ -52,6 +52,7 @@ enum StandardCpuidFunction MonitorMwait, ThermalPowerMgmt, ExtendedFeatures, + ExtendedState = 0xD, NumStandardCpuidFuncs }; diff --git a/src/arch/x86/isa.cc b/src/arch/x86/isa.cc index cf1ff9f593..9e6082a268 100644 --- a/src/arch/x86/isa.cc +++ b/src/arch/x86/isa.cc @@ -157,6 +157,7 @@ ISA::ISA(const X86ISAParams &p) cpuid->addStandardFunc(FamilyModelStepping, p.FamilyModelStepping); cpuid->addStandardFunc(CacheParams, p.CacheParams); cpuid->addStandardFunc(ExtendedFeatures, p.ExtendedFeatures); + cpuid->addStandardFunc(ExtendedState, p.ExtendedState); cpuid->addExtendedFunc(FamilyModelSteppingBrandFeatures, p.FamilyModelSteppingBrandFeatures);