arch-x86: Add extended state CPUID function
The extended state CPUID function is used to set the values of the XCR0 register as well as specify the size of storage for context switching storage for x87 and AVX+. This function is iterative and therefore requires (1) marking it as such in the hsaSignificantIndex function (2) setting multiple sets of 4-tuples for the default CPUID values where the last 4-tuple ends with all zeros. Change-Id: Ib6a43925afb1cae75f61d8acff52a3cc26ce17c8
This commit is contained in:
@@ -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],
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ enum StandardCpuidFunction
|
||||
MonitorMwait,
|
||||
ThermalPowerMgmt,
|
||||
ExtendedFeatures,
|
||||
ExtendedState = 0xD,
|
||||
NumStandardCpuidFuncs
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user