Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/37695 )
Change subject: x86: Fix object scope in the CPUID code.
......................................................................
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
---
M src/arch/x86/cpuid.cc
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/arch/x86/cpuid.cc b/src/arch/x86/cpuid.cc
index 8c9f29c..2a560f5 100644
--- a/src/arch/x86/cpuid.cc
+++ b/src/arch/x86/cpuid.cc
@@ -94,12 +94,12 @@
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 @@
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:
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/37695
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I16af4eefdf202f769a672e230330d8e0bfce3bb7
Gerrit-Change-Number: 37695
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s