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:
Ali Saidi 2008-02-14 16:14:35 -05:00
parent fc38e9c630
commit 9faec83ac5
4 changed files with 13 additions and 6 deletions

View file

@ -713,6 +713,8 @@ AtomicSimpleCPU::tick()
if (!curStaticInst || !curStaticInst->isDelayedCommit()) if (!curStaticInst || !curStaticInst->isDelayedCommit())
checkForInterrupts(); checkForInterrupts();
checkPcEventQueue();
Fault fault = setupFetchRequest(&ifetch_req); Fault fault = setupFetchRequest(&ifetch_req);
if (fault == NoFault) { if (fault == NoFault) {

View file

@ -494,12 +494,6 @@ BaseSimpleCPU::advancePC(Fault fault)
assert(thread->readNextPC() != thread->readNextNPC()); assert(thread->readNextPC() != thread->readNextNPC());
} }
} }
Addr oldpc;
do {
oldpc = thread->readPC();
system->pcEventQueue.service(tc);
} while (oldpc != thread->readPC());
} }
/*Fault /*Fault

View file

@ -44,6 +44,7 @@
#include "mem/port.hh" #include "mem/port.hh"
#include "mem/request.hh" #include "mem/request.hh"
#include "sim/eventq.hh" #include "sim/eventq.hh"
#include "sim/system.hh"
// forward declarations // forward declarations
#if FULL_SYSTEM #if FULL_SYSTEM
@ -86,6 +87,14 @@ class BaseSimpleCPU : public BaseCPU
protected: protected:
Trace::InstRecord *traceData; Trace::InstRecord *traceData;
inline void checkPcEventQueue() {
Addr oldpc;
do {
oldpc = thread->readPC();
system->pcEventQueue.service(tc);
} while (oldpc != thread->readPC());
}
public: public:
void post_interrupt(int int_num, int index); void post_interrupt(int int_num, int index);

View file

@ -522,6 +522,8 @@ TimingSimpleCPU::fetch()
if (!curStaticInst || !curStaticInst->isDelayedCommit()) if (!curStaticInst || !curStaticInst->isDelayedCommit())
checkForInterrupts(); checkForInterrupts();
checkPcEventQueue();
Request *ifetch_req = new Request(); Request *ifetch_req = new Request();
ifetch_req->setThreadContext(cpuId, /* thread ID */ 0); ifetch_req->setThreadContext(cpuId, /* thread ID */ 0);
Fault fault = setupFetchRequest(ifetch_req); Fault fault = setupFetchRequest(ifetch_req);