faults.hh (4695:a63378aed062) faults.hh (5004:7d94cedab264)
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
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.
15 *
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.
27 *
28 * Authors: Gabe Black
29 * Korey Sewell
30 */
31
32#ifndef __MIPS_FAULTS_HH__
33#define __MIPS_FAULTS_HH__
34
35#include "sim/faults.hh"
36
37// The design of the "name" and "vect" functions is in sim/faults.hh
38
39namespace MipsISA
40{
41
42typedef const Addr FaultVect;
43
44class MipsFault : public FaultBase
45{
46 protected:
47 virtual bool skipFaultingInstruction() {return false;}
48 virtual bool setRestartAddress() {return true;}
49 public:
50#if FULL_SYSTEM
51 void invoke(ThreadContext * tc);
52#endif
53 virtual FaultVect vect() = 0;
54 virtual FaultStat & countStat() = 0;
55};
56
57class MachineCheckFault : public MipsFault
58{
59 private:
60 static FaultName _name;
61 static FaultVect _vect;
62 static FaultStat _count;
63 public:
64 FaultName name() const {return _name;}
65 FaultVect vect() {return _vect;}
66 FaultStat & countStat() {return _count;}
67 bool isMachineCheckFault() const {return true;}
68};
69
70class AlignmentFault : public MipsFault
71{
72 private:
73 static FaultName _name;
74 static FaultVect _vect;
75 static FaultStat _count;
76 public:
77 FaultName name() const {return _name;}
78 FaultVect vect() {return _vect;}
79 FaultStat & countStat() {return _count;}
80 bool isAlignmentFault() const {return true;}
81};
82
83class UnimplementedOpcodeFault : public MipsFault
84{
85 private:
86 static FaultName _name;
87 static FaultVect _vect;
88 static FaultStat _count;
89 public:
90 FaultName name() const {return _name;}
91 FaultVect vect() {return _vect;}
92 FaultStat & countStat() {return _count;}
93};
94
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
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.
15 *
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.
27 *
28 * Authors: Gabe Black
29 * Korey Sewell
30 */
31
32#ifndef __MIPS_FAULTS_HH__
33#define __MIPS_FAULTS_HH__
34
35#include "sim/faults.hh"
36
37// The design of the "name" and "vect" functions is in sim/faults.hh
38
39namespace MipsISA
40{
41
42typedef const Addr FaultVect;
43
44class MipsFault : public FaultBase
45{
46 protected:
47 virtual bool skipFaultingInstruction() {return false;}
48 virtual bool setRestartAddress() {return true;}
49 public:
50#if FULL_SYSTEM
51 void invoke(ThreadContext * tc);
52#endif
53 virtual FaultVect vect() = 0;
54 virtual FaultStat & countStat() = 0;
55};
56
57class MachineCheckFault : public MipsFault
58{
59 private:
60 static FaultName _name;
61 static FaultVect _vect;
62 static FaultStat _count;
63 public:
64 FaultName name() const {return _name;}
65 FaultVect vect() {return _vect;}
66 FaultStat & countStat() {return _count;}
67 bool isMachineCheckFault() const {return true;}
68};
69
70class AlignmentFault : public MipsFault
71{
72 private:
73 static FaultName _name;
74 static FaultVect _vect;
75 static FaultStat _count;
76 public:
77 FaultName name() const {return _name;}
78 FaultVect vect() {return _vect;}
79 FaultStat & countStat() {return _count;}
80 bool isAlignmentFault() const {return true;}
81};
82
83class UnimplementedOpcodeFault : public MipsFault
84{
85 private:
86 static FaultName _name;
87 static FaultVect _vect;
88 static FaultStat _count;
89 public:
90 FaultName name() const {return _name;}
91 FaultVect vect() {return _vect;}
92 FaultStat & countStat() {return _count;}
93};
94
95#if !FULL_SYSTEM
96//class PageTableFault : public MipsFault
97//{
98//private:
99// Addr vaddr;
100// static FaultName _name;
101// static FaultVect _vect;
102// static FaultStat _count;
103//public:
104// PageTableFault(Addr va)
105// : vaddr(va) {}
106// FaultName name() {return _name;}
107// FaultVect vect() {return _vect;}
108// FaultStat & countStat() {return _count;}
109// void invoke(ThreadContext * tc);
110//};
111
112static inline Fault genPageTableFault(Addr va)
113{
114 return new PageTableFault(va);
115}
116#endif
117
118
119static inline Fault genMachineCheckFault()
120{
121 return new MachineCheckFault;
122}
123
95static inline Fault genMachineCheckFault()
96{
97 return new MachineCheckFault;
98}
99
124static inline Fault genAlignmentFault()
125{
126 return new AlignmentFault;
127}
128
129class ResetFault : public MipsFault
130{
131 private:
132 static FaultName _name;
133 static FaultVect _vect;
134 static FaultStat _count;
135 public:
136 FaultName name() const {return _name;}
137 FaultVect vect() {return _vect;}
138 FaultStat & countStat() {return _count;}
139 void invoke(ThreadContext * tc);
140};
141
142class CoprocessorUnusableFault : public MipsFault
143{
144 private:
145 static FaultName _name;
146 static FaultVect _vect;
147 static FaultStat _count;
148 public:
149 FaultName name() const {return _name;}
150 FaultVect vect() {return _vect;}
151 FaultStat & countStat() {return _count;}
152 void invoke(ThreadContext * tc);
153};
154
155class ReservedInstructionFault : public MipsFault
156{
157 private:
158 static FaultName _name;
159 static FaultVect _vect;
160 static FaultStat _count;
161 public:
162 FaultName name() const {return _name;}
163 FaultVect vect() {return _vect;}
164 FaultStat & countStat() {return _count;}
165 void invoke(ThreadContext * tc);
166};
167
168class ThreadFault : public MipsFault
169{
170 private:
171 static FaultName _name;
172 static FaultVect _vect;
173 static FaultStat _count;
174 public:
175 FaultName name() const {return _name;}
176 FaultVect vect() {return _vect;}
177 FaultStat & countStat() {return _count;}
178 void invoke(ThreadContext * tc);
179};
180
181
182class ArithmeticFault : public MipsFault
183{
184 protected:
185 bool skipFaultingInstruction() {return true;}
186 private:
187 static FaultName _name;
188 static FaultVect _vect;
189 static FaultStat _count;
190 public:
191 FaultName name() const {return _name;}
192 FaultVect vect() {return _vect;}
193 FaultStat & countStat() {return _count;}
194#if FULL_SYSTEM
195 void invoke(ThreadContext * tc);
196#endif
197};
198
199class InterruptFault : public MipsFault
200{
201 protected:
202 bool setRestartAddress() {return false;}
203 private:
204 static FaultName _name;
205 static FaultVect _vect;
206 static FaultStat _count;
207 public:
208 FaultName name() const {return _name;}
209 FaultVect vect() {return _vect;}
210 FaultStat & countStat() {return _count;}
211};
212
213class NDtbMissFault : public MipsFault
214{
215 private:
216 static FaultName _name;
217 static FaultVect _vect;
218 static FaultStat _count;
219 public:
220 FaultName name() const {return _name;}
221 FaultVect vect() {return _vect;}
222 FaultStat & countStat() {return _count;}
223};
224
225class PDtbMissFault : public MipsFault
226{
227 private:
228 static FaultName _name;
229 static FaultVect _vect;
230 static FaultStat _count;
231 public:
232 FaultName name() const {return _name;}
233 FaultVect vect() {return _vect;}
234 FaultStat & countStat() {return _count;}
235};
236
237class DtbPageFault : public MipsFault
238{
239 private:
240 static FaultName _name;
241 static FaultVect _vect;
242 static FaultStat _count;
243 public:
244 FaultName name() const {return _name;}
245 FaultVect vect() {return _vect;}
246 FaultStat & countStat() {return _count;}
247};
248
249class DtbAcvFault : public MipsFault
250{
251 private:
252 static FaultName _name;
253 static FaultVect _vect;
254 static FaultStat _count;
255 public:
256 FaultName name() const {return _name;}
257 FaultVect vect() {return _vect;}
258 FaultStat & countStat() {return _count;}
259};
260
261class ItbMissFault : public MipsFault
262{
263 private:
264 static FaultName _name;
265 static FaultVect _vect;
266 static FaultStat _count;
267 public:
268 FaultName name() const {return _name;}
269 FaultVect vect() {return _vect;}
270 FaultStat & countStat() {return _count;}
271};
272
273class ItbPageFault : public MipsFault
274{
275 private:
276 static FaultName _name;
277 static FaultVect _vect;
278 static FaultStat _count;
279 public:
280 FaultName name() const {return _name;}
281 FaultVect vect() {return _vect;}
282 FaultStat & countStat() {return _count;}
283};
284
285class ItbAcvFault : public MipsFault
286{
287 private:
288 static FaultName _name;
289 static FaultVect _vect;
290 static FaultStat _count;
291 public:
292 FaultName name() const {return _name;}
293 FaultVect vect() {return _vect;}
294 FaultStat & countStat() {return _count;}
295};
296
297class FloatEnableFault : public MipsFault
298{
299 private:
300 static FaultName _name;
301 static FaultVect _vect;
302 static FaultStat _count;
303 public:
304 FaultName name() const {return _name;}
305 FaultVect vect() {return _vect;}
306 FaultStat & countStat() {return _count;}
307};
308
309class IntegerOverflowFault : public MipsFault
310{
311 private:
312 static FaultName _name;
313 static FaultVect _vect;
314 static FaultStat _count;
315 public:
316 FaultName name() const {return _name;}
317 FaultVect vect() {return _vect;}
318 FaultStat & countStat() {return _count;}
319};
320
321class DspStateDisabledFault : public MipsFault
322{
323 private:
324 static FaultName _name;
325 static FaultVect _vect;
326 static FaultStat _count;
327 public:
328 FaultName name() const {return _name;}
329 FaultVect vect() {return _vect;}
330 FaultStat & countStat() {return _count;}
331 void invoke(ThreadContext * tc);
332};
333
334} // MipsISA namespace
335
336#endif // __FAULTS_HH__
100class ResetFault : public MipsFault
101{
102 private:
103 static FaultName _name;
104 static FaultVect _vect;
105 static FaultStat _count;
106 public:
107 FaultName name() const {return _name;}
108 FaultVect vect() {return _vect;}
109 FaultStat & countStat() {return _count;}
110 void invoke(ThreadContext * tc);
111};
112
113class CoprocessorUnusableFault : public MipsFault
114{
115 private:
116 static FaultName _name;
117 static FaultVect _vect;
118 static FaultStat _count;
119 public:
120 FaultName name() const {return _name;}
121 FaultVect vect() {return _vect;}
122 FaultStat & countStat() {return _count;}
123 void invoke(ThreadContext * tc);
124};
125
126class ReservedInstructionFault : public MipsFault
127{
128 private:
129 static FaultName _name;
130 static FaultVect _vect;
131 static FaultStat _count;
132 public:
133 FaultName name() const {return _name;}
134 FaultVect vect() {return _vect;}
135 FaultStat & countStat() {return _count;}
136 void invoke(ThreadContext * tc);
137};
138
139class ThreadFault : public MipsFault
140{
141 private:
142 static FaultName _name;
143 static FaultVect _vect;
144 static FaultStat _count;
145 public:
146 FaultName name() const {return _name;}
147 FaultVect vect() {return _vect;}
148 FaultStat & countStat() {return _count;}
149 void invoke(ThreadContext * tc);
150};
151
152
153class ArithmeticFault : public MipsFault
154{
155 protected:
156 bool skipFaultingInstruction() {return true;}
157 private:
158 static FaultName _name;
159 static FaultVect _vect;
160 static FaultStat _count;
161 public:
162 FaultName name() const {return _name;}
163 FaultVect vect() {return _vect;}
164 FaultStat & countStat() {return _count;}
165#if FULL_SYSTEM
166 void invoke(ThreadContext * tc);
167#endif
168};
169
170class InterruptFault : public MipsFault
171{
172 protected:
173 bool setRestartAddress() {return false;}
174 private:
175 static FaultName _name;
176 static FaultVect _vect;
177 static FaultStat _count;
178 public:
179 FaultName name() const {return _name;}
180 FaultVect vect() {return _vect;}
181 FaultStat & countStat() {return _count;}
182};
183
184class NDtbMissFault : public MipsFault
185{
186 private:
187 static FaultName _name;
188 static FaultVect _vect;
189 static FaultStat _count;
190 public:
191 FaultName name() const {return _name;}
192 FaultVect vect() {return _vect;}
193 FaultStat & countStat() {return _count;}
194};
195
196class PDtbMissFault : public MipsFault
197{
198 private:
199 static FaultName _name;
200 static FaultVect _vect;
201 static FaultStat _count;
202 public:
203 FaultName name() const {return _name;}
204 FaultVect vect() {return _vect;}
205 FaultStat & countStat() {return _count;}
206};
207
208class DtbPageFault : public MipsFault
209{
210 private:
211 static FaultName _name;
212 static FaultVect _vect;
213 static FaultStat _count;
214 public:
215 FaultName name() const {return _name;}
216 FaultVect vect() {return _vect;}
217 FaultStat & countStat() {return _count;}
218};
219
220class DtbAcvFault : public MipsFault
221{
222 private:
223 static FaultName _name;
224 static FaultVect _vect;
225 static FaultStat _count;
226 public:
227 FaultName name() const {return _name;}
228 FaultVect vect() {return _vect;}
229 FaultStat & countStat() {return _count;}
230};
231
232class ItbMissFault : public MipsFault
233{
234 private:
235 static FaultName _name;
236 static FaultVect _vect;
237 static FaultStat _count;
238 public:
239 FaultName name() const {return _name;}
240 FaultVect vect() {return _vect;}
241 FaultStat & countStat() {return _count;}
242};
243
244class ItbPageFault : public MipsFault
245{
246 private:
247 static FaultName _name;
248 static FaultVect _vect;
249 static FaultStat _count;
250 public:
251 FaultName name() const {return _name;}
252 FaultVect vect() {return _vect;}
253 FaultStat & countStat() {return _count;}
254};
255
256class ItbAcvFault : public MipsFault
257{
258 private:
259 static FaultName _name;
260 static FaultVect _vect;
261 static FaultStat _count;
262 public:
263 FaultName name() const {return _name;}
264 FaultVect vect() {return _vect;}
265 FaultStat & countStat() {return _count;}
266};
267
268class FloatEnableFault : public MipsFault
269{
270 private:
271 static FaultName _name;
272 static FaultVect _vect;
273 static FaultStat _count;
274 public:
275 FaultName name() const {return _name;}
276 FaultVect vect() {return _vect;}
277 FaultStat & countStat() {return _count;}
278};
279
280class IntegerOverflowFault : public MipsFault
281{
282 private:
283 static FaultName _name;
284 static FaultVect _vect;
285 static FaultStat _count;
286 public:
287 FaultName name() const {return _name;}
288 FaultVect vect() {return _vect;}
289 FaultStat & countStat() {return _count;}
290};
291
292class DspStateDisabledFault : public MipsFault
293{
294 private:
295 static FaultName _name;
296 static FaultVect _vect;
297 static FaultStat _count;
298 public:
299 FaultName name() const {return _name;}
300 FaultVect vect() {return _vect;}
301 FaultStat & countStat() {return _count;}
302 void invoke(ThreadContext * tc);
303};
304
305} // MipsISA namespace
306
307#endif // __FAULTS_HH__