From: Kevin Lim Date: Thu, 16 Feb 2006 19:55:15 +0000 (-0500) Subject: Remove fake fault. X-Git-Tag: m5_2.0_beta1~87^2~89^2~6 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d6a330ebb949b6cd63195d44e5a4304e2fd3378e;p=gem5.git Remove fake fault. Switch fault pointers to const pointers to prevent them from accidentally being changed. Fix some coding style. arch/alpha/ev5.cc: cpu/o3/commit_impl.hh: kern/kernel_stats.hh: Remove fake fault. arch/alpha/faults.cc: Remove fake fault, fix to have normal m5 line length limit, and change pointers to be const pointers so that the default faults aren't changed accidentally. arch/alpha/faults.hh: Fix to have normal m5 line length limit, change pointers to const pointers. sim/faults.cc: sim/faults.hh: Remove fake fault, change pointers to const pointers. --HG-- extra : convert_revision : 01d4600e0d4bdc1d177b32edebc78f86a1bbfe2e --- diff --git a/arch/alpha/ev5.cc b/arch/alpha/ev5.cc index a48609729..72f48bfb2 100644 --- a/arch/alpha/ev5.cc +++ b/arch/alpha/ev5.cc @@ -91,7 +91,6 @@ AlphaISA::fault_addr(Fault * fault) if(fault == NoFault) return 0x0000; else if(fault == MachineCheckFault) return 0x0401; else if(fault == AlignmentFault) return 0x0301; - else if(fault == FakeMemFault) return 0x0000; //Deal with the alpha specific faults return ((AlphaFault*)fault)->vect; }; diff --git a/arch/alpha/faults.cc b/arch/alpha/faults.cc index 2dc3d9cbb..e05b3fe59 100644 --- a/arch/alpha/faults.cc +++ b/arch/alpha/faults.cc @@ -28,20 +28,34 @@ #include "arch/alpha/faults.hh" -ResetFaultType * ResetFault = new ResetFaultType("reset", 1, 0x0001); -ArithmeticFaultType * ArithmeticFault = new ArithmeticFaultType("arith", 3, 0x0501); -InterruptFaultType * InterruptFault = new InterruptFaultType("interrupt", 4, 0x0101); -NDtbMissFaultType * NDtbMissFault = new NDtbMissFaultType("dtb_miss_single", 5, 0x0201); -PDtbMissFaultType * PDtbMissFault = new PDtbMissFaultType("dtb_miss_double", 6, 0x0281); -DtbPageFaultType * DtbPageFault = new DtbPageFaultType("dfault", 8, 0x0381); -DtbAcvFaultType * DtbAcvFault = new DtbAcvFaultType("dfault", 9, 0x0381); -ItbMissFaultType * ItbMissFault = new ItbMissFaultType("itbmiss", 10, 0x0181); -ItbPageFaultType * ItbPageFault = new ItbPageFaultType("itbmiss", 11, 0x0181); -ItbAcvFaultType * ItbAcvFault = new ItbAcvFaultType("iaccvio", 12, 0x0081); -UnimplementedOpcodeFaultType * UnimplementedOpcodeFault = new UnimplementedOpcodeFaultType("opdec", 13, 0x0481); -FloatEnableFaultType * FloatEnableFault = new FloatEnableFaultType("fen", 14, 0x0581); -PalFaultType * PalFault = new PalFaultType("pal", 15, 0x2001); -IntegerOverflowFaultType * IntegerOverflowFault = new IntegerOverflowFaultType("intover", 16, 0x0501); +ResetFaultType * const ResetFault = + new ResetFaultType("reset", 1, 0x0001); +ArithmeticFaultType * const ArithmeticFault = + new ArithmeticFaultType("arith", 3, 0x0501); +InterruptFaultType * const InterruptFault = + new InterruptFaultType("interrupt", 4, 0x0101); +NDtbMissFaultType * const NDtbMissFault = + new NDtbMissFaultType("dtb_miss_single", 5, 0x0201); +PDtbMissFaultType * const PDtbMissFault = + new PDtbMissFaultType("dtb_miss_double", 6, 0x0281); +DtbPageFaultType * const DtbPageFault = + new DtbPageFaultType("dfault", 8, 0x0381); +DtbAcvFaultType * const DtbAcvFault = + new DtbAcvFaultType("dfault", 9, 0x0381); +ItbMissFaultType * const ItbMissFault = + new ItbMissFaultType("itbmiss", 10, 0x0181); +ItbPageFaultType * const ItbPageFault = + new ItbPageFaultType("itbmiss", 11, 0x0181); +ItbAcvFaultType * const ItbAcvFault = + new ItbAcvFaultType("iaccvio", 12, 0x0081); +UnimplementedOpcodeFaultType * const UnimplementedOpcodeFault = + new UnimplementedOpcodeFaultType("opdec", 13, 0x0481); +FloatEnableFaultType * const FloatEnableFault = + new FloatEnableFaultType("fen", 14, 0x0581); +PalFaultType * const PalFault = + new PalFaultType("pal", 15, 0x2001); +IntegerOverflowFaultType * const IntegerOverflowFault = + new IntegerOverflowFaultType("intover", 16, 0x0501); Fault ** ListOfFaults[] = { (Fault **)&NoFault, @@ -61,7 +75,6 @@ Fault ** ListOfFaults[] = { (Fault **)&FloatEnableFault, (Fault **)&PalFault, (Fault **)&IntegerOverflowFault, - (Fault **)&FakeMemFault }; int NumFaults = sizeof(ListOfFaults) / sizeof(Fault **); diff --git a/arch/alpha/faults.hh b/arch/alpha/faults.hh index 2bb929a1e..06605861a 100644 --- a/arch/alpha/faults.hh +++ b/arch/alpha/faults.hh @@ -34,94 +34,125 @@ class AlphaFault : public Fault { -public: - AlphaFault(char * newName, int newId, Addr newVect) : Fault(newName, newId), vect(newVect) {;} - TheISA::Addr vect; + public: + AlphaFault(char * newName, int newId, Addr newVect) + : Fault(newName, newId), vect(newVect) + {;} + + TheISA::Addr vect; }; extern class ResetFaultType : public AlphaFault { -public: - ResetFaultType(char * newName, int newId, Addr newVect) : AlphaFault(newName, newId, newVect) {;} -} * ResetFault; + public: + ResetFaultType(char * newName, int newId, Addr newVect) + : AlphaFault(newName, newId, newVect) + {;} +} * const ResetFault; extern class ArithmeticFaultType : public AlphaFault { -public: - ArithmeticFaultType(char * newName, int newId, Addr newVect) : AlphaFault(newName, newId, newVect) {;} -} * ArithmeticFault; + public: + ArithmeticFaultType(char * newName, int newId, Addr newVect) + : AlphaFault(newName, newId, newVect) + {;} +} * const ArithmeticFault; extern class InterruptFaultType : public AlphaFault { -public: - InterruptFaultType(char * newName, int newId, Addr newVect) : AlphaFault(newName, newId, newVect) {;} -} * InterruptFault; + public: + InterruptFaultType(char * newName, int newId, Addr newVect) + : AlphaFault(newName, newId, newVect) + {;} +} * const InterruptFault; extern class NDtbMissFaultType : public AlphaFault { -public: - NDtbMissFaultType(char * newName, int newId, Addr newVect) : AlphaFault(newName, newId, newVect) {;} -} * NDtbMissFault; + public: + NDtbMissFaultType(char * newName, int newId, Addr newVect) + : AlphaFault(newName, newId, newVect) + {;} +} * const NDtbMissFault; extern class PDtbMissFaultType : public AlphaFault { -public: - PDtbMissFaultType(char * newName, int newId, Addr newVect) : AlphaFault(newName, newId, newVect) {;} -} * PDtbMissFault; + public: + PDtbMissFaultType(char * newName, int newId, Addr newVect) + : AlphaFault(newName, newId, newVect) + {;} +} * const PDtbMissFault; extern class DtbPageFaultType : public AlphaFault { -public: - DtbPageFaultType(char * newName, int newId, Addr newVect) : AlphaFault(newName, newId, newVect) {;} -} * DtbPageFault; + public: + DtbPageFaultType(char * newName, int newId, Addr newVect) + : AlphaFault(newName, newId, newVect) + {;} +} * const DtbPageFault; extern class DtbAcvFaultType : public AlphaFault { -public: - DtbAcvFaultType(char * newName, int newId, Addr newVect) : AlphaFault(newName, newId, newVect) {;} -} * DtbAcvFault; + public: + DtbAcvFaultType(char * newName, int newId, Addr newVect) + : AlphaFault(newName, newId, newVect) + {;} +} * const DtbAcvFault; extern class ItbMissFaultType : public AlphaFault { -public: - ItbMissFaultType(char * newName, int newId, Addr newVect) : AlphaFault(newName, newId, newVect) {;} -} * ItbMissFault; + public: + ItbMissFaultType(char * newName, int newId, Addr newVect) + : AlphaFault(newName, newId, newVect) + {;} +} * const ItbMissFault; extern class ItbPageFaultType : public AlphaFault { -public: - ItbPageFaultType(char * newName, int newId, Addr newVect) : AlphaFault(newName, newId, newVect) {;} -} * ItbPageFault; + public: + ItbPageFaultType(char * newName, int newId, Addr newVect) + : AlphaFault(newName, newId, newVect) + {;} +} * const ItbPageFault; extern class ItbAcvFaultType : public AlphaFault { -public: - ItbAcvFaultType(char * newName, int newId, Addr newVect) : AlphaFault(newName, newId, newVect) {;} -} * ItbAcvFault; + public: + ItbAcvFaultType(char * newName, int newId, Addr newVect) + : AlphaFault(newName, newId, newVect) + {;} +} * const ItbAcvFault; extern class UnimplementedOpcodeFaultType : public AlphaFault { -public: - UnimplementedOpcodeFaultType(char * newName, int newId, Addr newVect) : AlphaFault(newName, newId, newVect) {;} -} * UnimplementedOpcodeFault; + public: + UnimplementedOpcodeFaultType(char * newName, int newId, Addr newVect) + : AlphaFault(newName, newId, newVect) + {;} +} * const UnimplementedOpcodeFault; extern class FloatEnableFaultType : public AlphaFault { -public: - FloatEnableFaultType(char * newName, int newId, Addr newVect) : AlphaFault(newName, newId, newVect) {;} -} * FloatEnableFault; + public: + FloatEnableFaultType(char * newName, int newId, Addr newVect) + : AlphaFault(newName, newId, newVect) + {;} +} * const FloatEnableFault; extern class PalFaultType : public AlphaFault { -public: - PalFaultType(char * newName, int newId, Addr newVect) : AlphaFault(newName, newId, newVect) {;} -} * PalFault; + public: + PalFaultType(char * newName, int newId, Addr newVect) + : AlphaFault(newName, newId, newVect) + {;} +} * const PalFault; extern class IntegerOverflowFaultType : public AlphaFault { -public: - IntegerOverflowFaultType(char * newName, int newId, Addr newVect) : AlphaFault(newName, newId, newVect) {;} -} * IntegerOverflowFault; + public: + IntegerOverflowFaultType(char * newName, int newId, Addr newVect) + : AlphaFault(newName, newId, newVect) + {;} +} * const IntegerOverflowFault; extern Fault ** ListOfFaults[]; extern int NumFaults; diff --git a/cpu/o3/commit_impl.hh b/cpu/o3/commit_impl.hh index 540f16b78..47b4dfd00 100644 --- a/cpu/o3/commit_impl.hh +++ b/cpu/o3/commit_impl.hh @@ -395,7 +395,7 @@ SimpleCommit::commitHead(DynInstPtr &head_inst, unsigned inst_num) // Check if the instruction caused a fault. If so, trap. Fault * inst_fault = head_inst->getFault(); - if (inst_fault != NoFault && inst_fault != FakeMemFault) { + if (inst_fault != NoFault) { if (!head_inst->isNop()) { #if FULL_SYSTEM cpu->trap(inst_fault); diff --git a/kern/kernel_stats.hh b/kern/kernel_stats.hh index 98cc044ac..a36c73fb4 100644 --- a/kern/kernel_stats.hh +++ b/kern/kernel_stats.hh @@ -181,7 +181,6 @@ class Statistics : public Serializable if(fault == NoFault) _faults[0]++; else if(fault == MachineCheckFault) _faults[2]++; else if(fault == AlignmentFault) _faults[7]++; - else if(fault == FakeMemFault) _faults[17]++; else _faults[fault->id]++; }// FIXME: When there are no generic system fault objects, this will go back to _faults[fault]++; } void swpipl(int ipl); diff --git a/sim/faults.cc b/sim/faults.cc index 640f439c4..58a631263 100644 --- a/sim/faults.cc +++ b/sim/faults.cc @@ -28,9 +28,9 @@ #include "sim/faults.hh" -NoFaultType * NoFault = new NoFaultType("none"); -MachineCheckFaultType * MachineCheckFault = new MachineCheckFaultType("mchk"); -AlignmentFaultType * AlignmentFault = new AlignmentFaultType("unalign"); -//This needs to not exist -FakeMemFaultType * FakeMemFault = new FakeMemFaultType("fakemem"); +NoFaultType * const NoFault = new NoFaultType("none"); +MachineCheckFaultType * const MachineCheckFault = + new MachineCheckFaultType("mchk"); +AlignmentFaultType * const AlignmentFault = + new AlignmentFaultType("unalign"); diff --git a/sim/faults.hh b/sim/faults.hh index bc2c35c64..d9c742b90 100644 --- a/sim/faults.hh +++ b/sim/faults.hh @@ -41,25 +41,19 @@ extern class NoFaultType : public Fault { public: NoFaultType(char * newName) : Fault(newName) {;} -} * NoFault; +} * const NoFault; extern class MachineCheckFaultType : public Fault { public: MachineCheckFaultType(char * newName) : Fault(newName) {;} -} * MachineCheckFault; +} * const MachineCheckFault; extern class AlignmentFaultType : public Fault { public: AlignmentFaultType(char * newName) : Fault(newName) {;} -} * AlignmentFault; - -extern class FakeMemFaultType : public Fault -{ -public: - FakeMemFaultType(char * newName) : Fault(newName) {;} -} * FakeMemFault; +} * const AlignmentFault; #endif // __FAULTS_HH__