summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpu/exec_context.hh5
-rw-r--r--cpu/simple/cpu.cc4
2 files changed, 7 insertions, 2 deletions
diff --git a/cpu/exec_context.hh b/cpu/exec_context.hh
index 550a1ca23..d6a3fef8b 100644
--- a/cpu/exec_context.hh
+++ b/cpu/exec_context.hh
@@ -422,6 +422,11 @@ class ExecContext
regs.npc = val;
}
+ uint64_t readNextNPC()
+ {
+ return regs.nnpc;
+ }
+
void setNextNPC(uint64_t val)
{
regs.nnpc = val;
diff --git a/cpu/simple/cpu.cc b/cpu/simple/cpu.cc
index f1a3ebd0b..c85154521 100644
--- a/cpu/simple/cpu.cc
+++ b/cpu/simple/cpu.cc
@@ -825,8 +825,8 @@ SimpleCPU::tick()
#else
// go to the next instruction
xc->regs.pc = xc->regs.npc;
- xc->regs.npc = xc->regs.nnpc;
- xc->regs.nnpc += sizeof(MachInst);
+ xc->setNextPC(xc->readNextNPC());
+ xc->setNextNPC(xc->readNextNPC() + sizeof(MachInst));
#endif
}