x86: Fix object scope in the CPUID code.
The original version of the code takes a pointer from a temporary object which gets destroyed before the pointer is used. Change-Id: I16af4eefdf202f769a672e230330d8e0bfce3bb7 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/37695 Reviewed-by: Matthew Poremba <matthew.poremba@amd.com> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -94,12 +94,12 @@ namespace X86ISA {
|
||||
case VendorAndLargestExtFunc:
|
||||
{
|
||||
ISA *isa = dynamic_cast<ISA *>(tc->getIsaPtr());
|
||||
const char *vendor_string = isa->getVendorString().c_str();
|
||||
auto vendor_string = isa->getVendorString();
|
||||
result = CpuidResult(
|
||||
0x80000000 + NumExtendedCpuidFuncs - 1,
|
||||
stringToRegister(vendor_string),
|
||||
stringToRegister(vendor_string + 4),
|
||||
stringToRegister(vendor_string + 8));
|
||||
stringToRegister(vendor_string.c_str()),
|
||||
stringToRegister(vendor_string.c_str() + 4),
|
||||
stringToRegister(vendor_string.c_str() + 8));
|
||||
}
|
||||
break;
|
||||
case FamilyModelSteppingBrandFeatures:
|
||||
@@ -155,12 +155,12 @@ namespace X86ISA {
|
||||
case VendorAndLargestStdFunc:
|
||||
{
|
||||
ISA *isa = dynamic_cast<ISA *>(tc->getIsaPtr());
|
||||
const char *vendor_string = isa->getVendorString().c_str();
|
||||
auto vendor_string = isa->getVendorString();
|
||||
result = CpuidResult(
|
||||
NumExtendedCpuidFuncs - 1,
|
||||
stringToRegister(vendor_string),
|
||||
stringToRegister(vendor_string + 4),
|
||||
stringToRegister(vendor_string + 8));
|
||||
stringToRegister(vendor_string.c_str()),
|
||||
stringToRegister(vendor_string.c_str() + 4),
|
||||
stringToRegister(vendor_string.c_str() + 8));
|
||||
}
|
||||
break;
|
||||
case FamilyModelStepping:
|
||||
|
||||
Reference in New Issue
Block a user