Cleaned up some of the Fault system.
[gem5.git] / arch / alpha / faults.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
29 #ifndef __ALPHA_FAULTS_HH__
30 #define __ALPHA_FAULTS_HH__
31
32 #include "sim/faults.hh"
33
34 // The design of the "name" and "vect" functions is in sim/faults.hh
35
36 namespace AlphaISA
37 {
38
39 typedef const Addr FaultVect;
40
41 class AlphaFault : public virtual FaultBase
42 {
43 protected:
44 virtual bool skipFaultingInstruction() {return false;}
45 virtual bool setRestartAddress() {return true;}
46 public:
47 #if FULL_SYSTEM
48 void invoke(ExecContext * xc);
49 #endif
50 virtual FaultVect vect() = 0;
51 };
52
53 class AlphaMachineCheckFault :
54 public MachineCheckFault,
55 public AlphaFault
56 {
57 private:
58 static FaultVect _vect;
59 static FaultStat _stat;
60 public:
61 FaultVect vect() {return _vect;}
62 FaultStat & stat() {return _stat;}
63 };
64
65 class AlphaAlignmentFault :
66 public AlignmentFault,
67 public AlphaFault
68 {
69 private:
70 static FaultVect _vect;
71 static FaultStat _stat;
72 public:
73 FaultVect vect() {return _vect;}
74 FaultStat & stat() {return _stat;}
75 };
76
77 static inline Fault genMachineCheckFault()
78 {
79 return new AlphaMachineCheckFault;
80 }
81
82 static inline Fault genAlignmentFault()
83 {
84 return new AlphaAlignmentFault;
85 }
86
87 class ResetFault : public AlphaFault
88 {
89 private:
90 static FaultName _name;
91 static FaultVect _vect;
92 static FaultStat _stat;
93 public:
94 FaultName name() {return _name;}
95 FaultVect vect() {return _vect;}
96 FaultStat & stat() {return _stat;}
97 };
98
99 class ArithmeticFault : public AlphaFault
100 {
101 protected:
102 bool skipFaultingInstruction() {return true;}
103 private:
104 static FaultName _name;
105 static FaultVect _vect;
106 static FaultStat _stat;
107 public:
108 FaultName name() {return _name;}
109 FaultVect vect() {return _vect;}
110 FaultStat & stat() {return _stat;}
111 void invoke(ExecContext * xc);
112 };
113
114 class InterruptFault : public AlphaFault
115 {
116 protected:
117 bool setRestartAddress() {return false;}
118 private:
119 static FaultName _name;
120 static FaultVect _vect;
121 static FaultStat _stat;
122 public:
123 FaultName name() {return _name;}
124 FaultVect vect() {return _vect;}
125 FaultStat & stat() {return _stat;}
126 };
127
128 class NDtbMissFault : public AlphaFault
129 {
130 private:
131 static FaultName _name;
132 static FaultVect _vect;
133 static FaultStat _stat;
134 public:
135 FaultName name() {return _name;}
136 FaultVect vect() {return _vect;}
137 FaultStat & stat() {return _stat;}
138 };
139
140 class PDtbMissFault : public AlphaFault
141 {
142 private:
143 static FaultName _name;
144 static FaultVect _vect;
145 static FaultStat _stat;
146 public:
147 FaultName name() {return _name;}
148 FaultVect vect() {return _vect;}
149 FaultStat & stat() {return _stat;}
150 };
151
152 class DtbPageFault : public AlphaFault
153 {
154 private:
155 static FaultName _name;
156 static FaultVect _vect;
157 static FaultStat _stat;
158 public:
159 FaultName name() {return _name;}
160 FaultVect vect() {return _vect;}
161 FaultStat & stat() {return _stat;}
162 };
163
164 class DtbAcvFault : public AlphaFault
165 {
166 private:
167 static FaultName _name;
168 static FaultVect _vect;
169 static FaultStat _stat;
170 public:
171 FaultName name() {return _name;}
172 FaultVect vect() {return _vect;}
173 FaultStat & stat() {return _stat;}
174 };
175
176 class ItbMissFault : public AlphaFault
177 {
178 private:
179 static FaultName _name;
180 static FaultVect _vect;
181 static FaultStat _stat;
182 public:
183 FaultName name() {return _name;}
184 FaultVect vect() {return _vect;}
185 FaultStat & stat() {return _stat;}
186 };
187
188 class ItbPageFault : public AlphaFault
189 {
190 private:
191 static FaultName _name;
192 static FaultVect _vect;
193 static FaultStat _stat;
194 public:
195 FaultName name() {return _name;}
196 FaultVect vect() {return _vect;}
197 FaultStat & stat() {return _stat;}
198 };
199
200 class ItbAcvFault : public AlphaFault
201 {
202 private:
203 static FaultName _name;
204 static FaultVect _vect;
205 static FaultStat _stat;
206 public:
207 FaultName name() {return _name;}
208 FaultVect vect() {return _vect;}
209 FaultStat & stat() {return _stat;}
210 };
211
212 class UnimplementedOpcodeFault : public AlphaFault
213 {
214 private:
215 static FaultName _name;
216 static FaultVect _vect;
217 static FaultStat _stat;
218 public:
219 FaultName name() {return _name;}
220 FaultVect vect() {return _vect;}
221 FaultStat & stat() {return _stat;}
222 };
223
224 class FloatEnableFault : public AlphaFault
225 {
226 private:
227 static FaultName _name;
228 static FaultVect _vect;
229 static FaultStat _stat;
230 public:
231 FaultName name() {return _name;}
232 FaultVect vect() {return _vect;}
233 FaultStat & stat() {return _stat;}
234 };
235
236 class PalFault : public AlphaFault
237 {
238 protected:
239 bool skipFaultingInstruction() {return true;}
240 private:
241 static FaultName _name;
242 static FaultVect _vect;
243 static FaultStat _stat;
244 public:
245 FaultName name() {return _name;}
246 FaultVect vect() {return _vect;}
247 FaultStat & stat() {return _stat;}
248 };
249
250 class IntegerOverflowFault : public AlphaFault
251 {
252 private:
253 static FaultName _name;
254 static FaultVect _vect;
255 static FaultStat _stat;
256 public:
257 FaultName name() {return _name;}
258 FaultVect vect() {return _vect;}
259 FaultStat & stat() {return _stat;}
260 };
261
262 } // AlphaISA namespace
263
264 #endif // __FAULTS_HH__