From 9955ebd03c987077adf577c6d0b0b3a1667bade5 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sun, 14 May 2006 23:53:29 -0400 Subject: [PATCH] Moved the UnimpFault to be global --HG-- extra : convert_revision : a42224c70c475c1559e83b8a2ef71ff3b792a3ab --- arch/alpha/faults.cc | 10 ---------- arch/alpha/faults.hh | 20 -------------------- arch/mips/faults.cc | 10 ---------- arch/mips/faults.hh | 20 -------------------- arch/sparc/faults.cc | 14 ++++++-------- arch/sparc/faults.hh | 26 ++++---------------------- sim/faults.cc | 5 +++++ sim/faults.hh | 13 +++++++++++++ 8 files changed, 28 insertions(+), 90 deletions(-) diff --git a/arch/alpha/faults.cc b/arch/alpha/faults.cc index c8cb9124e..0083aa9f3 100644 --- a/arch/alpha/faults.cc +++ b/arch/alpha/faults.cc @@ -105,10 +105,6 @@ FaultName IntegerOverflowFault::_name = "intover"; FaultVect IntegerOverflowFault::_vect = 0x0501; FaultStat IntegerOverflowFault::_count; -FaultName UnimpFault::_name = "Unimplemented Simulator feature"; -FaultVect UnimpFault::_vect = 0x0001; -FaultStat UnimpFault::_count; - #if FULL_SYSTEM void AlphaFault::invoke(ExecContext * xc) @@ -174,12 +170,6 @@ void ItbFault::invoke(ExecContext * xc) AlphaFault::invoke(xc); } -void UnimpFault::invoke(ExecContext * xc) -{ - FaultBase::invoke(xc); - panic("Unimpfault: %s\n", panicStr.c_str()); -} - #endif } // namespace AlphaISA diff --git a/arch/alpha/faults.hh b/arch/alpha/faults.hh index 5024c124b..e8ccc6b79 100644 --- a/arch/alpha/faults.hh +++ b/arch/alpha/faults.hh @@ -347,26 +347,6 @@ class IntegerOverflowFault : public AlphaFault FaultStat & countStat() {return _count;} }; -class UnimpFault : public AlphaFault -{ - private: - std::string panicStr; - static FaultName _name; - static FaultVect _vect; - static FaultStat _count; - public: - UnimpFault(std::string _str) - : panicStr(_str) - { } - - FaultName name() {return _name;} - FaultVect vect() {return _vect;} - FaultStat & countStat() {return _count;} -#if FULL_SYSTEM - void invoke(ExecContext * xc); -#endif -}; - } // AlphaISA namespace #endif // __FAULTS_HH__ diff --git a/arch/mips/faults.cc b/arch/mips/faults.cc index a31856f07..1b31dfa69 100644 --- a/arch/mips/faults.cc +++ b/arch/mips/faults.cc @@ -98,10 +98,6 @@ FaultName IntegerOverflowFault::_name = "intover"; FaultVect IntegerOverflowFault::_vect = 0x0501; FaultStat IntegerOverflowFault::_count; -FaultName UnimpFault::_name = "Unimplemented Simulator feature"; -FaultVect UnimpFault::_vect = 0x0001; -FaultStat UnimpFault::_count; - #if FULL_SYSTEM void MipsFault::invoke(ExecContext * xc) @@ -129,12 +125,6 @@ void ArithmeticFault::invoke(ExecContext * xc) panic("Arithmetic traps are unimplemented!"); } -void UnimpFault::invoke(ExecContext * xc) -{ - FaultBase::invoke(xc); - panic("Unimpfault: %s\n", panicStr.c_str()); -} - #endif } // namespace MipsISA diff --git a/arch/mips/faults.hh b/arch/mips/faults.hh index b0d228090..0bdabe29e 100644 --- a/arch/mips/faults.hh +++ b/arch/mips/faults.hh @@ -264,26 +264,6 @@ class IntegerOverflowFault : public MipsFault FaultStat & countStat() {return _count;} }; -class UnimpFault : public MipsFault -{ - private: - std::string panicStr; - static FaultName _name; - static FaultVect _vect; - static FaultStat _count; - public: - UnimpFault(std::string _str) - : panicStr(_str) - { } - - FaultName name() {return _name;} - FaultVect vect() {return _vect;} - FaultStat & countStat() {return _count;} -#if FULL_SYSTEM - void invoke(ExecContext * xc); -#endif -}; - } // MipsISA namespace #endif // __FAULTS_HH__ diff --git a/arch/sparc/faults.cc b/arch/sparc/faults.cc index e83bba800..67a89ab0e 100644 --- a/arch/sparc/faults.cc +++ b/arch/sparc/faults.cc @@ -215,11 +215,6 @@ TrapType TrapInstruction::_baseTrapType = 0x100; FaultPriority TrapInstruction::_priority = 16; FaultStat TrapInstruction::_count; -FaultName UnimpFault::_name = "Unimplemented Simulator feature"; -TrapType UnimpFault::_trapType = 0x000; -FaultPriority UnimpFault::_priority = 0; -FaultStat UnimpFault::_count; - #if FULL_SYSTEM void SparcFault::invoke(ExecContext * xc) @@ -245,12 +240,15 @@ void SparcFault::invoke(ExecContext * xc) xc->regs.npc = xc->regs.pc + sizeof(MachInst);*/ } -void UnimpFault::invoke(ExecContext * xc) +#endif + +#if !FULL_SYSTEM + +void TrapInstruction::invoke(ExecContext * xc) { - panic("Unimpfault: %s\n", panicStr.c_str()); + xc->syscall(syscall_num); } - #endif } // namespace SparcISA diff --git a/arch/sparc/faults.hh b/arch/sparc/faults.hh index 87de8daaa..e8fb8dfc5 100644 --- a/arch/sparc/faults.hh +++ b/arch/sparc/faults.hh @@ -573,37 +573,19 @@ class TrapInstruction : public EnumeratedFault static TrapType _baseTrapType; static FaultPriority _priority; static FaultStat _count; + uint64_t syscall_num; TrapType baseTrapType() {return _baseTrapType;} public: - TrapInstruction(uint32_t n) : EnumeratedFault(n) {;} + TrapInstruction(uint32_t n, uint64_t syscall) : + EnumeratedFault(n), syscall_num(syscall) {;} FaultName name() {return _name;} FaultPriority priority() {return _priority;} FaultStat & countStat() {return _count;} -}; - -class UnimpFault : public SparcFault -{ - private: - static FaultName _name; - static TrapType _trapType; - static FaultPriority _priority; - static FaultStat _count; - std::string panicStr; - public: - UnimpFault(std::string _str) - : panicStr(_str) - { } - - FaultName name() {return _name;} - TrapType trapType() {return _trapType;} - FaultPriority priority() {return _priority;} - FaultStat & countStat() {return _count;} -#if FULL_SYSTEM +#if !FULL_SYSTEM void invoke(ExecContext * xc); #endif }; - } // SparcISA namespace #endif // __FAULTS_HH__ diff --git a/sim/faults.cc b/sim/faults.cc index f7e9a0691..cb095f852 100644 --- a/sim/faults.cc +++ b/sim/faults.cc @@ -45,3 +45,8 @@ void FaultBase::invoke(ExecContext * xc) assert(!xc->misspeculating()); } #endif + +void UnimpFault::invoke(ExecContext * xc) +{ + panic("Unimpfault: %s\n", panicStr.c_str()); +} diff --git a/sim/faults.hh b/sim/faults.hh index 18601e8f1..9b3bc9103 100644 --- a/sim/faults.hh +++ b/sim/faults.hh @@ -64,4 +64,17 @@ class FaultBase : public RefCounted FaultBase * const NoFault = 0; +class UnimpFault : public FaultBase +{ + private: + std::string panicStr; + public: + UnimpFault(std::string _str) + : panicStr(_str) + { } + + FaultName name() {return "Unimplemented simulator feature";} + void invoke(ExecContext * xc); +}; + #endif // __FAULTS_HH__ -- 2.30.2