arch: Make the advance() method virtual and in PCStateBase.
It's occasionally necessary to advance the PC to the next instruction without having an instruction to do it with. This makes it available without having to cast to a PCState subclass. Change-Id: I3b7d94afdfb27b34279e58158782e87ab5066a37 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/52065 Tested-by: kokoro <noreply+kokoro@google.com> Maintainer: Gabe Black <gabe.black@gmail.com> Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
This commit is contained in:
@@ -288,7 +288,7 @@ class PCState : public GenericISA::UPCState<4>
|
||||
}
|
||||
|
||||
void
|
||||
advance()
|
||||
advance() override
|
||||
{
|
||||
Base::advance();
|
||||
flags = nextFlags;
|
||||
|
||||
@@ -126,6 +126,8 @@ class PCStateBase : public Serializable
|
||||
_upc = 0;
|
||||
}
|
||||
|
||||
virtual void advance() = 0;
|
||||
|
||||
void
|
||||
serialize(CheckpointOut &cp) const override
|
||||
{
|
||||
@@ -370,7 +372,7 @@ class SimplePCState : public PCStateCommon
|
||||
|
||||
// Advance the PC.
|
||||
void
|
||||
advance()
|
||||
advance() override
|
||||
{
|
||||
this->_pc = this->_npc;
|
||||
this->_npc += InstWidth;
|
||||
@@ -493,7 +495,7 @@ class DelaySlotPCState : public SimplePCState<InstWidth>
|
||||
|
||||
// Advance the PC.
|
||||
void
|
||||
advance()
|
||||
advance() override
|
||||
{
|
||||
this->_pc = this->_npc;
|
||||
this->_npc = this->_nnpc;
|
||||
|
||||
@@ -95,7 +95,7 @@ class PCState : public GenericISA::UPCState<8>
|
||||
}
|
||||
|
||||
void
|
||||
advance()
|
||||
advance() override
|
||||
{
|
||||
Base::advance();
|
||||
_size = 0;
|
||||
|
||||
@@ -50,9 +50,9 @@ class NopStaticInst : public StaticInst
|
||||
}
|
||||
|
||||
void
|
||||
advancePC(PCStateBase &pcState) const override
|
||||
advancePC(PCStateBase &pc) const override
|
||||
{
|
||||
pcState.as<TheISA::PCState>().advance();
|
||||
pc.advance();
|
||||
}
|
||||
|
||||
std::string
|
||||
|
||||
@@ -1662,7 +1662,7 @@ cloneFunc(SyscallDesc *desc, ThreadContext *tc, RegVal flags, RegVal newStack,
|
||||
desc->returnInto(ctc, 0);
|
||||
|
||||
std::unique_ptr<PCStateBase> cpc(tc->pcState().clone());
|
||||
cpc->as<TheISA::PCState>().advance();
|
||||
cpc->advance();
|
||||
ctc->pcState(*cpc);
|
||||
ctc->activate();
|
||||
|
||||
@@ -2226,7 +2226,7 @@ execveFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
new_p->initState();
|
||||
tc->activate();
|
||||
std::unique_ptr<PCStateBase> pc_state(tc->pcState().clone());
|
||||
pc_state->as<TheISA::PCState>().advance();
|
||||
pc_state->advance();
|
||||
tc->pcState(*pc_state);
|
||||
|
||||
return SyscallReturn();
|
||||
|
||||
Reference in New Issue
Block a user