diff --git a/src/arch/arm/pcstate.hh b/src/arch/arm/pcstate.hh index b2a88c89c3..5bbad266f4 100644 --- a/src/arch/arm/pcstate.hh +++ b/src/arch/arm/pcstate.hh @@ -102,6 +102,8 @@ class PCState : public GenericISA::UPCState<4> PCState(Addr val) { set(val); } + PCStateBase *clone() const override { return new PCState(*this); } + bool illegalExec() const { diff --git a/src/arch/generic/pcstate.hh b/src/arch/generic/pcstate.hh index c12b5cfd76..6d4e23e433 100644 --- a/src/arch/generic/pcstate.hh +++ b/src/arch/generic/pcstate.hh @@ -68,6 +68,8 @@ class PCStateBase : public Serializable { return static_cast(*this); } + + virtual PCStateBase *clone() const = 0; }; namespace GenericISA @@ -188,6 +190,12 @@ class SimplePCState : public PCStateCommon SimplePCState() {} SimplePCState(Addr val) { set(val); } + PCStateBase * + clone() const override + { + return new SimplePCState(*this); + } + /** * Force this PC to reflect a particular value, resetting all its other * fields around it. This is useful for in place (re)initialization. @@ -232,6 +240,11 @@ class UPCState : public SimplePCState typedef SimplePCState Base; public: + PCStateBase * + clone() const override + { + return new UPCState(*this); + } MicroPC upc() const { return this->_upc; } void upc(MicroPC val) { this->_upc = val; } @@ -307,6 +320,11 @@ class DelaySlotPCState : public SimplePCState Addr _nnpc; public: + PCStateBase * + clone() const override + { + return new DelaySlotPCState(*this); + } Addr nnpc() const { return _nnpc; } void nnpc(Addr val) { _nnpc = val; } @@ -387,6 +405,11 @@ class DelaySlotUPCState : public DelaySlotPCState MicroPC _nupc; public: + PCStateBase * + clone() const override + { + return new DelaySlotUPCState(*this); + } MicroPC upc() const { return _upc; } void upc(MicroPC val) { _upc = val; } diff --git a/src/arch/power/pcstate.hh b/src/arch/power/pcstate.hh index 7784005040..c46b37e6c7 100644 --- a/src/arch/power/pcstate.hh +++ b/src/arch/power/pcstate.hh @@ -47,6 +47,8 @@ class PCState : public GenericISA::SimplePCState<4> public: using GenericISA::SimplePCState<4>::SimplePCState; + PCStateBase *clone() const override { return new PCState(*this); } + ByteOrder byteOrder() const { diff --git a/src/arch/riscv/pcstate.hh b/src/arch/riscv/pcstate.hh index 0ab2b912ef..3187318d2d 100644 --- a/src/arch/riscv/pcstate.hh +++ b/src/arch/riscv/pcstate.hh @@ -59,6 +59,8 @@ class PCState : public GenericISA::UPCState<4> public: using GenericISA::UPCState<4>::UPCState; + PCStateBase *clone() const override { return new PCState(*this); } + void compressed(bool c) { _compressed = c; } bool compressed() const { return _compressed; } diff --git a/src/arch/x86/pcstate.hh b/src/arch/x86/pcstate.hh index 077ea15c5b..28547f3593 100644 --- a/src/arch/x86/pcstate.hh +++ b/src/arch/x86/pcstate.hh @@ -55,6 +55,8 @@ class PCState : public GenericISA::UPCState<8> uint8_t _size; public: + PCStateBase *clone() const override { return new PCState(*this); } + void set(Addr val) {