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 "arch/alpha/isa_traits.hh"
36 #include "sim/faults.hh"
38 // The design of the "name" and "vect" functions is in sim/faults.hh
43 typedef const Addr FaultVect;
45 class AlphaFault : public FaultBase
48 virtual bool skipFaultingInstruction() {return false;}
49 virtual bool setRestartAddress() {return true;}
52 void invoke(ThreadContext * tc);
54 virtual FaultVect vect() = 0;
55 virtual FaultStat & countStat() = 0;
58 class MachineCheckFault : public AlphaFault
61 static FaultName _name;
62 static FaultVect _vect;
63 static FaultStat _count;
65 FaultName name() {return _name;}
66 FaultVect vect() {return _vect;}
67 FaultStat & countStat() {return _count;}
68 bool isMachineCheckFault() {return true;}
71 class AlignmentFault : public AlphaFault
74 static FaultName _name;
75 static FaultVect _vect;
76 static FaultStat _count;
78 FaultName name() {return _name;}
79 FaultVect vect() {return _vect;}
80 FaultStat & countStat() {return _count;}
81 bool isAlignmentFault() {return true;}
85 class PageTableFault : public AlphaFault
89 static FaultName _name;
90 static FaultVect _vect;
91 static FaultStat _count;
93 PageTableFault(Addr va)
95 FaultName name() {return _name;}
96 FaultVect vect() {return _vect;}
97 FaultStat & countStat() {return _count;}
98 void invoke(ThreadContext * tc);
101 static inline Fault genPageTableFault(Addr va)
103 return new PageTableFault(va);
107 static inline Fault genMachineCheckFault()
109 return new MachineCheckFault;
112 static inline Fault genAlignmentFault()
114 return new AlignmentFault;
117 class ResetFault : public AlphaFault
120 static FaultName _name;
121 static FaultVect _vect;
122 static FaultStat _count;
124 FaultName name() {return _name;}
125 FaultVect vect() {return _vect;}
126 FaultStat & countStat() {return _count;}
129 class ArithmeticFault : public AlphaFault
132 bool skipFaultingInstruction() {return true;}
134 static FaultName _name;
135 static FaultVect _vect;
136 static FaultStat _count;
138 FaultName name() {return _name;}
139 FaultVect vect() {return _vect;}
140 FaultStat & countStat() {return _count;}
142 void invoke(ThreadContext * tc);
146 class InterruptFault : public AlphaFault
149 bool setRestartAddress() {return false;}
151 static FaultName _name;
152 static FaultVect _vect;
153 static FaultStat _count;
155 FaultName name() {return _name;}
156 FaultVect vect() {return _vect;}
157 FaultStat & countStat() {return _count;}
160 class DtbFault : public AlphaFault
164 AlphaISA::VAddr vaddr;
168 DtbFault(AlphaISA::VAddr _vaddr, uint32_t _reqFlags, uint64_t _flags)
169 : vaddr(_vaddr), reqFlags(_reqFlags), flags(_flags)
172 FaultName name() = 0;
173 FaultVect vect() = 0;
174 FaultStat & countStat() = 0;
176 void invoke(ThreadContext * tc);
180 class NDtbMissFault : public DtbFault
183 static FaultName _name;
184 static FaultVect _vect;
185 static FaultStat _count;
188 NDtbMissFault(AlphaISA::VAddr vaddr, uint32_t reqFlags, uint64_t flags)
189 : DtbFault(vaddr, reqFlags, flags)
192 FaultName name() {return _name;}
193 FaultVect vect() {return _vect;}
194 FaultStat & countStat() {return _count;}
197 class PDtbMissFault : public DtbFault
200 static FaultName _name;
201 static FaultVect _vect;
202 static FaultStat _count;
205 PDtbMissFault(AlphaISA::VAddr vaddr, uint32_t reqFlags, uint64_t flags)
206 : DtbFault(vaddr, reqFlags, flags)
209 FaultName name() {return _name;}
210 FaultVect vect() {return _vect;}
211 FaultStat & countStat() {return _count;}
214 class DtbPageFault : public DtbFault
217 static FaultName _name;
218 static FaultVect _vect;
219 static FaultStat _count;
222 DtbPageFault(AlphaISA::VAddr vaddr, uint32_t reqFlags, uint64_t flags)
223 : DtbFault(vaddr, reqFlags, flags)
226 FaultName name() {return _name;}
227 FaultVect vect() {return _vect;}
228 FaultStat & countStat() {return _count;}
231 class DtbAcvFault : public DtbFault
234 static FaultName _name;
235 static FaultVect _vect;
236 static FaultStat _count;
239 DtbAcvFault(AlphaISA::VAddr vaddr, uint32_t reqFlags, uint64_t flags)
240 : DtbFault(vaddr, reqFlags, flags)
243 FaultName name() {return _name;}
244 FaultVect vect() {return _vect;}
245 FaultStat & countStat() {return _count;}
248 class DtbAlignmentFault : public DtbFault
251 static FaultName _name;
252 static FaultVect _vect;
253 static FaultStat _count;
256 DtbAlignmentFault(AlphaISA::VAddr vaddr, uint32_t reqFlags, uint64_t flags)
257 : DtbFault(vaddr, reqFlags, flags)
260 FaultName name() {return _name;}
261 FaultVect vect() {return _vect;}
262 FaultStat & countStat() {return _count;}
265 class ItbFault : public AlphaFault
273 FaultName name() = 0;
274 FaultVect vect() = 0;
275 FaultStat & countStat() = 0;
277 void invoke(ThreadContext * tc);
281 class ItbMissFault : public ItbFault
284 static FaultName _name;
285 static FaultVect _vect;
286 static FaultStat _count;
288 ItbMissFault(Addr pc)
291 FaultName name() {return _name;}
292 FaultVect vect() {return _vect;}
293 FaultStat & countStat() {return _count;}
296 class ItbPageFault : public ItbFault
299 static FaultName _name;
300 static FaultVect _vect;
301 static FaultStat _count;
303 ItbPageFault(Addr pc)
306 FaultName name() {return _name;}
307 FaultVect vect() {return _vect;}
308 FaultStat & countStat() {return _count;}
311 class ItbAcvFault : public ItbFault
314 static FaultName _name;
315 static FaultVect _vect;
316 static FaultStat _count;
321 FaultName name() {return _name;}
322 FaultVect vect() {return _vect;}
323 FaultStat & countStat() {return _count;}
326 class UnimplementedOpcodeFault : public AlphaFault
329 static FaultName _name;
330 static FaultVect _vect;
331 static FaultStat _count;
333 FaultName name() {return _name;}
334 FaultVect vect() {return _vect;}
335 FaultStat & countStat() {return _count;}
338 class FloatEnableFault : public AlphaFault
341 static FaultName _name;
342 static FaultVect _vect;
343 static FaultStat _count;
345 FaultName name() {return _name;}
346 FaultVect vect() {return _vect;}
347 FaultStat & countStat() {return _count;}
350 class PalFault : public AlphaFault
353 bool skipFaultingInstruction() {return true;}
355 static FaultName _name;
356 static FaultVect _vect;
357 static FaultStat _count;
359 FaultName name() {return _name;}
360 FaultVect vect() {return _vect;}
361 FaultStat & countStat() {return _count;}
364 class IntegerOverflowFault : public AlphaFault
367 static FaultName _name;
368 static FaultVect _vect;
369 static FaultStat _count;
371 FaultName name() {return _name;}
372 FaultVect vect() {return _vect;}
373 FaultStat & countStat() {return _count;}
376 } // AlphaISA namespace
378 #endif // __FAULTS_HH__