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 __MIPS_FAULTS_HH__
30 #define __MIPS_FAULTS_HH__
32 #include "sim/faults.hh"
34 // The design of the "name" and "vect" functions is in sim/faults.hh
39 typedef const Addr FaultVect;
41 class MipsFault : public FaultBase
44 virtual bool skipFaultingInstruction() {return false;}
45 virtual bool setRestartAddress() {return true;}
48 void invoke(ExecContext * xc);
50 virtual FaultVect vect() = 0;
51 virtual FaultStat & countStat() = 0;
54 class MachineCheckFault : public MipsFault
57 static FaultName _name;
58 static FaultVect _vect;
59 static FaultStat _count;
61 FaultName name() {return _name;}
62 FaultVect vect() {return _vect;}
63 FaultStat & countStat() {return _count;}
64 bool isMachineCheckFault() {return true;}
67 class AlignmentFault : public MipsFault
70 static FaultName _name;
71 static FaultVect _vect;
72 static FaultStat _count;
74 FaultName name() {return _name;}
75 FaultVect vect() {return _vect;}
76 FaultStat & countStat() {return _count;}
77 bool isAlignmentFault() {return true;}
80 static inline Fault genMachineCheckFault()
82 return new MachineCheckFault;
85 static inline Fault genAlignmentFault()
87 return new AlignmentFault;
90 class ResetFault : public MipsFault
93 static FaultName _name;
94 static FaultVect _vect;
95 static FaultStat _count;
97 FaultName name() {return _name;}
98 FaultVect vect() {return _vect;}
99 FaultStat & countStat() {return _count;}
102 class ArithmeticFault : public MipsFault
105 bool skipFaultingInstruction() {return true;}
107 static FaultName _name;
108 static FaultVect _vect;
109 static FaultStat _count;
111 FaultName name() {return _name;}
112 FaultVect vect() {return _vect;}
113 FaultStat & countStat() {return _count;}
115 void invoke(ExecContext * xc);
119 class InterruptFault : public MipsFault
122 bool setRestartAddress() {return false;}
124 static FaultName _name;
125 static FaultVect _vect;
126 static FaultStat _count;
128 FaultName name() {return _name;}
129 FaultVect vect() {return _vect;}
130 FaultStat & countStat() {return _count;}
133 class NDtbMissFault : public MipsFault
136 static FaultName _name;
137 static FaultVect _vect;
138 static FaultStat _count;
140 FaultName name() {return _name;}
141 FaultVect vect() {return _vect;}
142 FaultStat & countStat() {return _count;}
145 class PDtbMissFault : public MipsFault
148 static FaultName _name;
149 static FaultVect _vect;
150 static FaultStat _count;
152 FaultName name() {return _name;}
153 FaultVect vect() {return _vect;}
154 FaultStat & countStat() {return _count;}
157 class DtbPageFault : public MipsFault
160 static FaultName _name;
161 static FaultVect _vect;
162 static FaultStat _count;
164 FaultName name() {return _name;}
165 FaultVect vect() {return _vect;}
166 FaultStat & countStat() {return _count;}
169 class DtbAcvFault : public MipsFault
172 static FaultName _name;
173 static FaultVect _vect;
174 static FaultStat _count;
176 FaultName name() {return _name;}
177 FaultVect vect() {return _vect;}
178 FaultStat & countStat() {return _count;}
181 class ItbMissFault : public MipsFault
184 static FaultName _name;
185 static FaultVect _vect;
186 static FaultStat _count;
188 FaultName name() {return _name;}
189 FaultVect vect() {return _vect;}
190 FaultStat & countStat() {return _count;}
193 class ItbPageFault : public MipsFault
196 static FaultName _name;
197 static FaultVect _vect;
198 static FaultStat _count;
200 FaultName name() {return _name;}
201 FaultVect vect() {return _vect;}
202 FaultStat & countStat() {return _count;}
205 class ItbAcvFault : public MipsFault
208 static FaultName _name;
209 static FaultVect _vect;
210 static FaultStat _count;
212 FaultName name() {return _name;}
213 FaultVect vect() {return _vect;}
214 FaultStat & countStat() {return _count;}
217 class UnimplementedOpcodeFault : public MipsFault
220 static FaultName _name;
221 static FaultVect _vect;
222 static FaultStat _count;
224 FaultName name() {return _name;}
225 FaultVect vect() {return _vect;}
226 FaultStat & countStat() {return _count;}
229 class FloatEnableFault : public MipsFault
232 static FaultName _name;
233 static FaultVect _vect;
234 static FaultStat _count;
236 FaultName name() {return _name;}
237 FaultVect vect() {return _vect;}
238 FaultStat & countStat() {return _count;}
241 class PalFault : public MipsFault
244 bool skipFaultingInstruction() {return true;}
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 IntegerOverflowFault : 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 } // MipsISA namespace
269 #endif // __FAULTS_HH__