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.
28 * Authors: Korey Sewell
31 #ifndef __MIPS_FAULTS_HH__
32 #define __MIPS_FAULTS_HH__
34 #include "sim/faults.hh"
36 // The design of the "name" and "vect" functions is in sim/faults.hh
41 typedef const Addr FaultVect;
43 class MipsFault : public FaultBase
46 virtual bool skipFaultingInstruction() {return false;}
47 virtual bool setRestartAddress() {return true;}
50 void invoke(ThreadContext * tc);
52 virtual FaultVect vect() = 0;
53 virtual FaultStat & countStat() = 0;
56 class MachineCheckFault : public MipsFault
59 static FaultName _name;
60 static FaultVect _vect;
61 static FaultStat _count;
63 FaultName name() {return _name;}
64 FaultVect vect() {return _vect;}
65 FaultStat & countStat() {return _count;}
66 bool isMachineCheckFault() {return true;}
69 class AlignmentFault : public MipsFault
72 static FaultName _name;
73 static FaultVect _vect;
74 static FaultStat _count;
76 FaultName name() {return _name;}
77 FaultVect vect() {return _vect;}
78 FaultStat & countStat() {return _count;}
79 bool isAlignmentFault() {return true;}
83 class PageTableFault : public MipsFault
87 static FaultName _name;
88 static FaultVect _vect;
89 static FaultStat _count;
91 PageTableFault(Addr va)
93 FaultName name() {return _name;}
94 FaultVect vect() {return _vect;}
95 FaultStat & countStat() {return _count;}
96 void invoke(ThreadContext * tc);
99 static inline Fault genPageTableFault(Addr va)
101 return new PageTableFault(va);
106 static inline Fault genMachineCheckFault()
108 return new MachineCheckFault;
111 static inline Fault genAlignmentFault()
113 return new AlignmentFault;
116 class ResetFault : public MipsFault
119 static FaultName _name;
120 static FaultVect _vect;
121 static FaultStat _count;
123 FaultName name() {return _name;}
124 FaultVect vect() {return _vect;}
125 FaultStat & countStat() {return _count;}
128 class ArithmeticFault : public MipsFault
131 bool skipFaultingInstruction() {return true;}
133 static FaultName _name;
134 static FaultVect _vect;
135 static FaultStat _count;
137 FaultName name() {return _name;}
138 FaultVect vect() {return _vect;}
139 FaultStat & countStat() {return _count;}
141 void invoke(ThreadContext * tc);
145 class InterruptFault : public MipsFault
148 bool setRestartAddress() {return false;}
150 static FaultName _name;
151 static FaultVect _vect;
152 static FaultStat _count;
154 FaultName name() {return _name;}
155 FaultVect vect() {return _vect;}
156 FaultStat & countStat() {return _count;}
159 class NDtbMissFault : public MipsFault
162 static FaultName _name;
163 static FaultVect _vect;
164 static FaultStat _count;
166 FaultName name() {return _name;}
167 FaultVect vect() {return _vect;}
168 FaultStat & countStat() {return _count;}
171 class PDtbMissFault : public MipsFault
174 static FaultName _name;
175 static FaultVect _vect;
176 static FaultStat _count;
178 FaultName name() {return _name;}
179 FaultVect vect() {return _vect;}
180 FaultStat & countStat() {return _count;}
183 class DtbPageFault : public MipsFault
186 static FaultName _name;
187 static FaultVect _vect;
188 static FaultStat _count;
190 FaultName name() {return _name;}
191 FaultVect vect() {return _vect;}
192 FaultStat & countStat() {return _count;}
195 class DtbAcvFault : public MipsFault
198 static FaultName _name;
199 static FaultVect _vect;
200 static FaultStat _count;
202 FaultName name() {return _name;}
203 FaultVect vect() {return _vect;}
204 FaultStat & countStat() {return _count;}
207 class ItbMissFault : public MipsFault
210 static FaultName _name;
211 static FaultVect _vect;
212 static FaultStat _count;
214 FaultName name() {return _name;}
215 FaultVect vect() {return _vect;}
216 FaultStat & countStat() {return _count;}
219 class ItbPageFault : public MipsFault
222 static FaultName _name;
223 static FaultVect _vect;
224 static FaultStat _count;
226 FaultName name() {return _name;}
227 FaultVect vect() {return _vect;}
228 FaultStat & countStat() {return _count;}
231 class ItbAcvFault : public MipsFault
234 static FaultName _name;
235 static FaultVect _vect;
236 static FaultStat _count;
238 FaultName name() {return _name;}
239 FaultVect vect() {return _vect;}
240 FaultStat & countStat() {return _count;}
243 class UnimplementedOpcodeFault : public MipsFault
246 static FaultName _name;
247 static FaultVect _vect;
248 static FaultStat _count;
250 FaultName name() {return _name;}
251 FaultVect vect() {return _vect;}
252 FaultStat & countStat() {return _count;}
255 class FloatEnableFault : public MipsFault
258 static FaultName _name;
259 static FaultVect _vect;
260 static FaultStat _count;
262 FaultName name() {return _name;}
263 FaultVect vect() {return _vect;}
264 FaultStat & countStat() {return _count;}
267 class PalFault : public MipsFault
270 bool skipFaultingInstruction() {return true;}
272 static FaultName _name;
273 static FaultVect _vect;
274 static FaultStat _count;
276 FaultName name() {return _name;}
277 FaultVect vect() {return _vect;}
278 FaultStat & countStat() {return _count;}
281 class IntegerOverflowFault : public MipsFault
284 static FaultName _name;
285 static FaultVect _vect;
286 static FaultStat _count;
288 FaultName name() {return _name;}
289 FaultVect vect() {return _vect;}
290 FaultStat & countStat() {return _count;}
293 } // MipsISA namespace
295 #endif // __FAULTS_HH__