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.
29 #ifndef __ALPHA_FAULTS_HH__
30 #define __ALPHA_FAULTS_HH__
32 #include "sim/faults.hh"
34 // The design of the "name" and "vect" functions is in sim/faults.hh
39 typedef const Addr FaultVect;
41 class AlphaFault : public virtual FaultBase
44 virtual bool skipFaultingInstruction() {return false;}
45 virtual bool setRestartAddress() {return true;}
48 void invoke(ExecContext * xc);
50 virtual FaultVect vect() = 0;
53 class MachineCheckFault : public AlphaFault
56 static FaultName _name;
57 static FaultVect _vect;
58 static FaultStat _stat;
60 FaultName name() {return _name;}
61 FaultVect vect() {return _vect;}
62 FaultStat & stat() {return _stat;}
63 bool isMachineCheckFault() {return true;}
66 class AlignmentFault : public AlphaFault
69 static FaultName _name;
70 static FaultVect _vect;
71 static FaultStat _stat;
73 FaultName name() {return _name;}
74 FaultVect vect() {return _vect;}
75 FaultStat & stat() {return _stat;}
76 bool isAlignmentFault() {return true;}
79 static inline Fault genMachineCheckFault()
81 return new MachineCheckFault;
84 static inline Fault genAlignmentFault()
86 return new AlignmentFault;
89 class ResetFault : public AlphaFault
92 static FaultName _name;
93 static FaultVect _vect;
94 static FaultStat _stat;
96 FaultName name() {return _name;}
97 FaultVect vect() {return _vect;}
98 FaultStat & stat() {return _stat;}
101 class ArithmeticFault : public AlphaFault
104 bool skipFaultingInstruction() {return true;}
106 static FaultName _name;
107 static FaultVect _vect;
108 static FaultStat _stat;
110 FaultName name() {return _name;}
111 FaultVect vect() {return _vect;}
112 FaultStat & stat() {return _stat;}
114 void invoke(ExecContext * xc);
118 class InterruptFault : public AlphaFault
121 bool setRestartAddress() {return false;}
123 static FaultName _name;
124 static FaultVect _vect;
125 static FaultStat _stat;
127 FaultName name() {return _name;}
128 FaultVect vect() {return _vect;}
129 FaultStat & stat() {return _stat;}
132 class NDtbMissFault : public AlphaFault
135 static FaultName _name;
136 static FaultVect _vect;
137 static FaultStat _stat;
139 FaultName name() {return _name;}
140 FaultVect vect() {return _vect;}
141 FaultStat & stat() {return _stat;}
144 class PDtbMissFault : public AlphaFault
147 static FaultName _name;
148 static FaultVect _vect;
149 static FaultStat _stat;
151 FaultName name() {return _name;}
152 FaultVect vect() {return _vect;}
153 FaultStat & stat() {return _stat;}
156 class DtbPageFault : public AlphaFault
159 static FaultName _name;
160 static FaultVect _vect;
161 static FaultStat _stat;
163 FaultName name() {return _name;}
164 FaultVect vect() {return _vect;}
165 FaultStat & stat() {return _stat;}
168 class DtbAcvFault : public AlphaFault
171 static FaultName _name;
172 static FaultVect _vect;
173 static FaultStat _stat;
175 FaultName name() {return _name;}
176 FaultVect vect() {return _vect;}
177 FaultStat & stat() {return _stat;}
180 class ItbMissFault : public AlphaFault
183 static FaultName _name;
184 static FaultVect _vect;
185 static FaultStat _stat;
187 FaultName name() {return _name;}
188 FaultVect vect() {return _vect;}
189 FaultStat & stat() {return _stat;}
192 class ItbPageFault : public AlphaFault
195 static FaultName _name;
196 static FaultVect _vect;
197 static FaultStat _stat;
199 FaultName name() {return _name;}
200 FaultVect vect() {return _vect;}
201 FaultStat & stat() {return _stat;}
204 class ItbAcvFault : public AlphaFault
207 static FaultName _name;
208 static FaultVect _vect;
209 static FaultStat _stat;
211 FaultName name() {return _name;}
212 FaultVect vect() {return _vect;}
213 FaultStat & stat() {return _stat;}
216 class UnimplementedOpcodeFault : public AlphaFault
219 static FaultName _name;
220 static FaultVect _vect;
221 static FaultStat _stat;
223 FaultName name() {return _name;}
224 FaultVect vect() {return _vect;}
225 FaultStat & stat() {return _stat;}
228 class FloatEnableFault : public AlphaFault
231 static FaultName _name;
232 static FaultVect _vect;
233 static FaultStat _stat;
235 FaultName name() {return _name;}
236 FaultVect vect() {return _vect;}
237 FaultStat & stat() {return _stat;}
240 class PalFault : public AlphaFault
243 bool skipFaultingInstruction() {return true;}
245 static FaultName _name;
246 static FaultVect _vect;
247 static FaultStat _stat;
249 FaultName name() {return _name;}
250 FaultVect vect() {return _vect;}
251 FaultStat & stat() {return _stat;}
254 class IntegerOverflowFault : public AlphaFault
257 static FaultName _name;
258 static FaultVect _vect;
259 static FaultStat _stat;
261 FaultName name() {return _name;}
262 FaultVect vect() {return _vect;}
263 FaultStat & stat() {return _stat;}
266 } // AlphaISA namespace
268 #endif // __FAULTS_HH__