CPU: move the PC Events code to a place where the code won't be executed multiple times if an instruction faults.
--HG-- extra : convert_revision : 19c8e46a4eea206517be7ed4131ab9df0fe00e68
This commit is contained in:
parent
fc38e9c630
commit
9faec83ac5
4 changed files with 13 additions and 6 deletions
|
@ -713,6 +713,8 @@ AtomicSimpleCPU::tick()
|
|||
if (!curStaticInst || !curStaticInst->isDelayedCommit())
|
||||
checkForInterrupts();
|
||||
|
||||
checkPcEventQueue();
|
||||
|
||||
Fault fault = setupFetchRequest(&ifetch_req);
|
||||
|
||||
if (fault == NoFault) {
|
||||
|
|
|
@ -494,12 +494,6 @@ BaseSimpleCPU::advancePC(Fault fault)
|
|||
assert(thread->readNextPC() != thread->readNextNPC());
|
||||
}
|
||||
}
|
||||
|
||||
Addr oldpc;
|
||||
do {
|
||||
oldpc = thread->readPC();
|
||||
system->pcEventQueue.service(tc);
|
||||
} while (oldpc != thread->readPC());
|
||||
}
|
||||
|
||||
/*Fault
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "mem/port.hh"
|
||||
#include "mem/request.hh"
|
||||
#include "sim/eventq.hh"
|
||||
#include "sim/system.hh"
|
||||
|
||||
// forward declarations
|
||||
#if FULL_SYSTEM
|
||||
|
@ -86,6 +87,14 @@ class BaseSimpleCPU : public BaseCPU
|
|||
protected:
|
||||
Trace::InstRecord *traceData;
|
||||
|
||||
inline void checkPcEventQueue() {
|
||||
Addr oldpc;
|
||||
do {
|
||||
oldpc = thread->readPC();
|
||||
system->pcEventQueue.service(tc);
|
||||
} while (oldpc != thread->readPC());
|
||||
}
|
||||
|
||||
public:
|
||||
void post_interrupt(int int_num, int index);
|
||||
|
||||
|
|
|
@ -522,6 +522,8 @@ TimingSimpleCPU::fetch()
|
|||
if (!curStaticInst || !curStaticInst->isDelayedCommit())
|
||||
checkForInterrupts();
|
||||
|
||||
checkPcEventQueue();
|
||||
|
||||
Request *ifetch_req = new Request();
|
||||
ifetch_req->setThreadContext(cpuId, /* thread ID */ 0);
|
||||
Fault fault = setupFetchRequest(ifetch_req);
|
||||
|
|
Loading…
Reference in a new issue