cpu: Reimplement pcState(Addr) without using the PCState constructor.
Use the BaseISA::newPCState(Addr) method instead, so that we don't need
to know how to build PCState objects for the given ISA.
Because the pcState() accessor still takes a const reference to a
PCState, we still need to use the TheISA::PCState type to call it. In
the future this will also take a PCStatePtr, so that use will go away.
Change-Id: I8f2f66b58c342e8c455d438047857c0119566b2b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/52054
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
diff --git a/src/cpu/thread_context.hh b/src/cpu/thread_context.hh
index 1f04e3c..2fd22ff 100644
--- a/src/cpu/thread_context.hh
+++ b/src/cpu/thread_context.hh
@@ -226,7 +226,11 @@
virtual TheISA::PCState pcState() const = 0;
virtual void pcState(const TheISA::PCState &val) = 0;
- void pcState(Addr addr) { pcState(TheISA::PCState(addr)); }
+ void
+ pcState(Addr addr)
+ {
+ pcState(getIsaPtr()->newPCState(addr)->as<TheISA::PCState>());
+ }
void
setNPC(Addr val)