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.
29 #ifndef __ALPHA_FAULTS_HH__
30 #define __ALPHA_FAULTS_HH__
32 #include "arch/alpha/isa_traits.hh"
33 #include "sim/faults.hh"
35 // The design of the "name" and "vect" functions is in sim/faults.hh
40 typedef const Addr FaultVect;
42 class AlphaFault : public FaultBase
45 virtual bool skipFaultingInstruction() {return false;}
46 virtual bool setRestartAddress() {return true;}
49 void invoke(ExecContext * xc);
51 virtual FaultVect vect() = 0;
52 virtual FaultStat & countStat() = 0;
55 class MachineCheckFault : public AlphaFault
58 static FaultName _name;
59 static FaultVect _vect;
60 static FaultStat _count;
62 FaultName name() {return _name;}
63 FaultVect vect() {return _vect;}
64 FaultStat & countStat() {return _count;}
65 bool isMachineCheckFault() {return true;}
68 class AlignmentFault : public AlphaFault
71 static FaultName _name;
72 static FaultVect _vect;
73 static FaultStat _count;
75 FaultName name() {return _name;}
76 FaultVect vect() {return _vect;}
77 FaultStat & countStat() {return _count;}
78 bool isAlignmentFault() {return true;}
81 static inline Fault genMachineCheckFault()
83 return new MachineCheckFault;
86 static inline Fault genAlignmentFault()
88 return new AlignmentFault;
91 class ResetFault : public AlphaFault
94 static FaultName _name;
95 static FaultVect _vect;
96 static FaultStat _count;
98 FaultName name() {return _name;}
99 FaultVect vect() {return _vect;}
100 FaultStat & countStat() {return _count;}
103 class ArithmeticFault : public AlphaFault
106 bool skipFaultingInstruction() {return true;}
108 static FaultName _name;
109 static FaultVect _vect;
110 static FaultStat _count;
112 FaultName name() {return _name;}
113 FaultVect vect() {return _vect;}
114 FaultStat & countStat() {return _count;}
116 void invoke(ExecContext * xc);
120 class InterruptFault : public AlphaFault
123 bool setRestartAddress() {return false;}
125 static FaultName _name;
126 static FaultVect _vect;
127 static FaultStat _count;
129 FaultName name() {return _name;}
130 FaultVect vect() {return _vect;}
131 FaultStat & countStat() {return _count;}
134 class DtbFault : public AlphaFault
138 AlphaISA::VAddr vaddr;
142 DtbFault(AlphaISA::VAddr _vaddr, uint32_t _reqFlags, uint64_t _flags)
143 : vaddr(_vaddr), reqFlags(_reqFlags), flags(_flags)
146 FaultName name() = 0;
147 FaultVect vect() = 0;
148 FaultStat & countStat() = 0;
150 void invoke(ExecContext * xc);
154 class NDtbMissFault : public DtbFault
157 static FaultName _name;
158 static FaultVect _vect;
159 static FaultStat _count;
162 NDtbMissFault(AlphaISA::VAddr vaddr, uint32_t reqFlags, uint64_t flags)
163 : DtbFault(vaddr, reqFlags, flags)
166 FaultName name() {return _name;}
167 FaultVect vect() {return _vect;}
168 FaultStat & countStat() {return _count;}
171 class PDtbMissFault : public DtbFault
174 static FaultName _name;
175 static FaultVect _vect;
176 static FaultStat _count;
179 PDtbMissFault(AlphaISA::VAddr vaddr, uint32_t reqFlags, uint64_t flags)
180 : DtbFault(vaddr, reqFlags, flags)
183 FaultName name() {return _name;}
184 FaultVect vect() {return _vect;}
185 FaultStat & countStat() {return _count;}
188 class DtbPageFault : public DtbFault
191 static FaultName _name;
192 static FaultVect _vect;
193 static FaultStat _count;
196 DtbPageFault(AlphaISA::VAddr vaddr, uint32_t reqFlags, uint64_t flags)
197 : DtbFault(vaddr, reqFlags, flags)
200 FaultName name() {return _name;}
201 FaultVect vect() {return _vect;}
202 FaultStat & countStat() {return _count;}
205 class DtbAcvFault : public DtbFault
208 static FaultName _name;
209 static FaultVect _vect;
210 static FaultStat _count;
213 DtbAcvFault(AlphaISA::VAddr vaddr, uint32_t reqFlags, uint64_t flags)
214 : DtbFault(vaddr, reqFlags, flags)
217 FaultName name() {return _name;}
218 FaultVect vect() {return _vect;}
219 FaultStat & countStat() {return _count;}
222 class DtbAlignmentFault : public DtbFault
225 static FaultName _name;
226 static FaultVect _vect;
227 static FaultStat _count;
230 DtbAlignmentFault(AlphaISA::VAddr vaddr, uint32_t reqFlags, uint64_t flags)
231 : DtbFault(vaddr, reqFlags, flags)
234 FaultName name() {return _name;}
235 FaultVect vect() {return _vect;}
236 FaultStat & countStat() {return _count;}
239 class ItbFault : public AlphaFault
247 FaultName name() = 0;
248 FaultVect vect() = 0;
249 FaultStat & countStat() = 0;
251 void invoke(ExecContext * xc);
255 class ItbMissFault : public ItbFault
258 static FaultName _name;
259 static FaultVect _vect;
260 static FaultStat _count;
262 ItbMissFault(Addr pc)
265 FaultName name() {return _name;}
266 FaultVect vect() {return _vect;}
267 FaultStat & countStat() {return _count;}
270 class ItbPageFault : public ItbFault
273 static FaultName _name;
274 static FaultVect _vect;
275 static FaultStat _count;
277 ItbPageFault(Addr pc)
280 FaultName name() {return _name;}
281 FaultVect vect() {return _vect;}
282 FaultStat & countStat() {return _count;}
285 class ItbAcvFault : public ItbFault
288 static FaultName _name;
289 static FaultVect _vect;
290 static FaultStat _count;
295 FaultName name() {return _name;}
296 FaultVect vect() {return _vect;}
297 FaultStat & countStat() {return _count;}
300 class UnimplementedOpcodeFault : public AlphaFault
303 static FaultName _name;
304 static FaultVect _vect;
305 static FaultStat _count;
307 FaultName name() {return _name;}
308 FaultVect vect() {return _vect;}
309 FaultStat & countStat() {return _count;}
312 class FloatEnableFault : public AlphaFault
315 static FaultName _name;
316 static FaultVect _vect;
317 static FaultStat _count;
319 FaultName name() {return _name;}
320 FaultVect vect() {return _vect;}
321 FaultStat & countStat() {return _count;}
324 class PalFault : public AlphaFault
327 bool skipFaultingInstruction() {return true;}
329 static FaultName _name;
330 static FaultVect _vect;
331 static FaultStat _count;
333 FaultName name() {return _name;}
334 FaultVect vect() {return _vect;}
335 FaultStat & countStat() {return _count;}
338 class IntegerOverflowFault : public AlphaFault
341 static FaultName _name;
342 static FaultVect _vect;
343 static FaultStat _count;
345 FaultName name() {return _name;}
346 FaultVect vect() {return _vect;}
347 FaultStat & countStat() {return _count;}
350 } // AlphaISA namespace
352 #endif // __FAULTS_HH__