2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
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;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #ifndef __ALPHA_FAULTS_HH__
33 #define __ALPHA_FAULTS_HH__
35 #include "config/full_system.hh"
36 #include "sim/faults.hh"
39 #include "arch/alpha/pagetable.hh"
42 // The design of the "name" and "vect" functions is in sim/faults.hh
47 typedef const Addr FaultVect;
49 class AlphaFault : public FaultBase
52 virtual bool skipFaultingInstruction() {return false;}
53 virtual bool setRestartAddress() {return true;}
56 void invoke(ThreadContext * tc);
58 virtual FaultVect vect() = 0;
59 virtual FaultStat & countStat() = 0;
62 class MachineCheckFault : public AlphaFault
65 static FaultName _name;
66 static FaultVect _vect;
67 static FaultStat _count;
69 FaultName name() {return _name;}
70 FaultVect vect() {return _vect;}
71 FaultStat & countStat() {return _count;}
72 bool isMachineCheckFault() {return true;}
75 class AlignmentFault : public AlphaFault
78 static FaultName _name;
79 static FaultVect _vect;
80 static FaultStat _count;
82 FaultName name() {return _name;}
83 FaultVect vect() {return _vect;}
84 FaultStat & countStat() {return _count;}
85 bool isAlignmentFault() {return true;}
88 static inline Fault genMachineCheckFault()
90 return new MachineCheckFault;
93 static inline Fault genAlignmentFault()
95 return new AlignmentFault;
98 class ResetFault : public AlphaFault
101 static FaultName _name;
102 static FaultVect _vect;
103 static FaultStat _count;
105 FaultName name() {return _name;}
106 FaultVect vect() {return _vect;}
107 FaultStat & countStat() {return _count;}
110 class ArithmeticFault : public AlphaFault
113 bool skipFaultingInstruction() {return true;}
115 static FaultName _name;
116 static FaultVect _vect;
117 static FaultStat _count;
119 FaultName name() {return _name;}
120 FaultVect vect() {return _vect;}
121 FaultStat & countStat() {return _count;}
123 void invoke(ThreadContext * tc);
127 class InterruptFault : public AlphaFault
130 bool setRestartAddress() {return false;}
132 static FaultName _name;
133 static FaultVect _vect;
134 static FaultStat _count;
136 FaultName name() {return _name;}
137 FaultVect vect() {return _vect;}
138 FaultStat & countStat() {return _count;}
141 class DtbFault : public AlphaFault
145 AlphaISA::VAddr vaddr;
149 DtbFault(AlphaISA::VAddr _vaddr, uint32_t _reqFlags, uint64_t _flags)
150 : vaddr(_vaddr), reqFlags(_reqFlags), flags(_flags)
153 FaultName name() = 0;
154 FaultVect vect() = 0;
155 FaultStat & countStat() = 0;
157 void invoke(ThreadContext * tc);
161 class NDtbMissFault : public DtbFault
164 static FaultName _name;
165 static FaultVect _vect;
166 static FaultStat _count;
169 NDtbMissFault(AlphaISA::VAddr vaddr, uint32_t reqFlags, uint64_t flags)
170 : DtbFault(vaddr, reqFlags, flags)
173 FaultName name() {return _name;}
174 FaultVect vect() {return _vect;}
175 FaultStat & countStat() {return _count;}
178 class PDtbMissFault : public DtbFault
181 static FaultName _name;
182 static FaultVect _vect;
183 static FaultStat _count;
186 PDtbMissFault(AlphaISA::VAddr vaddr, uint32_t reqFlags, uint64_t flags)
187 : DtbFault(vaddr, reqFlags, flags)
190 FaultName name() {return _name;}
191 FaultVect vect() {return _vect;}
192 FaultStat & countStat() {return _count;}
195 class DtbPageFault : public DtbFault
198 static FaultName _name;
199 static FaultVect _vect;
200 static FaultStat _count;
203 DtbPageFault(AlphaISA::VAddr vaddr, uint32_t reqFlags, uint64_t flags)
204 : DtbFault(vaddr, reqFlags, flags)
207 FaultName name() {return _name;}
208 FaultVect vect() {return _vect;}
209 FaultStat & countStat() {return _count;}
212 class DtbAcvFault : public DtbFault
215 static FaultName _name;
216 static FaultVect _vect;
217 static FaultStat _count;
220 DtbAcvFault(AlphaISA::VAddr vaddr, uint32_t reqFlags, uint64_t flags)
221 : DtbFault(vaddr, reqFlags, flags)
224 FaultName name() {return _name;}
225 FaultVect vect() {return _vect;}
226 FaultStat & countStat() {return _count;}
229 class DtbAlignmentFault : public DtbFault
232 static FaultName _name;
233 static FaultVect _vect;
234 static FaultStat _count;
237 DtbAlignmentFault(AlphaISA::VAddr vaddr, uint32_t reqFlags, uint64_t flags)
238 : DtbFault(vaddr, reqFlags, flags)
241 FaultName name() {return _name;}
242 FaultVect vect() {return _vect;}
243 FaultStat & countStat() {return _count;}
246 class ItbFault : public AlphaFault
254 FaultName name() = 0;
255 FaultVect vect() = 0;
256 FaultStat & countStat() = 0;
258 void invoke(ThreadContext * tc);
262 class ItbMissFault : public ItbFault
265 static FaultName _name;
266 static FaultVect _vect;
267 static FaultStat _count;
269 ItbMissFault(Addr pc)
272 FaultName name() {return _name;}
273 FaultVect vect() {return _vect;}
274 FaultStat & countStat() {return _count;}
277 class ItbPageFault : public ItbFault
280 static FaultName _name;
281 static FaultVect _vect;
282 static FaultStat _count;
284 ItbPageFault(Addr pc)
287 FaultName name() {return _name;}
288 FaultVect vect() {return _vect;}
289 FaultStat & countStat() {return _count;}
292 class ItbAcvFault : public ItbFault
295 static FaultName _name;
296 static FaultVect _vect;
297 static FaultStat _count;
302 FaultName name() {return _name;}
303 FaultVect vect() {return _vect;}
304 FaultStat & countStat() {return _count;}
307 class UnimplementedOpcodeFault : public AlphaFault
310 static FaultName _name;
311 static FaultVect _vect;
312 static FaultStat _count;
314 FaultName name() {return _name;}
315 FaultVect vect() {return _vect;}
316 FaultStat & countStat() {return _count;}
319 class FloatEnableFault : public AlphaFault
322 static FaultName _name;
323 static FaultVect _vect;
324 static FaultStat _count;
326 FaultName name() {return _name;}
327 FaultVect vect() {return _vect;}
328 FaultStat & countStat() {return _count;}
331 class PalFault : public AlphaFault
334 bool skipFaultingInstruction() {return true;}
336 static FaultName _name;
337 static FaultVect _vect;
338 static FaultStat _count;
340 FaultName name() {return _name;}
341 FaultVect vect() {return _vect;}
342 FaultStat & countStat() {return _count;}
345 class IntegerOverflowFault : public AlphaFault
348 static FaultName _name;
349 static FaultVect _vect;
350 static FaultStat _count;
352 FaultName name() {return _name;}
353 FaultVect vect() {return _vect;}
354 FaultStat & countStat() {return _count;}
357 } // AlphaISA namespace
359 #endif // __FAULTS_HH__