Changes to support automatic renaming of the shadow registers at decode time. This...
[gem5.git] / arch / alpha / faults.hh
index a49a1c4f068d8536c53db2dac9ae858701fc4143..156faa8fbe706d3f78564e09dd12272a0ccb5e1e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2004 The Regents of The University of Michigan
+ * Copyright (c) 2003-2005 The Regents of The University of Michigan
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef __FAULTS_HH__
-#define __FAULTS_HH__
-
-enum Fault {
-    No_Fault,
-    Reset_Fault,               // processor reset
-    Machine_Check_Fault,       // machine check (also internal S/W fault)
-    Arithmetic_Fault,          // FP exception
-    Interrupt_Fault,           // external interrupt
-    Ndtb_Miss_Fault,           // DTB miss
-    Pdtb_Miss_Fault,           // nested DTB miss
-    Alignment_Fault,           // unaligned access
-    DTB_Fault_Fault,           // DTB page fault
-    DTB_Acv_Fault,             // DTB access violation
-    ITB_Miss_Fault,            // ITB miss
-    ITB_Fault_Fault,           // ITB page fault
-    ITB_Acv_Fault,             // ITB access violation
-    Unimplemented_Opcode_Fault,        // invalid/unimplemented instruction
-    Fen_Fault,                 // FP not-enabled fault
-    Pal_Fault,                 // call_pal S/W interrupt
-    Integer_Overflow_Fault,
-    Fake_Mem_Fault,
-    Num_Faults                 // number of faults
-};
-
-const char *
-FaultName(int index);
+#ifndef __ALPHA_FAULTS_HH__
+#define __ALPHA_FAULTS_HH__
+
+#include "sim/faults.hh"
+
+// The design of the "name" and "vect" functions is in sim/faults.hh
+
+namespace AlphaISA
+{
+
+typedef const Addr FaultVect;
+
+class AlphaFault : public virtual FaultBase
+{
+  public:
+#if FULL_SYSTEM
+    void ev5_trap(ExecContext * xc);
+#endif
+    virtual FaultVect vect() = 0;
+};
+
+class AlphaMachineCheckFault :
+    public MachineCheckFault,
+    public AlphaFault
+{
+  private:
+    static FaultVect _vect;
+    static FaultStat _stat;
+  public:
+#if FULL_SYSTEM
+    void ev5_trap(ExecContext * xc);
+#endif
+    FaultVect vect() {return _vect;}
+    FaultStat & stat() {return _stat;}
+};
+
+class AlphaAlignmentFault :
+    public AlignmentFault,
+    public AlphaFault
+{
+  private:
+    static FaultVect _vect;
+    static FaultStat _stat;
+  public:
+#if FULL_SYSTEM
+    void ev5_trap(ExecContext * xc);
+#endif
+    FaultVect vect() {return _vect;}
+    FaultStat & stat() {return _stat;}
+};
+
+static inline Fault genMachineCheckFault()
+{
+    return new AlphaMachineCheckFault;
+}
+
+static inline Fault genAlignmentFault()
+{
+    return new AlphaAlignmentFault;
+}
+
+class ResetFault : public AlphaFault
+{
+  private:
+    static FaultName _name;
+    static FaultVect _vect;
+    static FaultStat _stat;
+  public:
+    FaultName name() {return _name;}
+    FaultVect vect() {return _vect;}
+    FaultStat & stat() {return _stat;}
+};
+
+class ArithmeticFault : public AlphaFault
+{
+  private:
+    static FaultName _name;
+    static FaultVect _vect;
+    static FaultStat _stat;
+  public:
+    FaultName name() {return _name;}
+    FaultVect vect() {return _vect;}
+    FaultStat & stat() {return _stat;}
+};
+
+class InterruptFault : public AlphaFault
+{
+  private:
+    static FaultName _name;
+    static FaultVect _vect;
+    static FaultStat _stat;
+  public:
+    FaultName name() {return _name;}
+    FaultVect vect() {return _vect;}
+    FaultStat & stat() {return _stat;}
+};
+
+class NDtbMissFault : public AlphaFault
+{
+  private:
+    static FaultName _name;
+    static FaultVect _vect;
+    static FaultStat _stat;
+  public:
+    FaultName name() {return _name;}
+    FaultVect vect() {return _vect;}
+    FaultStat & stat() {return _stat;}
+};
+
+class PDtbMissFault : public AlphaFault
+{
+  private:
+    static FaultName _name;
+    static FaultVect _vect;
+    static FaultStat _stat;
+  public:
+    FaultName name() {return _name;}
+    FaultVect vect() {return _vect;}
+    FaultStat & stat() {return _stat;}
+};
+
+class DtbPageFault : public AlphaFault
+{
+  private:
+    static FaultName _name;
+    static FaultVect _vect;
+    static FaultStat _stat;
+  public:
+    FaultName name() {return _name;}
+    FaultVect vect() {return _vect;}
+    FaultStat & stat() {return _stat;}
+};
+
+class DtbAcvFault : public AlphaFault
+{
+  private:
+    static FaultName _name;
+    static FaultVect _vect;
+    static FaultStat _stat;
+  public:
+    FaultName name() {return _name;}
+    FaultVect vect() {return _vect;}
+    FaultStat & stat() {return _stat;}
+};
+
+class ItbMissFault : public AlphaFault
+{
+  private:
+    static FaultName _name;
+    static FaultVect _vect;
+    static FaultStat _stat;
+  public:
+    FaultName name() {return _name;}
+    FaultVect vect() {return _vect;}
+    FaultStat & stat() {return _stat;}
+};
+
+class ItbPageFault : public AlphaFault
+{
+  private:
+    static FaultName _name;
+    static FaultVect _vect;
+    static FaultStat _stat;
+  public:
+    FaultName name() {return _name;}
+    FaultVect vect() {return _vect;}
+    FaultStat & stat() {return _stat;}
+};
+
+class ItbAcvFault : public AlphaFault
+{
+  private:
+    static FaultName _name;
+    static FaultVect _vect;
+    static FaultStat _stat;
+  public:
+    FaultName name() {return _name;}
+    FaultVect vect() {return _vect;}
+    FaultStat & stat() {return _stat;}
+};
+
+class UnimplementedOpcodeFault : public AlphaFault
+{
+  private:
+    static FaultName _name;
+    static FaultVect _vect;
+    static FaultStat _stat;
+  public:
+    FaultName name() {return _name;}
+    FaultVect vect() {return _vect;}
+    FaultStat & stat() {return _stat;}
+};
+
+class FloatEnableFault : public AlphaFault
+{
+  private:
+    static FaultName _name;
+    static FaultVect _vect;
+    static FaultStat _stat;
+  public:
+    FaultName name() {return _name;}
+    FaultVect vect() {return _vect;}
+    FaultStat & stat() {return _stat;}
+};
+
+class PalFault : public AlphaFault
+{
+  private:
+    static FaultName _name;
+    static FaultVect _vect;
+    static FaultStat _stat;
+  public:
+    FaultName name() {return _name;}
+    FaultVect vect() {return _vect;}
+    FaultStat & stat() {return _stat;}
+};
+
+class IntegerOverflowFault : public AlphaFault
+{
+  private:
+    static FaultName _name;
+    static FaultVect _vect;
+    static FaultStat _stat;
+  public:
+    FaultName name() {return _name;}
+    FaultVect vect() {return _vect;}
+    FaultStat & stat() {return _stat;}
+};
+
+} // AlphaISA namespace
 
 #endif // __FAULTS_HH__