faults.hh (9554:406fbcf60223) faults.hh (10417:710ee116eb68)
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;

--- 51 unchanged lines hidden (view full) ---

60 struct FaultVals
61 {
62 const FaultName name;
63 const TrapType trapType;
64 const FaultPriority priority;
65 const PrivilegeLevel nextPrivilegeLevel[NumLevels];
66 FaultStat count;
67 };
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;

--- 51 unchanged lines hidden (view full) ---

60 struct FaultVals
61 {
62 const FaultName name;
63 const TrapType trapType;
64 const FaultPriority priority;
65 const PrivilegeLevel nextPrivilegeLevel[NumLevels];
66 FaultStat count;
67 };
68 void invoke(ThreadContext * tc,
69 StaticInstPtr inst = StaticInst::nullStaticInstPtr);
68 void invoke(ThreadContext * tc, const StaticInstPtr &inst =
69 StaticInst::nullStaticInstPtr);
70 virtual TrapType trapType() = 0;
71 virtual FaultPriority priority() = 0;
72 virtual FaultStat & countStat() = 0;
73 virtual PrivilegeLevel getNextLevel(PrivilegeLevel current) = 0;
74};
75
76template<typename T>
77class SparcFault : public SparcFaultBase

--- 10 unchanged lines hidden (view full) ---

88 getNextLevel(PrivilegeLevel current)
89 {
90 return vals.nextPrivilegeLevel[current];
91 }
92};
93
94class PowerOnReset : public SparcFault<PowerOnReset>
95{
70 virtual TrapType trapType() = 0;
71 virtual FaultPriority priority() = 0;
72 virtual FaultStat & countStat() = 0;
73 virtual PrivilegeLevel getNextLevel(PrivilegeLevel current) = 0;
74};
75
76template<typename T>
77class SparcFault : public SparcFaultBase

--- 10 unchanged lines hidden (view full) ---

88 getNextLevel(PrivilegeLevel current)
89 {
90 return vals.nextPrivilegeLevel[current];
91 }
92};
93
94class PowerOnReset : public SparcFault<PowerOnReset>
95{
96 void invoke(ThreadContext * tc,
97 StaticInstPtr inst = StaticInst::nullStaticInstPtr);
96 void invoke(ThreadContext * tc, const StaticInstPtr &inst =
97 StaticInst::nullStaticInstPtr);
98};
99
100class WatchDogReset : public SparcFault<WatchDogReset> {};
101
102class ExternallyInitiatedReset : public SparcFault<ExternallyInitiatedReset> {};
103
104class SoftwareInitiatedReset : public SparcFault<SoftwareInitiatedReset> {};
105

--- 95 unchanged lines hidden (view full) ---

201{
202 protected:
203 Addr vaddr;
204 public:
205 FastInstructionAccessMMUMiss(Addr addr) : vaddr(addr)
206 {}
207 FastInstructionAccessMMUMiss() : vaddr(0)
208 {}
98};
99
100class WatchDogReset : public SparcFault<WatchDogReset> {};
101
102class ExternallyInitiatedReset : public SparcFault<ExternallyInitiatedReset> {};
103
104class SoftwareInitiatedReset : public SparcFault<SoftwareInitiatedReset> {};
105

--- 95 unchanged lines hidden (view full) ---

201{
202 protected:
203 Addr vaddr;
204 public:
205 FastInstructionAccessMMUMiss(Addr addr) : vaddr(addr)
206 {}
207 FastInstructionAccessMMUMiss() : vaddr(0)
208 {}
209 void invoke(ThreadContext * tc,
210 StaticInstPtr inst = StaticInst::nullStaticInstPtr);
209 void invoke(ThreadContext * tc, const StaticInstPtr &inst =
210 StaticInst::nullStaticInstPtr);
211};
212
213class FastDataAccessMMUMiss : public SparcFault<FastDataAccessMMUMiss>
214{
215 protected:
216 Addr vaddr;
217 public:
218 FastDataAccessMMUMiss(Addr addr) : vaddr(addr)
219 {}
220 FastDataAccessMMUMiss() : vaddr(0)
221 {}
211};
212
213class FastDataAccessMMUMiss : public SparcFault<FastDataAccessMMUMiss>
214{
215 protected:
216 Addr vaddr;
217 public:
218 FastDataAccessMMUMiss(Addr addr) : vaddr(addr)
219 {}
220 FastDataAccessMMUMiss() : vaddr(0)
221 {}
222 void invoke(ThreadContext * tc,
223 StaticInstPtr inst = StaticInst::nullStaticInstPtr);
222 void invoke(ThreadContext * tc, const StaticInstPtr &inst =
223 StaticInst::nullStaticInstPtr);
224};
225
226class FastDataAccessProtection : public SparcFault<FastDataAccessProtection> {};
227
228class InstructionBreakpoint : public SparcFault<InstructionBreakpoint> {};
229
230class CpuMondo : public SparcFault<CpuMondo> {};
231
232class DevMondo : public SparcFault<DevMondo> {};
233
234class ResumableError : public SparcFault<ResumableError> {};
235
236class SpillNNormal : public EnumeratedFault<SpillNNormal>
237{
238 public:
239 SpillNNormal(uint32_t n) : EnumeratedFault<SpillNNormal>(n) {;}
240 // These need to be handled specially to enable spill traps in SE
224};
225
226class FastDataAccessProtection : public SparcFault<FastDataAccessProtection> {};
227
228class InstructionBreakpoint : public SparcFault<InstructionBreakpoint> {};
229
230class CpuMondo : public SparcFault<CpuMondo> {};
231
232class DevMondo : public SparcFault<DevMondo> {};
233
234class ResumableError : public SparcFault<ResumableError> {};
235
236class SpillNNormal : public EnumeratedFault<SpillNNormal>
237{
238 public:
239 SpillNNormal(uint32_t n) : EnumeratedFault<SpillNNormal>(n) {;}
240 // These need to be handled specially to enable spill traps in SE
241 void invoke(ThreadContext * tc,
242 StaticInstPtr inst = StaticInst::nullStaticInstPtr);
241 void invoke(ThreadContext * tc, const StaticInstPtr &inst =
242 StaticInst::nullStaticInstPtr);
243};
244
245class SpillNOther : public EnumeratedFault<SpillNOther>
246{
247 public:
248 SpillNOther(uint32_t n) : EnumeratedFault<SpillNOther>(n)
249 {}
250};
251
252class FillNNormal : public EnumeratedFault<FillNNormal>
253{
254 public:
255 FillNNormal(uint32_t n) : EnumeratedFault<FillNNormal>(n)
256 {}
257 // These need to be handled specially to enable fill traps in SE
243};
244
245class SpillNOther : public EnumeratedFault<SpillNOther>
246{
247 public:
248 SpillNOther(uint32_t n) : EnumeratedFault<SpillNOther>(n)
249 {}
250};
251
252class FillNNormal : public EnumeratedFault<FillNNormal>
253{
254 public:
255 FillNNormal(uint32_t n) : EnumeratedFault<FillNNormal>(n)
256 {}
257 // These need to be handled specially to enable fill traps in SE
258 void invoke(ThreadContext * tc,
259 StaticInstPtr inst = StaticInst::nullStaticInstPtr);
258 void invoke(ThreadContext * tc, const StaticInstPtr &inst =
259 StaticInst::nullStaticInstPtr);
260};
261
262class FillNOther : public EnumeratedFault<FillNOther>
263{
264 public:
265 FillNOther(uint32_t n) : EnumeratedFault<FillNOther>(n)
266 {}
267};
268
269class TrapInstruction : public EnumeratedFault<TrapInstruction>
270{
271 public:
272 TrapInstruction(uint32_t n) : EnumeratedFault<TrapInstruction>(n)
273 {}
274 // In SE, trap instructions are requesting services from the OS.
260};
261
262class FillNOther : public EnumeratedFault<FillNOther>
263{
264 public:
265 FillNOther(uint32_t n) : EnumeratedFault<FillNOther>(n)
266 {}
267};
268
269class TrapInstruction : public EnumeratedFault<TrapInstruction>
270{
271 public:
272 TrapInstruction(uint32_t n) : EnumeratedFault<TrapInstruction>(n)
273 {}
274 // In SE, trap instructions are requesting services from the OS.
275 void invoke(ThreadContext * tc,
276 StaticInstPtr inst = StaticInst::nullStaticInstPtr);
275 void invoke(ThreadContext * tc, const StaticInstPtr &inst =
276 StaticInst::nullStaticInstPtr);
277};
278
279void enterREDState(ThreadContext *tc);
280
281void doREDFault(ThreadContext *tc, TrapType tt);
282
283void doNormalFault(ThreadContext *tc, TrapType tt, bool gotoHpriv);
284
285void getREDVector(MiscReg TT, Addr &PC, Addr &NPC);
286
287void getHyperVector(ThreadContext * tc, Addr &PC, Addr &NPC, MiscReg TT);
288
289void getPrivVector(ThreadContext *tc, Addr &PC, Addr &NPC, MiscReg TT,
290 MiscReg TL);
291
292} // namespace SparcISA
293
294#endif // __SPARC_FAULTS_HH__
277};
278
279void enterREDState(ThreadContext *tc);
280
281void doREDFault(ThreadContext *tc, TrapType tt);
282
283void doNormalFault(ThreadContext *tc, TrapType tt, bool gotoHpriv);
284
285void getREDVector(MiscReg TT, Addr &PC, Addr &NPC);
286
287void getHyperVector(ThreadContext * tc, Addr &PC, Addr &NPC, MiscReg TT);
288
289void getPrivVector(ThreadContext *tc, Addr &PC, Addr &NPC, MiscReg TT,
290 MiscReg TL);
291
292} // namespace SparcISA
293
294#endif // __SPARC_FAULTS_HH__