faults.hh (3575:295e99015da6) | faults.hh (3576:c5a2b916a9fa) |
---|---|
1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 31 unchanged lines hidden (view full) --- 40{ 41 42typedef uint32_t TrapType; 43typedef uint32_t FaultPriority; 44 45class SparcFaultBase : public FaultBase 46{ 47 public: | 1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 31 unchanged lines hidden (view full) --- 40{ 41 42typedef uint32_t TrapType; 43typedef uint32_t FaultPriority; 44 45class SparcFaultBase : public FaultBase 46{ 47 public: |
48 enum PrivilegeLevel 49 { 50 U, User = U, 51 P, Privileged = P, 52 H, Hyperprivileged = H, 53 NumLevels, 54 SH = -1, 55 ShouldntHappen = SH 56 }; |
|
48 struct FaultVals 49 { 50 const FaultName name; 51 const TrapType trapType; 52 const FaultPriority priority; | 57 struct FaultVals 58 { 59 const FaultName name; 60 const TrapType trapType; 61 const FaultPriority priority; |
62 const PrivilegeLevel nextPrivilegeLevel[NumLevels]; |
|
53 FaultStat count; 54 }; 55#if FULL_SYSTEM 56 void invoke(ThreadContext * tc); 57#endif 58 virtual FaultName name() = 0; 59 virtual TrapType trapType() = 0; 60 virtual FaultPriority priority() = 0; 61 virtual FaultStat & countStat() = 0; | 63 FaultStat count; 64 }; 65#if FULL_SYSTEM 66 void invoke(ThreadContext * tc); 67#endif 68 virtual FaultName name() = 0; 69 virtual TrapType trapType() = 0; 70 virtual FaultPriority priority() = 0; 71 virtual FaultStat & countStat() = 0; |
72 virtual PrivilegeLevel getNextLevel(PrivilegeLevel current) = 0; |
|
62}; 63 64template<typename T> 65class SparcFault : public SparcFaultBase 66{ 67 protected: 68 static FaultVals vals; 69 public: 70 FaultName name() {return vals.name;} 71 TrapType trapType() {return vals.trapType;} 72 FaultPriority priority() {return vals.priority;} 73 FaultStat & countStat() {return vals.count;} | 73}; 74 75template<typename T> 76class SparcFault : public SparcFaultBase 77{ 78 protected: 79 static FaultVals vals; 80 public: 81 FaultName name() {return vals.name;} 82 TrapType trapType() {return vals.trapType;} 83 FaultPriority priority() {return vals.priority;} 84 FaultStat & countStat() {return vals.count;} |
85 PrivilegeLevel getNextLevel(PrivilegeLevel current) 86 { 87 return vals.nextPrivilegeLevel[current]; 88 } |
|
74}; 75 | 89}; 90 |
76class InternalProcessorError : 77 public SparcFault<InternalProcessorError> 78{ 79 public: 80 bool isMachineCheckFault() {return true;} 81}; 82 83class MemAddressNotAligned : 84 public SparcFault<MemAddressNotAligned> 85{ 86 public: 87 bool isAlignmentFault() {return true;} 88}; 89 90#if !FULL_SYSTEM 91class PageTableFault : public SparcFault<PageTableFault> 92{ 93 private: 94 Addr vaddr; 95 public: 96 PageTableFault(Addr va) : vaddr(va) {} 97 void invoke(ThreadContext * tc); 98}; 99 100static inline Fault genPageTableFault(Addr va) 101{ 102 return new PageTableFault(va); 103} 104#endif 105 106static inline Fault genMachineCheckFault() 107{ 108 return new InternalProcessorError; 109} 110 111static inline Fault genAlignmentFault() 112{ 113 return new MemAddressNotAligned; 114} 115 | |
116class PowerOnReset : public SparcFault<PowerOnReset> 117{ 118 void invoke(ThreadContext * tc); 119}; 120 121class WatchDogReset : public SparcFault<WatchDogReset> {}; 122 123class ExternallyInitiatedReset : public SparcFault<ExternallyInitiatedReset> {}; 124 125class SoftwareInitiatedReset : public SparcFault<SoftwareInitiatedReset> {}; 126 127class REDStateException : public SparcFault<REDStateException> {}; 128 | 91class PowerOnReset : public SparcFault<PowerOnReset> 92{ 93 void invoke(ThreadContext * tc); 94}; 95 96class WatchDogReset : public SparcFault<WatchDogReset> {}; 97 98class ExternallyInitiatedReset : public SparcFault<ExternallyInitiatedReset> {}; 99 100class SoftwareInitiatedReset : public SparcFault<SoftwareInitiatedReset> {}; 101 102class REDStateException : public SparcFault<REDStateException> {}; 103 |
104class StoreError : public SparcFault<StoreError> {}; 105 |
|
129class InstructionAccessException : public SparcFault<InstructionAccessException> {}; 130 | 106class InstructionAccessException : public SparcFault<InstructionAccessException> {}; 107 |
131class InstructionAccessMMUMiss : public SparcFault | 108//class InstructionAccessMMUMiss : public SparcFault<InstructionAccessMMUMiss> {}; |
132 133class InstructionAccessError : public SparcFault<InstructionAccessError> {}; 134 135class IllegalInstruction : public SparcFault<IllegalInstruction> {}; 136 137class PrivilegedOpcode : public SparcFault<PrivilegedOpcode> {}; 138 | 109 110class InstructionAccessError : public SparcFault<InstructionAccessError> {}; 111 112class IllegalInstruction : public SparcFault<IllegalInstruction> {}; 113 114class PrivilegedOpcode : public SparcFault<PrivilegedOpcode> {}; 115 |
139class UnimplementedLDD : public SparcFault | 116//class UnimplementedLDD : public SparcFault<UnimplementedLDD> {}; |
140 | 117 |
141class UnimplementedSTD : public SparcFault | 118//class UnimplementedSTD : public SparcFault<UnimplementedSTD> {}; |
142 143class FpDisabled : public SparcFault<FpDisabled> {}; 144 145class FpExceptionIEEE754 : public SparcFault<FpExceptionIEEE754> {}; 146 147class FpExceptionOther : public SparcFault<FpExceptionOther> {}; 148 149class TagOverflow : public SparcFault<TagOverflow> {}; 150 | 119 120class FpDisabled : public SparcFault<FpDisabled> {}; 121 122class FpExceptionIEEE754 : public SparcFault<FpExceptionIEEE754> {}; 123 124class FpExceptionOther : public SparcFault<FpExceptionOther> {}; 125 126class TagOverflow : public SparcFault<TagOverflow> {}; 127 |
128class CleanWindow : public SparcFault<CleanWindow> {}; 129 |
|
151class DivisionByZero : public SparcFault<DivisionByZero> {}; 152 | 130class DivisionByZero : public SparcFault<DivisionByZero> {}; 131 |
132class InternalProcessorError : 133 public SparcFault<InternalProcessorError> 134{ 135 public: 136 bool isMachineCheckFault() {return true;} 137}; 138 139class InstructionInvalidTSBEntry : public SparcFault<InstructionInvalidTSBEntry> {}; 140 141class DataInvalidTSBEntry : public SparcFault<DataInvalidTSBEntry> {}; 142 |
|
153class DataAccessException : public SparcFault<DataAccessException> {}; 154 | 143class DataAccessException : public SparcFault<DataAccessException> {}; 144 |
155class DataAccessMMUMiss : public SparcFault | 145//class DataAccessMMUMiss : public SparcFault<DataAccessMMUMiss> {}; |
156 157class DataAccessError : public SparcFault<DataAccessError> {}; 158 159class DataAccessProtection : public SparcFault<DataAccessProtection> {}; 160 | 146 147class DataAccessError : public SparcFault<DataAccessError> {}; 148 149class DataAccessProtection : public SparcFault<DataAccessProtection> {}; 150 |
151class MemAddressNotAligned : 152 public SparcFault<MemAddressNotAligned> 153{ 154 public: 155 bool isAlignmentFault() {return true;} 156}; 157 |
|
161class LDDFMemAddressNotAligned : public SparcFault<LDDFMemAddressNotAligned> {}; 162 163class STDFMemAddressNotAligned : public SparcFault<STDFMemAddressNotAligned> {}; 164 165class PrivilegedAction : public SparcFault<PrivilegedAction> {}; 166 167class LDQFMemAddressNotAligned : public SparcFault<LDQFMemAddressNotAligned> {}; 168 169class STQFMemAddressNotAligned : public SparcFault<STQFMemAddressNotAligned> {}; 170 | 158class LDDFMemAddressNotAligned : public SparcFault<LDDFMemAddressNotAligned> {}; 159 160class STDFMemAddressNotAligned : public SparcFault<STDFMemAddressNotAligned> {}; 161 162class PrivilegedAction : public SparcFault<PrivilegedAction> {}; 163 164class LDQFMemAddressNotAligned : public SparcFault<LDQFMemAddressNotAligned> {}; 165 166class STQFMemAddressNotAligned : public SparcFault<STQFMemAddressNotAligned> {}; 167 |
171class AsyncDataError : public SparcFault<AsyncDataError> {}; | 168class InstructionRealTranslationMiss : 169 public SparcFault<InstructionRealTranslationMiss> {}; |
172 | 170 |
173class CleanWindow : public SparcFault<CleanWindow> {}; | 171class DataRealTranslationMiss : public SparcFault<DataRealTranslationMiss> {}; |
174 | 172 |
173//class AsyncDataError : public SparcFault<AsyncDataError> {}; 174 |
|
175template <class T> 176class EnumeratedFault : public SparcFault<T> 177{ 178 protected: 179 uint32_t _n; 180 public: 181 EnumeratedFault(uint32_t n) : SparcFault<T>(), _n(n) {} 182 TrapType trapType() {return SparcFault<T>::trapType() + _n;} 183}; 184 185class InterruptLevelN : public EnumeratedFault<InterruptLevelN> 186{ 187 public: | 175template <class T> 176class EnumeratedFault : public SparcFault<T> 177{ 178 protected: 179 uint32_t _n; 180 public: 181 EnumeratedFault(uint32_t n) : SparcFault<T>(), _n(n) {} 182 TrapType trapType() {return SparcFault<T>::trapType() + _n;} 183}; 184 185class InterruptLevelN : public EnumeratedFault<InterruptLevelN> 186{ 187 public: |
188 InterruptLevelN(uint32_t n) : 189 EnumeratedFault<InterruptLevelN>(n) {;} 190 FaultPriority priority() {return 32 - _n;} | 188 InterruptLevelN(uint32_t n) : EnumeratedFault<InterruptLevelN>(n) {;} 189 FaultPriority priority() {return 3200 - _n*100;} |
191}; 192 | 190}; 191 |
192class HstickMatch : public SparcFault<HstickMatch> {}; 193 194class TrapLevelZero : public SparcFault<TrapLevelZero> {}; 195 196class PAWatchpoint : public SparcFault<PAWatchpoint> {}; 197 198class VAWatchpoint : public SparcFault<VAWatchpoint> {}; 199 200class FastInstructionAccessMMUMiss : 201 public SparcFault<FastInstructionAccessMMUMiss> {}; 202 203class FastDataAccessMMUMiss : public SparcFault<FastDataAccessMMUMiss> {}; 204 205class FastDataAccessProtection : public SparcFault<FastDataAccessProtection> {}; 206 207class InstructionBreakpoint : public SparcFault<InstructionBreakpoint> {}; 208 209class CpuMondo : public SparcFault<CpuMondo> {}; 210 211class DevMondo : public SparcFault<DevMondo> {}; 212 213class ResumeableError : public SparcFault<ResumeableError> {}; 214 |
|
193class SpillNNormal : public EnumeratedFault<SpillNNormal> 194{ 195 public: | 215class SpillNNormal : public EnumeratedFault<SpillNNormal> 216{ 217 public: |
196 SpillNNormal(uint32_t n) : 197 EnumeratedFault<SpillNNormal>(n) {;} | 218 SpillNNormal(uint32_t n) : EnumeratedFault<SpillNNormal>(n) {;} |
198 //These need to be handled specially to enable spill traps in SE 199#if !FULL_SYSTEM 200 void invoke(ThreadContext * tc); 201#endif 202}; 203 204class SpillNOther : public EnumeratedFault<SpillNOther> 205{ 206 public: | 219 //These need to be handled specially to enable spill traps in SE 220#if !FULL_SYSTEM 221 void invoke(ThreadContext * tc); 222#endif 223}; 224 225class SpillNOther : public EnumeratedFault<SpillNOther> 226{ 227 public: |
207 SpillNOther(uint32_t n) : 208 EnumeratedFault<SpillNOther>(n) {;} | 228 SpillNOther(uint32_t n) : EnumeratedFault<SpillNOther>(n) {;} |
209}; 210 211class FillNNormal : public EnumeratedFault<FillNNormal> 212{ 213 public: | 229}; 230 231class FillNNormal : public EnumeratedFault<FillNNormal> 232{ 233 public: |
214 FillNNormal(uint32_t n) : 215 EnumeratedFault<FillNNormal>(n) {;} | 234 FillNNormal(uint32_t n) : EnumeratedFault<FillNNormal>(n) {;} |
216 //These need to be handled specially to enable fill traps in SE 217#if !FULL_SYSTEM 218 void invoke(ThreadContext * tc); 219#endif 220}; 221 222class FillNOther : public EnumeratedFault<FillNOther> 223{ 224 public: | 235 //These need to be handled specially to enable fill traps in SE 236#if !FULL_SYSTEM 237 void invoke(ThreadContext * tc); 238#endif 239}; 240 241class FillNOther : public EnumeratedFault<FillNOther> 242{ 243 public: |
225 FillNOther(uint32_t n) : 226 EnumeratedFault<FillNOther>(n) {;} | 244 FillNOther(uint32_t n) : EnumeratedFault<FillNOther>(n) {;} |
227}; 228 229class TrapInstruction : public EnumeratedFault<TrapInstruction> 230{ 231 232 public: | 245}; 246 247class TrapInstruction : public EnumeratedFault<TrapInstruction> 248{ 249 250 public: |
233 TrapInstruction(uint32_t n) : 234 EnumeratedFault<TrapInstruction>(n) {;} | 251 TrapInstruction(uint32_t n) : EnumeratedFault<TrapInstruction>(n) {;} |
235}; 236 | 252}; 253 |
254#if !FULL_SYSTEM 255class PageTableFault : public SparcFault<PageTableFault> 256{ 257 private: 258 Addr vaddr; 259 public: 260 PageTableFault(Addr va) : vaddr(va) {} 261 void invoke(ThreadContext * tc); 262}; |
|
237 | 263 |
264static inline Fault genPageTableFault(Addr va) 265{ 266 return new PageTableFault(va); 267} 268#endif 269 270static inline Fault genMachineCheckFault() 271{ 272 return new InternalProcessorError; 273} 274 275static inline Fault genAlignmentFault() 276{ 277 return new MemAddressNotAligned; 278} 279 280 |
|
238} // SparcISA namespace 239 240#endif // __FAULTS_HH__ | 281} // SparcISA namespace 282 283#endif // __FAULTS_HH__ |