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 __MIPS_FAULTS_HH__
33 #define __MIPS_FAULTS_HH__
35 #include "sim/faults.hh"
37 // The design of the "name" and "vect" functions is in sim/faults.hh
42 typedef const Addr FaultVect;
44 class MipsFault : public FaultBase
47 virtual bool skipFaultingInstruction() {return false;}
48 virtual bool setRestartAddress() {return true;}
51 void invoke(ThreadContext * tc);
53 virtual FaultVect vect() = 0;
54 virtual FaultStat & countStat() = 0;
57 class MachineCheckFault : public MipsFault
60 static FaultName _name;
61 static FaultVect _vect;
62 static FaultStat _count;
64 FaultName name() const {return _name;}
65 FaultVect vect() {return _vect;}
66 FaultStat & countStat() {return _count;}
67 bool isMachineCheckFault() const {return true;}
70 class AlignmentFault : public MipsFault
73 static FaultName _name;
74 static FaultVect _vect;
75 static FaultStat _count;
77 FaultName name() const {return _name;}
78 FaultVect vect() {return _vect;}
79 FaultStat & countStat() {return _count;}
80 bool isAlignmentFault() const {return true;}
83 class UnimplementedOpcodeFault : public MipsFault
86 static FaultName _name;
87 static FaultVect _vect;
88 static FaultStat _count;
90 FaultName name() const {return _name;}
91 FaultVect vect() {return _vect;}
92 FaultStat & countStat() {return _count;}
95 static inline Fault genMachineCheckFault()
97 return new MachineCheckFault;
100 class ResetFault : public MipsFault
103 static FaultName _name;
104 static FaultVect _vect;
105 static FaultStat _count;
107 FaultName name() const {return _name;}
108 FaultVect vect() {return _vect;}
109 FaultStat & countStat() {return _count;}
110 void invoke(ThreadContext * tc);
113 class CoprocessorUnusableFault : public MipsFault
116 static FaultName _name;
117 static FaultVect _vect;
118 static FaultStat _count;
120 FaultName name() const {return _name;}
121 FaultVect vect() {return _vect;}
122 FaultStat & countStat() {return _count;}
123 void invoke(ThreadContext * tc);
126 class ReservedInstructionFault : public MipsFault
129 static FaultName _name;
130 static FaultVect _vect;
131 static FaultStat _count;
133 FaultName name() const {return _name;}
134 FaultVect vect() {return _vect;}
135 FaultStat & countStat() {return _count;}
136 void invoke(ThreadContext * tc);
139 class ThreadFault : public MipsFault
142 static FaultName _name;
143 static FaultVect _vect;
144 static FaultStat _count;
146 FaultName name() const {return _name;}
147 FaultVect vect() {return _vect;}
148 FaultStat & countStat() {return _count;}
149 void invoke(ThreadContext * tc);
153 class ArithmeticFault : public MipsFault
156 bool skipFaultingInstruction() {return true;}
158 static FaultName _name;
159 static FaultVect _vect;
160 static FaultStat _count;
162 FaultName name() const {return _name;}
163 FaultVect vect() {return _vect;}
164 FaultStat & countStat() {return _count;}
166 void invoke(ThreadContext * tc);
170 class InterruptFault : public MipsFault
173 bool setRestartAddress() {return false;}
175 static FaultName _name;
176 static FaultVect _vect;
177 static FaultStat _count;
179 FaultName name() const {return _name;}
180 FaultVect vect() {return _vect;}
181 FaultStat & countStat() {return _count;}
184 class NDtbMissFault : public MipsFault
187 static FaultName _name;
188 static FaultVect _vect;
189 static FaultStat _count;
191 FaultName name() const {return _name;}
192 FaultVect vect() {return _vect;}
193 FaultStat & countStat() {return _count;}
196 class PDtbMissFault : public MipsFault
199 static FaultName _name;
200 static FaultVect _vect;
201 static FaultStat _count;
203 FaultName name() const {return _name;}
204 FaultVect vect() {return _vect;}
205 FaultStat & countStat() {return _count;}
208 class DtbPageFault : public MipsFault
211 static FaultName _name;
212 static FaultVect _vect;
213 static FaultStat _count;
215 FaultName name() const {return _name;}
216 FaultVect vect() {return _vect;}
217 FaultStat & countStat() {return _count;}
220 class DtbAcvFault : public MipsFault
223 static FaultName _name;
224 static FaultVect _vect;
225 static FaultStat _count;
227 FaultName name() const {return _name;}
228 FaultVect vect() {return _vect;}
229 FaultStat & countStat() {return _count;}
232 class ItbMissFault : public MipsFault
235 static FaultName _name;
236 static FaultVect _vect;
237 static FaultStat _count;
239 FaultName name() const {return _name;}
240 FaultVect vect() {return _vect;}
241 FaultStat & countStat() {return _count;}
244 class ItbPageFault : public MipsFault
247 static FaultName _name;
248 static FaultVect _vect;
249 static FaultStat _count;
251 FaultName name() const {return _name;}
252 FaultVect vect() {return _vect;}
253 FaultStat & countStat() {return _count;}
256 class ItbAcvFault : public MipsFault
259 static FaultName _name;
260 static FaultVect _vect;
261 static FaultStat _count;
263 FaultName name() const {return _name;}
264 FaultVect vect() {return _vect;}
265 FaultStat & countStat() {return _count;}
268 class FloatEnableFault : public MipsFault
271 static FaultName _name;
272 static FaultVect _vect;
273 static FaultStat _count;
275 FaultName name() const {return _name;}
276 FaultVect vect() {return _vect;}
277 FaultStat & countStat() {return _count;}
280 class IntegerOverflowFault : public MipsFault
283 static FaultName _name;
284 static FaultVect _vect;
285 static FaultStat _count;
287 FaultName name() const {return _name;}
288 FaultVect vect() {return _vect;}
289 FaultStat & countStat() {return _count;}
292 class DspStateDisabledFault : public MipsFault
295 static FaultName _name;
296 static FaultVect _vect;
297 static FaultStat _count;
299 FaultName name() const {return _name;}
300 FaultVect vect() {return _vect;}
301 FaultStat & countStat() {return _count;}
302 void invoke(ThreadContext * tc);
305 } // MipsISA namespace
307 #endif // __FAULTS_HH__