Changed ev5_trap from a function of the execution context to a function of the fault...
authorGabe Black <gblack@eecs.umich.edu>
Tue, 28 Feb 2006 04:26:13 +0000 (23:26 -0500)
committerGabe Black <gblack@eecs.umich.edu>
Tue, 28 Feb 2006 04:26:13 +0000 (23:26 -0500)
--HG--
extra : convert_revision : 56e33536cdd9079ace03896b85ea3c84b6eb4e57

arch/alpha/ev5.cc
arch/alpha/faults.cc
arch/alpha/faults.hh
cpu/exec_context.cc
cpu/exec_context.hh
cpu/simple/cpu.cc
cpu/simple/cpu.hh
sim/faults.hh

index 349c2930f7dd66154c4a13250bae20513dbcea00..23546bbe2582635777babe0bb894b962ef02df7c 100644 (file)
@@ -166,7 +166,7 @@ AlphaISA::zeroRegisters(CPU *cpu)
 }
 
 void
-ExecContext::ev5_trap(Fault fault)
+ExecContext::ev5_temp_trap(Fault fault)
 {
     DPRINTF(Fault, "Fault %s at PC: %#x\n", fault->name(), regs.pc);
     cpu->recordEvent(csprintf("Fault %s", fault->name()));
index 99365f8d2ea4f2031bd3884e48e1552bb2662d19..2eedfedbd35ea67b225172c2633ed255ce590e24 100644 (file)
@@ -27,6 +27,7 @@
  */
 
 #include "arch/alpha/faults.hh"
+#include "cpu/exec_context.hh"
 
 namespace AlphaISA
 {
@@ -97,6 +98,25 @@ FaultName IntegerOverflowFault::_name = "intover";
 FaultVect IntegerOverflowFault::_vect = 0x0501;
 FaultStat IntegerOverflowFault::_stat;
 
+#if FULL_SYSTEM
+
+void AlphaFault::ev5_trap(ExecContext * xc)
+{
+    xc->ev5_temp_trap(this);
+}
+
+void AlphaMachineCheckFault::ev5_trap(ExecContext * xc)
+{
+    xc->ev5_temp_trap(this);
+}
+
+void AlphaAlignmentFault::ev5_trap(ExecContext * xc)
+{
+    xc->ev5_temp_trap(this);
+}
+
+#endif
+
 } // namespace AlphaISA
 
 /*Fault * ListOfFaults[] = {
index f8cb44017f74629083973c90d722e93cfe1cf81f..7c52738c13b72aada4174588aec95b551a296edb 100644 (file)
@@ -45,6 +45,9 @@ class AlphaFault : public FaultBase
     static FaultVect _vect;
     static FaultStat _stat;
   public:
+#if FULL_SYSTEM
+    void ev5_trap(ExecContext * xc);
+#endif
     FaultName name() {return _name;}
     virtual FaultVect vect() {return _vect;}
     virtual FaultStat & stat() {return _stat;}
@@ -56,6 +59,9 @@ class AlphaMachineCheckFault : public MachineCheckFault
     static FaultVect _vect;
     static FaultStat _stat;
   public:
+#if FULL_SYSTEM
+    void ev5_trap(ExecContext * xc);
+#endif
     FaultVect vect() {return _vect;}
     FaultStat & stat() {return _stat;}
 };
@@ -66,6 +72,9 @@ class AlphaAlignmentFault : public AlignmentFault
     static FaultVect _vect;
     static FaultStat _stat;
   public:
+#if FULL_SYSTEM
+    void ev5_trap(ExecContext * xc);
+#endif
     FaultVect vect() {return _vect;}
     FaultStat & stat() {return _stat;}
 };
index cf0ced7b052d660eebaa5c26e50bca6f317e3d45..7e8b81e1828fd3115e4c437f5b11987f83321eec 100644 (file)
@@ -227,7 +227,7 @@ ExecContext::trap(Fault fault)
 
     /** @todo: Going to hack it for now.  Do a true fixup later. */
 #if FULL_SYSTEM
-    ev5_trap(fault);
+    fault->ev5_trap(this);
 #else
     fatal("fault (%d) detected @ PC 0x%08p", fault, readPC());
 #endif
index 834eacec8d4960c3c04d30cd2a24bb74a0ef4811..e23370d0b8a5ac05db4d19ce649c74c529d6d9a1 100644 (file)
@@ -425,7 +425,7 @@ class ExecContext
     void setIntrFlag(int val) { regs.intrflag = val; }
     Fault hwrei();
     bool inPalMode() { return AlphaISA::PcPAL(regs.pc); }
-    void ev5_trap(Fault fault);
+    void ev5_temp_trap(Fault fault);
     bool simPalCheck(int palFunc);
 #endif
 
index 4b0eda3869ef0ddfc420caf823698e7f3a9485b0..1f362876f7cc49307899d001381031b47ce0d187 100644 (file)
@@ -688,7 +688,7 @@ SimpleCPU::tick()
         if (ipl && ipl > xc->regs.ipr[IPR_IPLR]) {
             ipr[IPR_ISR] = summary;
             ipr[IPR_INTID] = ipl;
-            xc->ev5_trap(new InterruptFault);
+            (new InterruptFault)->ev5_trap(xc);
 
             DPRINTF(Flow, "Interrupt! IPLR=%d ipl=%d summary=%x\n",
                     ipr[IPR_IPLR], ipl, summary);
@@ -812,7 +812,7 @@ SimpleCPU::tick()
 
     if (fault != NoFault) {
 #if FULL_SYSTEM
-        xc->ev5_trap(fault);
+        fault->ev5_trap(xc);
 #else // !FULL_SYSTEM
         fatal("fault (%d) detected @ PC 0x%08p", fault, xc->regs.pc);
 #endif // FULL_SYSTEM
index ed7b1e29b91dccfa6ecb43431f14f82ab2415221..c58b3c5ba22c7efc20c7057d49eec175013a5e3d 100644 (file)
@@ -334,7 +334,7 @@ class SimpleCPU : public BaseCPU
     int readIntrFlag() { return xc->readIntrFlag(); }
     void setIntrFlag(int val) { xc->setIntrFlag(val); }
     bool inPalMode() { return xc->inPalMode(); }
-    void ev5_trap(Fault fault) { xc->ev5_trap(fault); }
+    void ev5_trap(Fault fault) { fault->ev5_trap(xc); }
     bool simPalCheck(int palFunc) { return xc->simPalCheck(palFunc); }
 #else
     void syscall() { xc->syscall(); }
index d0bf78815ac0ecb5b106d22cad18004ff08f0753..69e592485ef0e4db65b7753dc1a17a15e03c8930 100644 (file)
@@ -31,7 +31,9 @@
 
 #include "base/refcnt.hh"
 #include "sim/stats.hh"
+#include "config/full_system.hh"
 
+class ExecContext;
 class FaultBase;
 typedef RefCountingPtr<FaultBase> Fault;
 
@@ -53,6 +55,9 @@ class FaultBase : public RefCounted
         return "none";
     }
     virtual FaultStat & stat() = 0;
+#if FULL_SYSTEM
+    virtual void ev5_trap(ExecContext * xc) = 0;
+#endif
     template<typename T>
     bool isA() {return dynamic_cast<T *>(this);}
     virtual bool isMachineCheckFault() {return false;}