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 "arch/alpha/isa_traits.hh"
36 #include "sim/faults.hh"
38 // The design of the "name" and "vect" functions is in sim/faults.hh
43 typedef const Addr FaultVect;
45 class AlphaFault : public FaultBase
48 virtual bool skipFaultingInstruction() {return false;}
49 virtual bool setRestartAddress() {return true;}
52 void invoke(ThreadContext * tc);
54 virtual FaultVect vect() = 0;
55 virtual FaultStat & countStat() = 0;
58 class MachineCheckFault : public AlphaFault
61 static FaultName _name;
62 static FaultVect _vect;
63 static FaultStat _count;
65 FaultName name() {return _name;}
66 FaultVect vect() {return _vect;}
67 FaultStat & countStat() {return _count;}
68 bool isMachineCheckFault() {return true;}
71 class AlignmentFault : public AlphaFault
74 static FaultName _name;
75 static FaultVect _vect;
76 static FaultStat _count;
78 FaultName name() {return _name;}
79 FaultVect vect() {return _vect;}
80 FaultStat & countStat() {return _count;}
81 bool isAlignmentFault() {return true;}
84 static inline Fault genMachineCheckFault()
86 return new MachineCheckFault;
89 static inline Fault genAlignmentFault()
91 return new AlignmentFault;
94 class ResetFault : public AlphaFault
97 static FaultName _name;
98 static FaultVect _vect;
99 static FaultStat _count;
101 FaultName name() {return _name;}
102 FaultVect vect() {return _vect;}
103 FaultStat & countStat() {return _count;}
106 class ArithmeticFault : public AlphaFault
109 bool skipFaultingInstruction() {return true;}
111 static FaultName _name;
112 static FaultVect _vect;
113 static FaultStat _count;
115 FaultName name() {return _name;}
116 FaultVect vect() {return _vect;}
117 FaultStat & countStat() {return _count;}
119 void invoke(ThreadContext * tc);
123 class InterruptFault : public AlphaFault
126 bool setRestartAddress() {return false;}
128 static FaultName _name;
129 static FaultVect _vect;
130 static FaultStat _count;
132 FaultName name() {return _name;}
133 FaultVect vect() {return _vect;}
134 FaultStat & countStat() {return _count;}
137 class DtbFault : public AlphaFault
141 AlphaISA::VAddr vaddr;
145 DtbFault(AlphaISA::VAddr _vaddr, uint32_t _reqFlags, uint64_t _flags)
146 : vaddr(_vaddr), reqFlags(_reqFlags), flags(_flags)
149 FaultName name() = 0;
150 FaultVect vect() = 0;
151 FaultStat & countStat() = 0;
153 void invoke(ThreadContext * tc);
157 class NDtbMissFault : public DtbFault
160 static FaultName _name;
161 static FaultVect _vect;
162 static FaultStat _count;
165 NDtbMissFault(AlphaISA::VAddr vaddr, uint32_t reqFlags, uint64_t flags)
166 : DtbFault(vaddr, reqFlags, flags)
169 FaultName name() {return _name;}
170 FaultVect vect() {return _vect;}
171 FaultStat & countStat() {return _count;}
174 class PDtbMissFault : public DtbFault
177 static FaultName _name;
178 static FaultVect _vect;
179 static FaultStat _count;
182 PDtbMissFault(AlphaISA::VAddr vaddr, uint32_t reqFlags, uint64_t flags)
183 : DtbFault(vaddr, reqFlags, flags)
186 FaultName name() {return _name;}
187 FaultVect vect() {return _vect;}
188 FaultStat & countStat() {return _count;}
191 class DtbPageFault : public DtbFault
194 static FaultName _name;
195 static FaultVect _vect;
196 static FaultStat _count;
199 DtbPageFault(AlphaISA::VAddr vaddr, uint32_t reqFlags, uint64_t flags)
200 : DtbFault(vaddr, reqFlags, flags)
203 FaultName name() {return _name;}
204 FaultVect vect() {return _vect;}
205 FaultStat & countStat() {return _count;}
208 class DtbAcvFault : public DtbFault
211 static FaultName _name;
212 static FaultVect _vect;
213 static FaultStat _count;
216 DtbAcvFault(AlphaISA::VAddr vaddr, uint32_t reqFlags, uint64_t flags)
217 : DtbFault(vaddr, reqFlags, flags)
220 FaultName name() {return _name;}
221 FaultVect vect() {return _vect;}
222 FaultStat & countStat() {return _count;}
225 class DtbAlignmentFault : public DtbFault
228 static FaultName _name;
229 static FaultVect _vect;
230 static FaultStat _count;
233 DtbAlignmentFault(AlphaISA::VAddr vaddr, uint32_t reqFlags, uint64_t flags)
234 : DtbFault(vaddr, reqFlags, flags)
237 FaultName name() {return _name;}
238 FaultVect vect() {return _vect;}
239 FaultStat & countStat() {return _count;}
242 class ItbFault : public AlphaFault
250 FaultName name() = 0;
251 FaultVect vect() = 0;
252 FaultStat & countStat() = 0;
254 void invoke(ThreadContext * tc);
258 class ItbMissFault : public ItbFault
261 static FaultName _name;
262 static FaultVect _vect;
263 static FaultStat _count;
265 ItbMissFault(Addr pc)
268 FaultName name() {return _name;}
269 FaultVect vect() {return _vect;}
270 FaultStat & countStat() {return _count;}
273 class ItbPageFault : public ItbFault
276 static FaultName _name;
277 static FaultVect _vect;
278 static FaultStat _count;
280 ItbPageFault(Addr pc)
283 FaultName name() {return _name;}
284 FaultVect vect() {return _vect;}
285 FaultStat & countStat() {return _count;}
288 class ItbAcvFault : public ItbFault
291 static FaultName _name;
292 static FaultVect _vect;
293 static FaultStat _count;
298 FaultName name() {return _name;}
299 FaultVect vect() {return _vect;}
300 FaultStat & countStat() {return _count;}
303 class UnimplementedOpcodeFault : public AlphaFault
306 static FaultName _name;
307 static FaultVect _vect;
308 static FaultStat _count;
310 FaultName name() {return _name;}
311 FaultVect vect() {return _vect;}
312 FaultStat & countStat() {return _count;}
315 class FloatEnableFault : public AlphaFault
318 static FaultName _name;
319 static FaultVect _vect;
320 static FaultStat _count;
322 FaultName name() {return _name;}
323 FaultVect vect() {return _vect;}
324 FaultStat & countStat() {return _count;}
327 class PalFault : public AlphaFault
330 bool skipFaultingInstruction() {return true;}
332 static FaultName _name;
333 static FaultVect _vect;
334 static FaultStat _count;
336 FaultName name() {return _name;}
337 FaultVect vect() {return _vect;}
338 FaultStat & countStat() {return _count;}
341 class IntegerOverflowFault : public AlphaFault
344 static FaultName _name;
345 static FaultVect _vect;
346 static FaultStat _count;
348 FaultName name() {return _name;}
349 FaultVect vect() {return _vect;}
350 FaultStat & countStat() {return _count;}
353 } // AlphaISA namespace
355 #endif // __FAULTS_HH__