From 6b7d62790399f3ff675e5d37a25c320aa068897a Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Wed, 1 Mar 2006 19:03:42 -0500 Subject: [PATCH] Got rid of the multiple inheritance in the Fault classes, and the base MachineCheck and Alignment faults. --HG-- extra : convert_revision : 4b1429ef5c7a11c25e28f2bc868cc1481a08c5d1 --- arch/alpha/faults.cc | 10 ++++++---- arch/alpha/faults.hh | 20 ++++++++++++-------- sim/faults.cc | 3 --- sim/faults.hh | 25 ------------------------- 4 files changed, 18 insertions(+), 40 deletions(-) diff --git a/arch/alpha/faults.cc b/arch/alpha/faults.cc index 7cdcc9bab..0a836363c 100644 --- a/arch/alpha/faults.cc +++ b/arch/alpha/faults.cc @@ -35,11 +35,13 @@ namespace AlphaISA { -FaultVect AlphaMachineCheckFault::_vect = 0x0401; -FaultStat AlphaMachineCheckFault::_stat; +FaultName MachineCheckFault::_name = "mchk"; +FaultVect MachineCheckFault::_vect = 0x0401; +FaultStat MachineCheckFault::_stat; -FaultVect AlphaAlignmentFault::_vect = 0x0301; -FaultStat AlphaAlignmentFault::_stat; +FaultName AlignmentFault::_name = "unalign"; +FaultVect AlignmentFault::_vect = 0x0301; +FaultStat AlignmentFault::_stat; FaultName ResetFault::_name = "reset"; FaultVect ResetFault::_vect = 0x0001; diff --git a/arch/alpha/faults.hh b/arch/alpha/faults.hh index b9573905a..c4a72e07c 100644 --- a/arch/alpha/faults.hh +++ b/arch/alpha/faults.hh @@ -50,38 +50,40 @@ class AlphaFault : public virtual FaultBase virtual FaultVect vect() = 0; }; -class AlphaMachineCheckFault : - public MachineCheckFault, - public AlphaFault +class MachineCheckFault : 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;} + bool isMachineCheckFault() {return true;} }; -class AlphaAlignmentFault : - public AlignmentFault, - public AlphaFault +class AlignmentFault : 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;} + bool isAlignmentFault() {return true;} }; static inline Fault genMachineCheckFault() { - return new AlphaMachineCheckFault; + return new MachineCheckFault; } static inline Fault genAlignmentFault() { - return new AlphaAlignmentFault; + return new AlignmentFault; } class ResetFault : public AlphaFault @@ -108,7 +110,9 @@ class ArithmeticFault : public AlphaFault FaultName name() {return _name;} FaultVect vect() {return _vect;} FaultStat & stat() {return _stat;} +#if FULL_SYSTEM void invoke(ExecContext * xc); +#endif }; class InterruptFault : public AlphaFault diff --git a/sim/faults.cc b/sim/faults.cc index 68df2b785..9b4a0ea7f 100644 --- a/sim/faults.cc +++ b/sim/faults.cc @@ -29,9 +29,6 @@ #include "sim/faults.hh" #include "cpu/exec_context.hh" -FaultName MachineCheckFault::_name = "mchk"; -FaultName AlignmentFault::_name = "unalign"; - #if !FULL_SYSTEM void FaultBase::invoke(ExecContext * xc) { diff --git a/sim/faults.hh b/sim/faults.hh index 1e43bfb82..9e8d224cd 100644 --- a/sim/faults.hh +++ b/sim/faults.hh @@ -65,29 +65,4 @@ class FaultBase : public RefCounted FaultBase * const NoFault = 0; -//The ISAs are each responsible for providing a genMachineCheckFault and a -//genAlignmentFault functions, which return faults to use in the case of a -//machine check fault or an alignment fault, respectively. Base classes which -//provide the name() function, and the isMachineCheckFault and isAlignmentFault -//functions are provided below. - -class MachineCheckFault : public virtual FaultBase -{ - private: - static FaultName _name; - public: - FaultName name() {return _name;} - bool isMachineCheckFault() {return true;} -}; - -class AlignmentFault : public virtual FaultBase -{ - private: - static FaultName _name; - public: - FaultName name() {return _name;} - bool isAlignmentFault() {return true;} -}; - - #endif // __FAULTS_HH__ -- 2.30.2