From 6833ca7eedd351596bb1518620af7465f5172fcd Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 13 Sep 2010 19:26:03 -0700 Subject: Faults: Pass the StaticInst involved, if any, to a Fault's invoke method. Also move the "Fault" reference counted pointer type into a separate file, sim/fault.hh. It would be better to name this less similarly to sim/faults.hh to reduce confusion, but fault.hh matches the name of the type. We could change Fault to FaultPtr to match other pointer types, and then changing the name of the file would make more sense. --- src/cpu/o3/commit_impl.hh | 2 +- src/cpu/o3/cpu.cc | 7 ++++--- src/cpu/o3/cpu.hh | 2 +- src/cpu/o3/dyn_inst_impl.hh | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src/cpu/o3') diff --git a/src/cpu/o3/commit_impl.hh b/src/cpu/o3/commit_impl.hh index cb5f23814..468781e4d 100644 --- a/src/cpu/o3/commit_impl.hh +++ b/src/cpu/o3/commit_impl.hh @@ -1068,7 +1068,7 @@ DefaultCommit::commitHead(DynInstPtr &head_inst, unsigned inst_num) // needed to update the state as soon as possible. This // prevents external agents from changing any specific state // that the trap need. - cpu->trap(inst_fault, tid); + cpu->trap(inst_fault, tid, head_inst); // Exit state update mode to avoid accidental updating. thread[tid]->inSyscall = false; diff --git a/src/cpu/o3/cpu.cc b/src/cpu/o3/cpu.cc index 49bfe88e3..7eea04ce6 100644 --- a/src/cpu/o3/cpu.cc +++ b/src/cpu/o3/cpu.cc @@ -926,7 +926,8 @@ FullO3CPU::processInterrupts(Fault interrupt) this->interrupts->updateIntrInfo(this->threadContexts[0]); DPRINTF(O3CPU, "Interrupt %s being handled\n", interrupt->name()); - this->trap(interrupt, 0); + DynInstPtr dummyInst; + this->trap(interrupt, 0, dummyInst); } template @@ -943,10 +944,10 @@ FullO3CPU::updateMemPorts() template void -FullO3CPU::trap(Fault fault, ThreadID tid) +FullO3CPU::trap(Fault fault, ThreadID tid, DynInstPtr inst) { // Pass the thread's TC into the invoke method. - fault->invoke(this->threadContexts[tid]); + fault->invoke(this->threadContexts[tid], inst->staticInst); } #if !FULL_SYSTEM diff --git a/src/cpu/o3/cpu.hh b/src/cpu/o3/cpu.hh index a102a21f5..e7368993b 100644 --- a/src/cpu/o3/cpu.hh +++ b/src/cpu/o3/cpu.hh @@ -367,7 +367,7 @@ class FullO3CPU : public BaseO3CPU { return globalSeqNum++; } /** Traps to handle given fault. */ - void trap(Fault fault, ThreadID tid); + void trap(Fault fault, ThreadID tid, DynInstPtr inst); #if FULL_SYSTEM /** HW return from error interrupt. */ diff --git a/src/cpu/o3/dyn_inst_impl.hh b/src/cpu/o3/dyn_inst_impl.hh index 8d391ceaf..9406e2be0 100644 --- a/src/cpu/o3/dyn_inst_impl.hh +++ b/src/cpu/o3/dyn_inst_impl.hh @@ -155,7 +155,7 @@ template void BaseO3DynInst::trap(Fault fault) { - this->cpu->trap(fault, this->threadNumber); + this->cpu->trap(fault, this->threadNumber, this); } template -- cgit v1.2.3