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;}
83 static inline Fault genMachineCheckFault()
85 return new MachineCheckFault;
88 static inline Fault genAlignmentFault()
90 return new AlignmentFault;
93 class ResetFault : public MipsFault
96 static FaultName _name;
97 static FaultVect _vect;
98 static FaultStat _count;
100 FaultName name() {return _name;}
101 FaultVect vect() {return _vect;}
102 FaultStat & countStat() {return _count;}
105 class ArithmeticFault : public MipsFault
108 bool skipFaultingInstruction() {return true;}
110 static FaultName _name;
111 static FaultVect _vect;
112 static FaultStat _count;
114 FaultName name() {return _name;}
115 FaultVect vect() {return _vect;}
116 FaultStat & countStat() {return _count;}
118 void invoke(ThreadContext * tc);
122 class InterruptFault : public MipsFault
125 bool setRestartAddress() {return false;}
127 static FaultName _name;
128 static FaultVect _vect;
129 static FaultStat _count;
131 FaultName name() {return _name;}
132 FaultVect vect() {return _vect;}
133 FaultStat & countStat() {return _count;}
136 class NDtbMissFault : public MipsFault
139 static FaultName _name;
140 static FaultVect _vect;
141 static FaultStat _count;
143 FaultName name() {return _name;}
144 FaultVect vect() {return _vect;}
145 FaultStat & countStat() {return _count;}
148 class PDtbMissFault : public MipsFault
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 DtbPageFault : 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 DtbAcvFault : 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 ItbMissFault : 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 ItbPageFault : 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 ItbAcvFault : 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 UnimplementedOpcodeFault : 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 FloatEnableFault : 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 PalFault : public MipsFault
247 bool skipFaultingInstruction() {return true;}
249 static FaultName _name;
250 static FaultVect _vect;
251 static FaultStat _count;
253 FaultName name() {return _name;}
254 FaultVect vect() {return _vect;}
255 FaultStat & countStat() {return _count;}
258 class IntegerOverflowFault : public MipsFault
261 static FaultName _name;
262 static FaultVect _vect;
263 static FaultStat _count;
265 FaultName name() {return _name;}
266 FaultVect vect() {return _vect;}
267 FaultStat & countStat() {return _count;}
270 } // MipsISA namespace
272 #endif // __FAULTS_HH__