From ab8d7eee76e9d439070fe116fb23e0afe7aa74c3 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 20 Sep 2010 02:46:42 -0700 Subject: [PATCH] CPU: Fix O3 and possible InOrder segfaults in FS. --- src/cpu/inorder/cpu.cc | 4 +++- 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 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/cpu/inorder/cpu.cc b/src/cpu/inorder/cpu.cc index 5d4d3c580..5d42ba559 100644 --- a/src/cpu/inorder/cpu.cc +++ b/src/cpu/inorder/cpu.cc @@ -633,7 +633,9 @@ InOrderCPU::processInterrupts(Fault interrupt) this->interrupts->updateIntrInfo(this->threadContexts[0]); DPRINTF(InOrderCPU, "Interrupt %s being handled\n", interrupt->name()); - this->trap(interrupt, 0); + static StaticInstPtr dummyStatic(TheISA::NoopMachInst, 0); + static DynInstPtr dummyDyn = new Impl::DynInst(dummyStatic); + this->trap(interrupt, dummyDyn); } diff --git a/src/cpu/o3/commit_impl.hh b/src/cpu/o3/commit_impl.hh index 87f18d4e4..98c7b49c8 100644 --- a/src/cpu/o3/commit_impl.hh +++ b/src/cpu/o3/commit_impl.hh @@ -1062,7 +1062,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, head_inst); + cpu->trap(inst_fault, tid, head_inst->staticInst); // 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 7eea04ce6..8e9f3ef5d 100644 --- a/src/cpu/o3/cpu.cc +++ b/src/cpu/o3/cpu.cc @@ -926,8 +926,7 @@ FullO3CPU::processInterrupts(Fault interrupt) this->interrupts->updateIntrInfo(this->threadContexts[0]); DPRINTF(O3CPU, "Interrupt %s being handled\n", interrupt->name()); - DynInstPtr dummyInst; - this->trap(interrupt, 0, dummyInst); + this->trap(interrupt, 0, NULL); } template @@ -944,10 +943,10 @@ FullO3CPU::updateMemPorts() template void -FullO3CPU::trap(Fault fault, ThreadID tid, DynInstPtr inst) +FullO3CPU::trap(Fault fault, ThreadID tid, StaticInstPtr inst) { // Pass the thread's TC into the invoke method. - fault->invoke(this->threadContexts[tid], inst->staticInst); + fault->invoke(this->threadContexts[tid], inst); } #if !FULL_SYSTEM diff --git a/src/cpu/o3/cpu.hh b/src/cpu/o3/cpu.hh index e7368993b..57c07a9ec 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, DynInstPtr inst); + void trap(Fault fault, ThreadID tid, StaticInstPtr 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 9406e2be0..3e015d962 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); + this->cpu->trap(fault, this->threadNumber, this->staticInst); } template -- 2.30.2