diff options
author | Gabe Black <gblack@eecs.umich.edu> | 2010-09-13 19:26:03 -0700 |
---|---|---|
committer | Gabe Black <gblack@eecs.umich.edu> | 2010-09-13 19:26:03 -0700 |
commit | 6833ca7eedd351596bb1518620af7465f5172fcd (patch) | |
tree | 4a67b3d591132dab3e8273fc9dfba606a1720e4a /src/sim/faults.hh | |
parent | 2edfcbbaee87c1a28351fc0dcd81d52d0d9102a4 (diff) | |
download | gem5-6833ca7eedd351596bb1518620af7465f5172fcd.tar.xz |
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.
Diffstat (limited to 'src/sim/faults.hh')
-rw-r--r-- | src/sim/faults.hh | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/sim/faults.hh b/src/sim/faults.hh index f2fa30b60..e48928b2c 100644 --- a/src/sim/faults.hh +++ b/src/sim/faults.hh @@ -33,12 +33,13 @@ #define __FAULTS_HH__ #include "base/refcnt.hh" +#include "base/types.hh" +#include "sim/fault.hh" #include "sim/stats.hh" #include "config/full_system.hh" +#include "cpu/static_inst.hh" class ThreadContext; -class FaultBase; -typedef RefCountingPtr<FaultBase> Fault; typedef const char * FaultName; typedef Stats::Scalar FaultStat; @@ -54,7 +55,8 @@ class FaultBase : public RefCounted { public: virtual FaultName name() const = 0; - virtual void invoke(ThreadContext * tc); + virtual void invoke(ThreadContext * tc, + StaticInstPtr inst = StaticInst::nullStaticInstPtr); virtual bool isMachineCheckFault() const {return false;} virtual bool isAlignmentFault() const {return false;} }; @@ -71,7 +73,8 @@ class UnimpFault : public FaultBase { } FaultName name() const {return "Unimplemented simulator feature";} - void invoke(ThreadContext * tc); + void invoke(ThreadContext * tc, + StaticInstPtr inst = StaticInst::nullStaticInstPtr); }; #if !FULL_SYSTEM @@ -82,7 +85,8 @@ class GenericPageTableFault : public FaultBase public: FaultName name() const {return "Generic page table fault";} GenericPageTableFault(Addr va) : vaddr(va) {} - void invoke(ThreadContext * tc); + void invoke(ThreadContext * tc, + StaticInstPtr inst = StaticInst::nullStaticInstPtr); }; class GenericAlignmentFault : public FaultBase @@ -92,7 +96,8 @@ class GenericAlignmentFault : public FaultBase public: FaultName name() const {return "Generic alignment fault";} GenericAlignmentFault(Addr va) : vaddr(va) {} - void invoke(ThreadContext * tc); + void invoke(ThreadContext * tc, + StaticInstPtr inst = StaticInst::nullStaticInstPtr); }; #endif |