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 __ALPHA_FAULTS_HH__
33 #define __ALPHA_FAULTS_HH__
35 #include "config/full_system.hh"
36 #include "sim/faults.hh"
39 #include "arch/alpha/pagetable.hh"
42 // The design of the "name" and "vect" functions is in sim/faults.hh
47 typedef const Addr FaultVect;
49 class AlphaFault : public FaultBase
52 virtual bool skipFaultingInstruction() {return false;}
53 virtual bool setRestartAddress() {return true;}
56 void invoke(ThreadContext * tc);
58 virtual FaultVect vect() = 0;
59 virtual FaultStat & countStat() = 0;
62 class MachineCheckFault : public AlphaFault
65 static FaultName _name;
66 static FaultVect _vect;
67 static FaultStat _count;
69 FaultName name() {return _name;}
70 FaultVect vect() {return _vect;}
71 FaultStat & countStat() {return _count;}
72 bool isMachineCheckFault() {return true;}
75 class AlignmentFault : public AlphaFault
78 static FaultName _name;
79 static FaultVect _vect;
80 static FaultStat _count;
82 FaultName name() {return _name;}
83 FaultVect vect() {return _vect;}
84 FaultStat & countStat() {return _count;}
85 bool isAlignmentFault() {return true;}
89 class PageTableFault : public AlphaFault
93 static FaultName _name;
94 static FaultVect _vect;
95 static FaultStat _count;
97 PageTableFault(Addr va)
99 FaultName name() {return _name;}
100 FaultVect vect() {return _vect;}
101 FaultStat & countStat() {return _count;}
102 void invoke(ThreadContext * tc);
105 static inline Fault genPageTableFault(Addr va)
107 return new PageTableFault(va);
111 static inline Fault genMachineCheckFault()
113 return new MachineCheckFault;
116 static inline Fault genAlignmentFault()
118 return new AlignmentFault;
121 class ResetFault : public AlphaFault
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 ArithmeticFault : public AlphaFault
136 bool skipFaultingInstruction() {return true;}
138 static FaultName _name;
139 static FaultVect _vect;
140 static FaultStat _count;
142 FaultName name() {return _name;}
143 FaultVect vect() {return _vect;}
144 FaultStat & countStat() {return _count;}
146 void invoke(ThreadContext * tc);
150 class InterruptFault : public AlphaFault
153 bool setRestartAddress() {return false;}
155 static FaultName _name;
156 static FaultVect _vect;
157 static FaultStat _count;
159 FaultName name() {return _name;}
160 FaultVect vect() {return _vect;}
161 FaultStat & countStat() {return _count;}
164 class DtbFault : public AlphaFault
168 AlphaISA::VAddr vaddr;
172 DtbFault(AlphaISA::VAddr _vaddr, uint32_t _reqFlags, uint64_t _flags)
173 : vaddr(_vaddr), reqFlags(_reqFlags), flags(_flags)
176 FaultName name() = 0;
177 FaultVect vect() = 0;
178 FaultStat & countStat() = 0;
180 void invoke(ThreadContext * tc);
184 class NDtbMissFault : public DtbFault
187 static FaultName _name;
188 static FaultVect _vect;
189 static FaultStat _count;
192 NDtbMissFault(AlphaISA::VAddr vaddr, uint32_t reqFlags, uint64_t flags)
193 : DtbFault(vaddr, reqFlags, flags)
196 FaultName name() {return _name;}
197 FaultVect vect() {return _vect;}
198 FaultStat & countStat() {return _count;}
201 class PDtbMissFault : public DtbFault
204 static FaultName _name;
205 static FaultVect _vect;
206 static FaultStat _count;
209 PDtbMissFault(AlphaISA::VAddr vaddr, uint32_t reqFlags, uint64_t flags)
210 : DtbFault(vaddr, reqFlags, flags)
213 FaultName name() {return _name;}
214 FaultVect vect() {return _vect;}
215 FaultStat & countStat() {return _count;}
218 class DtbPageFault : public DtbFault
221 static FaultName _name;
222 static FaultVect _vect;
223 static FaultStat _count;
226 DtbPageFault(AlphaISA::VAddr vaddr, uint32_t reqFlags, uint64_t flags)
227 : DtbFault(vaddr, reqFlags, flags)
230 FaultName name() {return _name;}
231 FaultVect vect() {return _vect;}
232 FaultStat & countStat() {return _count;}
235 class DtbAcvFault : public DtbFault
238 static FaultName _name;
239 static FaultVect _vect;
240 static FaultStat _count;
243 DtbAcvFault(AlphaISA::VAddr vaddr, uint32_t reqFlags, uint64_t flags)
244 : DtbFault(vaddr, reqFlags, flags)
247 FaultName name() {return _name;}
248 FaultVect vect() {return _vect;}
249 FaultStat & countStat() {return _count;}
252 class DtbAlignmentFault : public DtbFault
255 static FaultName _name;
256 static FaultVect _vect;
257 static FaultStat _count;
260 DtbAlignmentFault(AlphaISA::VAddr vaddr, uint32_t reqFlags, uint64_t flags)
261 : DtbFault(vaddr, reqFlags, flags)
264 FaultName name() {return _name;}
265 FaultVect vect() {return _vect;}
266 FaultStat & countStat() {return _count;}
269 class ItbFault : public AlphaFault
277 FaultName name() = 0;
278 FaultVect vect() = 0;
279 FaultStat & countStat() = 0;
281 void invoke(ThreadContext * tc);
285 class ItbMissFault : public ItbFault
288 static FaultName _name;
289 static FaultVect _vect;
290 static FaultStat _count;
292 ItbMissFault(Addr pc)
295 FaultName name() {return _name;}
296 FaultVect vect() {return _vect;}
297 FaultStat & countStat() {return _count;}
300 class ItbPageFault : public ItbFault
303 static FaultName _name;
304 static FaultVect _vect;
305 static FaultStat _count;
307 ItbPageFault(Addr pc)
310 FaultName name() {return _name;}
311 FaultVect vect() {return _vect;}
312 FaultStat & countStat() {return _count;}
315 class ItbAcvFault : public ItbFault
318 static FaultName _name;
319 static FaultVect _vect;
320 static FaultStat _count;
325 FaultName name() {return _name;}
326 FaultVect vect() {return _vect;}
327 FaultStat & countStat() {return _count;}
330 class UnimplementedOpcodeFault : public AlphaFault
333 static FaultName _name;
334 static FaultVect _vect;
335 static FaultStat _count;
337 FaultName name() {return _name;}
338 FaultVect vect() {return _vect;}
339 FaultStat & countStat() {return _count;}
342 class FloatEnableFault : public AlphaFault
345 static FaultName _name;
346 static FaultVect _vect;
347 static FaultStat _count;
349 FaultName name() {return _name;}
350 FaultVect vect() {return _vect;}
351 FaultStat & countStat() {return _count;}
354 class PalFault : public AlphaFault
357 bool skipFaultingInstruction() {return true;}
359 static FaultName _name;
360 static FaultVect _vect;
361 static FaultStat _count;
363 FaultName name() {return _name;}
364 FaultVect vect() {return _vect;}
365 FaultStat & countStat() {return _count;}
368 class IntegerOverflowFault : public AlphaFault
371 static FaultName _name;
372 static FaultVect _vect;
373 static FaultStat _count;
375 FaultName name() {return _name;}
376 FaultVect vect() {return _vect;}
377 FaultStat & countStat() {return _count;}
380 } // AlphaISA namespace
382 #endif // __FAULTS_HH__