cpu: Use the NotAnInst flag to avoid passing an inst to fetch faults.
authorGabe Black <gabeblack@google.com>
Sat, 6 Jan 2018 00:20:14 +0000 (16:20 -0800)
committerGabe Black <gabeblack@google.com>
Tue, 9 Jan 2018 03:03:12 +0000 (03:03 +0000)
When a fault happens in fetch in O3, a dummy inst is created to carry
the fault through the pipeline to commit, but conceptually there isn't
actually any instruction since we failed to fetch one.

This change marks the dummy instruction as NotAnInst, and when any
such instruction gets to commit, the fault object associated with it
is invoked and passed a null static inst pointer instead of a pointer
to the dummy inst.

Change-Id: I18d993083406deb625402e06af4ba0d4772ca5a3
Reviewed-on: https://gem5-review.googlesource.com/7124
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Gabe Black <gabeblack@google.com>

src/cpu/o3/commit_impl.hh
src/cpu/o3/fetch_impl.hh

index b3a97ad3a307e4f1aa6576318d75cd60be2d5fa8..d32493cbcf18dd5ce955320dbcfca64f7a97e9b4 100644 (file)
@@ -1225,7 +1225,10 @@ DefaultCommit<Impl>::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->staticInst);
+        cpu->trap(inst_fault, tid,
+                  head_inst->notAnInst() ?
+                      StaticInst::nullStaticInstPtr :
+                      head_inst->staticInst);
 
         // Exit state update mode to avoid accidental updating.
         thread[tid]->noSquashFromTC = false;
index 6cca77a8719a7e26503368fc78f6278ae8594206..d8793426be16cfadf3b1ff77c0a3286b9dd98d7d 100644 (file)
@@ -729,6 +729,7 @@ DefaultFetch<Impl>::finishTranslation(const Fault &fault, RequestPtr mem_req)
         // We will use a nop in ordier to carry the fault.
         DynInstPtr instruction = buildInst(tid, StaticInst::nopStaticInstPtr,
                                            NULL, fetchPC, fetchPC, false);
+        instruction->setNotAnInst();
 
         instruction->setPredTarg(fetchPC);
         instruction->fault = fault;