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>
This commit is contained in:
Gabe Black
2021-10-14 01:42:11 -07:00
parent 70f9a32117
commit d8a6e7e73e

View File

@@ -226,7 +226,11 @@ class ThreadContext : public PCEventScope
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)