#include "arch/x86/cpuid.hh"
+#include "arch/x86/isa.hh"
#include "base/bitfield.hh"
#include "cpu/thread_context.hh"
NumExtendedCpuidFuncs
};
- static const int vendorStringSize = 13;
- static const char vendorString[vendorStringSize] = "M5 Simulator";
static const int nameStringSize = 48;
static const char nameString[nameStringSize] = "Fake M5 x86_64 CPU";
// The extended functions
switch (funcNum) {
case VendorAndLargestExtFunc:
- assert(vendorStringSize >= 12);
- result = CpuidResult(
- 0x80000000 + NumExtendedCpuidFuncs - 1,
- stringToRegister(vendorString),
- stringToRegister(vendorString + 4),
- stringToRegister(vendorString + 8));
+ {
+ ISA *isa = dynamic_cast<ISA *>(tc->getIsaPtr());
+ const char *vendor_string = isa->getVendorString().c_str();
+ result = CpuidResult(
+ 0x80000000 + NumExtendedCpuidFuncs - 1,
+ stringToRegister(vendor_string),
+ stringToRegister(vendor_string + 4),
+ stringToRegister(vendor_string + 8));
+ }
break;
case FamilyModelSteppingBrandFeatures:
result = CpuidResult(0x00020f51, 0x00000405,
// The standard functions
switch (funcNum) {
case VendorAndLargestStdFunc:
- assert(vendorStringSize >= 12);
- result = CpuidResult(
- NumStandardCpuidFuncs - 1,
- stringToRegister(vendorString),
- stringToRegister(vendorString + 4),
- stringToRegister(vendorString + 8));
+ {
+ ISA *isa = dynamic_cast<ISA *>(tc->getIsaPtr());
+ const char *vendor_string = isa->getVendorString().c_str();
+ result = CpuidResult(
+ NumExtendedCpuidFuncs - 1,
+ stringToRegister(vendor_string),
+ stringToRegister(vendor_string + 4),
+ stringToRegister(vendor_string + 8));
+ }
break;
case FamilyModelStepping:
result = CpuidResult(0x00020f51, 0x00000805,
regVal[MISCREG_APIC_BASE] = lApicBase;
}
-ISA::ISA(const Params &p) : BaseISA(p)
+ISA::ISA(const X86ISAParams &p) : BaseISA(p), vendorString(p.vendor_string)
{
+ fatal_if(vendorString.size() != 12,
+ "CPUID vendor string must be 12 characters\n");
clear();
}
tc->getDecoderPtr()->setM5Reg(regVal[MISCREG_M5_REG]);
}
+std::string
+ISA::getVendorString() const
+{
+ return vendorString;
+}
+
}