faults.hh (4183:3d19c1d46946) faults.hh (4661:44458219add1)
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() {return _name;}
65 FaultVect vect() {return _vect;}
66 FaultStat & countStat() {return _count;}
67 bool isMachineCheckFault() {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() {return _name;}
78 FaultVect vect() {return _vect;}
79 FaultStat & countStat() {return _count;}
80 bool isAlignmentFault() {return true;}
81};
82
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() {return _name;}
65 FaultVect vect() {return _vect;}
66 FaultStat & countStat() {return _count;}
67 bool isMachineCheckFault() {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() {return _name;}
78 FaultVect vect() {return _vect;}
79 FaultStat & countStat() {return _count;}
80 bool isAlignmentFault() {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() {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
83static inline Fault genMachineCheckFault()
84{
85 return new MachineCheckFault;
86}
87
88static inline Fault genAlignmentFault()
89{
90 return new AlignmentFault;
91}
92
93class ResetFault : public MipsFault
94{
95 private:
96 static FaultName _name;
97 static FaultVect _vect;
98 static FaultStat _count;
99 public:
100 FaultName name() {return _name;}
101 FaultVect vect() {return _vect;}
102 FaultStat & countStat() {return _count;}
119static inline Fault genMachineCheckFault()
120{
121 return new MachineCheckFault;
122}
123
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() {return _name;}
137 FaultVect vect() {return _vect;}
138 FaultStat & countStat() {return _count;}
139 void invoke(ThreadContext * tc);
103};
104
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() {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() {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() {return _name;}
176 FaultVect vect() {return _vect;}
177 FaultStat & countStat() {return _count;}
178 void invoke(ThreadContext * tc);
179};
180
181
105class ArithmeticFault : public MipsFault
106{
107 protected:
108 bool skipFaultingInstruction() {return true;}
109 private:
110 static FaultName _name;
111 static FaultVect _vect;
112 static FaultStat _count;
113 public:
114 FaultName name() {return _name;}
115 FaultVect vect() {return _vect;}
116 FaultStat & countStat() {return _count;}
117#if FULL_SYSTEM
118 void invoke(ThreadContext * tc);
119#endif
120};
121
122class InterruptFault : public MipsFault
123{
124 protected:
125 bool setRestartAddress() {return false;}
126 private:
127 static FaultName _name;
128 static FaultVect _vect;
129 static FaultStat _count;
130 public:
131 FaultName name() {return _name;}
132 FaultVect vect() {return _vect;}
133 FaultStat & countStat() {return _count;}
134};
135
136class NDtbMissFault : public MipsFault
137{
138 private:
139 static FaultName _name;
140 static FaultVect _vect;
141 static FaultStat _count;
142 public:
143 FaultName name() {return _name;}
144 FaultVect vect() {return _vect;}
145 FaultStat & countStat() {return _count;}
146};
147
148class PDtbMissFault : public MipsFault
149{
150 private:
151 static FaultName _name;
152 static FaultVect _vect;
153 static FaultStat _count;
154 public:
155 FaultName name() {return _name;}
156 FaultVect vect() {return _vect;}
157 FaultStat & countStat() {return _count;}
158};
159
160class DtbPageFault : public MipsFault
161{
162 private:
163 static FaultName _name;
164 static FaultVect _vect;
165 static FaultStat _count;
166 public:
167 FaultName name() {return _name;}
168 FaultVect vect() {return _vect;}
169 FaultStat & countStat() {return _count;}
170};
171
172class DtbAcvFault : public MipsFault
173{
174 private:
175 static FaultName _name;
176 static FaultVect _vect;
177 static FaultStat _count;
178 public:
179 FaultName name() {return _name;}
180 FaultVect vect() {return _vect;}
181 FaultStat & countStat() {return _count;}
182};
183
184class ItbMissFault : public MipsFault
185{
186 private:
187 static FaultName _name;
188 static FaultVect _vect;
189 static FaultStat _count;
190 public:
191 FaultName name() {return _name;}
192 FaultVect vect() {return _vect;}
193 FaultStat & countStat() {return _count;}
194};
195
196class ItbPageFault : public MipsFault
197{
198 private:
199 static FaultName _name;
200 static FaultVect _vect;
201 static FaultStat _count;
202 public:
203 FaultName name() {return _name;}
204 FaultVect vect() {return _vect;}
205 FaultStat & countStat() {return _count;}
206};
207
208class ItbAcvFault : public MipsFault
209{
210 private:
211 static FaultName _name;
212 static FaultVect _vect;
213 static FaultStat _count;
214 public:
215 FaultName name() {return _name;}
216 FaultVect vect() {return _vect;}
217 FaultStat & countStat() {return _count;}
218};
219
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() {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() {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() {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() {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() {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() {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() {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() {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() {return _name;}
293 FaultVect vect() {return _vect;}
294 FaultStat & countStat() {return _count;}
295};
296
220class UnimplementedOpcodeFault : public MipsFault
221{
222 private:
223 static FaultName _name;
224 static FaultVect _vect;
225 static FaultStat _count;
226 public:
227 FaultName name() {return _name;}
228 FaultVect vect() {return _vect;}
229 FaultStat & countStat() {return _count;}
230};
231
232class FloatEnableFault : public MipsFault
233{
234 private:
235 static FaultName _name;
236 static FaultVect _vect;
237 static FaultStat _count;
238 public:
239 FaultName name() {return _name;}
240 FaultVect vect() {return _vect;}
241 FaultStat & countStat() {return _count;}
242};
243
297class FloatEnableFault : public MipsFault
298{
299 private:
300 static FaultName _name;
301 static FaultVect _vect;
302 static FaultStat _count;
303 public:
304 FaultName name() {return _name;}
305 FaultVect vect() {return _vect;}
306 FaultStat & countStat() {return _count;}
307};
308
244class PalFault : public MipsFault
309class IntegerOverflowFault : public MipsFault
245{
310{
246 protected:
247 bool skipFaultingInstruction() {return true;}
248 private:
249 static FaultName _name;
250 static FaultVect _vect;
251 static FaultStat _count;
252 public:
253 FaultName name() {return _name;}
254 FaultVect vect() {return _vect;}
255 FaultStat & countStat() {return _count;}
256};
257
311 private:
312 static FaultName _name;
313 static FaultVect _vect;
314 static FaultStat _count;
315 public:
316 FaultName name() {return _name;}
317 FaultVect vect() {return _vect;}
318 FaultStat & countStat() {return _count;}
319};
320
258class IntegerOverflowFault : public MipsFault
321class DspStateDisabledFault : public MipsFault
259{
260 private:
261 static FaultName _name;
262 static FaultVect _vect;
263 static FaultStat _count;
264 public:
265 FaultName name() {return _name;}
266 FaultVect vect() {return _vect;}
267 FaultStat & countStat() {return _count;}
322{
323 private:
324 static FaultName _name;
325 static FaultVect _vect;
326 static FaultStat _count;
327 public:
328 FaultName name() {return _name;}
329 FaultVect vect() {return _vect;}
330 FaultStat & countStat() {return _count;}
331 void invoke(ThreadContext * tc);
268};
269
270} // MipsISA namespace
271
272#endif // __FAULTS_HH__
332};
333
334} // MipsISA namespace
335
336#endif // __FAULTS_HH__