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() {return _name;}
65 FaultVect vect() {return _vect;}
66 FaultStat & countStat() {return _count;}
67 bool isMachineCheckFault() {return true;}
70 class AlignmentFault : public MipsFault
73 static FaultName _name;
74 static FaultVect _vect;
75 static FaultStat _count;
77 FaultName name() {return _name;}
78 FaultVect vect() {return _vect;}
79 FaultStat & countStat() {return _count;}
80 bool isAlignmentFault() {return true;}
84 class PageTableFault : public MipsFault
88 static FaultName _name;
89 static FaultVect _vect;
90 static FaultStat _count;
92 PageTableFault(Addr va)
94 FaultName name() {return _name;}
95 FaultVect vect() {return _vect;}
96 FaultStat & countStat() {return _count;}
97 void invoke(ThreadContext * tc);
100 static inline Fault genPageTableFault(Addr va)
102 return new PageTableFault(va);
107 static inline Fault genMachineCheckFault()
109 return new MachineCheckFault;
112 static inline Fault genAlignmentFault()
114 return new AlignmentFault;
117 class ResetFault : public MipsFault
120 static FaultName _name;
121 static FaultVect _vect;
122 static FaultStat _count;
124 FaultName name() {return _name;}
125 FaultVect vect() {return _vect;}
126 FaultStat & countStat() {return _count;}
129 class ArithmeticFault : public MipsFault
132 bool skipFaultingInstruction() {return true;}
134 static FaultName _name;
135 static FaultVect _vect;
136 static FaultStat _count;
138 FaultName name() {return _name;}
139 FaultVect vect() {return _vect;}
140 FaultStat & countStat() {return _count;}
142 void invoke(ThreadContext * tc);
146 class InterruptFault : public MipsFault
149 bool setRestartAddress() {return false;}
151 static FaultName _name;
152 static FaultVect _vect;
153 static FaultStat _count;
155 FaultName name() {return _name;}
156 FaultVect vect() {return _vect;}
157 FaultStat & countStat() {return _count;}
160 class NDtbMissFault : public MipsFault
163 static FaultName _name;
164 static FaultVect _vect;
165 static FaultStat _count;
167 FaultName name() {return _name;}
168 FaultVect vect() {return _vect;}
169 FaultStat & countStat() {return _count;}
172 class PDtbMissFault : public MipsFault
175 static FaultName _name;
176 static FaultVect _vect;
177 static FaultStat _count;
179 FaultName name() {return _name;}
180 FaultVect vect() {return _vect;}
181 FaultStat & countStat() {return _count;}
184 class DtbPageFault : public MipsFault
187 static FaultName _name;
188 static FaultVect _vect;
189 static FaultStat _count;
191 FaultName name() {return _name;}
192 FaultVect vect() {return _vect;}
193 FaultStat & countStat() {return _count;}
196 class DtbAcvFault : public MipsFault
199 static FaultName _name;
200 static FaultVect _vect;
201 static FaultStat _count;
203 FaultName name() {return _name;}
204 FaultVect vect() {return _vect;}
205 FaultStat & countStat() {return _count;}
208 class ItbMissFault : public MipsFault
211 static FaultName _name;
212 static FaultVect _vect;
213 static FaultStat _count;
215 FaultName name() {return _name;}
216 FaultVect vect() {return _vect;}
217 FaultStat & countStat() {return _count;}
220 class ItbPageFault : public MipsFault
223 static FaultName _name;
224 static FaultVect _vect;
225 static FaultStat _count;
227 FaultName name() {return _name;}
228 FaultVect vect() {return _vect;}
229 FaultStat & countStat() {return _count;}
232 class ItbAcvFault : public MipsFault
235 static FaultName _name;
236 static FaultVect _vect;
237 static FaultStat _count;
239 FaultName name() {return _name;}
240 FaultVect vect() {return _vect;}
241 FaultStat & countStat() {return _count;}
244 class UnimplementedOpcodeFault : public MipsFault
247 static FaultName _name;
248 static FaultVect _vect;
249 static FaultStat _count;
251 FaultName name() {return _name;}
252 FaultVect vect() {return _vect;}
253 FaultStat & countStat() {return _count;}
256 class FloatEnableFault : public MipsFault
259 static FaultName _name;
260 static FaultVect _vect;
261 static FaultStat _count;
263 FaultName name() {return _name;}
264 FaultVect vect() {return _vect;}
265 FaultStat & countStat() {return _count;}
268 class PalFault : public MipsFault
271 bool skipFaultingInstruction() {return true;}
273 static FaultName _name;
274 static FaultVect _vect;
275 static FaultStat _count;
277 FaultName name() {return _name;}
278 FaultVect vect() {return _vect;}
279 FaultStat & countStat() {return _count;}
282 class IntegerOverflowFault : public MipsFault
285 static FaultName _name;
286 static FaultVect _vect;
287 static FaultStat _count;
289 FaultName name() {return _name;}
290 FaultVect vect() {return _vect;}
291 FaultStat & countStat() {return _count;}
294 } // MipsISA namespace
296 #endif // __FAULTS_HH__