Gabe Black has submitted this change. (
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
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/37695
Reviewed-by: Matthew Poremba <[email protected]>
Reviewed-by: Jason Lowe-Power <[email protected]>
Maintainer: Jason Lowe-Power <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/arch/x86/cpuid.cc
1 file changed, 8 insertions(+), 8 deletions(-)
Approvals:
Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
Matthew Poremba: Looks good to me, approved
kokoro: Regressions pass
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: 5
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Matthew Poremba <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s