Changed ev5_trap from a function of the execution context to a function of the fault...
[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 FaultBase
42 {
43 private:
44 static FaultName _name;
45 static FaultVect _vect;
46 static FaultStat _stat;
47 public:
48 #if FULL_SYSTEM
49 void ev5_trap(ExecContext * xc);
50 #endif
51 FaultName name() {return _name;}
52 virtual FaultVect vect() {return _vect;}
53 virtual FaultStat & stat() {return _stat;}
54 };
55
56 class AlphaMachineCheckFault : public MachineCheckFault
57 {
58 private:
59 static FaultVect _vect;
60 static FaultStat _stat;
61 public:
62 #if FULL_SYSTEM
63 void ev5_trap(ExecContext * xc);
64 #endif
65 FaultVect vect() {return _vect;}
66 FaultStat & stat() {return _stat;}
67 };
68
69 class AlphaAlignmentFault : public AlignmentFault
70 {
71 private:
72 static FaultVect _vect;
73 static FaultStat _stat;
74 public:
75 #if FULL_SYSTEM
76 void ev5_trap(ExecContext * xc);
77 #endif
78 FaultVect vect() {return _vect;}
79 FaultStat & stat() {return _stat;}
80 };
81
82 static inline Fault genMachineCheckFault()
83 {
84 return new AlphaMachineCheckFault;
85 }
86
87 static inline Fault genAlignmentFault()
88 {
89 return new AlphaAlignmentFault;
90 }
91
92 class ResetFault : public AlphaFault
93 {
94 private:
95 static FaultName _name;
96 static FaultVect _vect;
97 static FaultStat _stat;
98 public:
99 FaultName name() {return _name;}
100 FaultVect vect() {return _vect;}
101 FaultStat & stat() {return _stat;}
102 };
103
104 class ArithmeticFault : public AlphaFault
105 {
106 private:
107 static FaultName _name;
108 static FaultVect _vect;
109 static FaultStat _stat;
110 public:
111 FaultName name() {return _name;}
112 FaultVect vect() {return _vect;}
113 FaultStat & stat() {return _stat;}
114 };
115
116 class InterruptFault : public AlphaFault
117 {
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 private:
239 static FaultName _name;
240 static FaultVect _vect;
241 static FaultStat _stat;
242 public:
243 FaultName name() {return _name;}
244 FaultVect vect() {return _vect;}
245 FaultStat & stat() {return _stat;}
246 };
247
248 class IntegerOverflowFault : public AlphaFault
249 {
250 private:
251 static FaultName _name;
252 static FaultVect _vect;
253 static FaultStat _stat;
254 public:
255 FaultName name() {return _name;}
256 FaultVect vect() {return _vect;}
257 FaultStat & stat() {return _stat;}
258 };
259
260 } // AlphaISA namespace
261
262 #endif // __FAULTS_HH__