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