Merge zizzer:/bk/m5
[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 MachineCheckFault : public AlphaFault
54 {
55 private:
56 static FaultName _name;
57 static FaultVect _vect;
58 static FaultStat _stat;
59 public:
60 FaultName name() {return _name;}
61 FaultVect vect() {return _vect;}
62 FaultStat & stat() {return _stat;}
63 bool isMachineCheckFault() {return true;}
64 };
65
66 class AlignmentFault : public AlphaFault
67 {
68 private:
69 static FaultName _name;
70 static FaultVect _vect;
71 static FaultStat _stat;
72 public:
73 FaultName name() {return _name;}
74 FaultVect vect() {return _vect;}
75 FaultStat & stat() {return _stat;}
76 bool isAlignmentFault() {return true;}
77 };
78
79 static inline Fault genMachineCheckFault()
80 {
81 return new MachineCheckFault;
82 }
83
84 static inline Fault genAlignmentFault()
85 {
86 return new AlignmentFault;
87 }
88
89 class ResetFault : public AlphaFault
90 {
91 private:
92 static FaultName _name;
93 static FaultVect _vect;
94 static FaultStat _stat;
95 public:
96 FaultName name() {return _name;}
97 FaultVect vect() {return _vect;}
98 FaultStat & stat() {return _stat;}
99 };
100
101 class ArithmeticFault : public AlphaFault
102 {
103 protected:
104 bool skipFaultingInstruction() {return true;}
105 private:
106 static FaultName _name;
107 static FaultVect _vect;
108 static FaultStat _stat;
109 public:
110 FaultName name() {return _name;}
111 FaultVect vect() {return _vect;}
112 FaultStat & stat() {return _stat;}
113 #if FULL_SYSTEM
114 void invoke(ExecContext * xc);
115 #endif
116 };
117
118 class InterruptFault : public AlphaFault
119 {
120 protected:
121 bool setRestartAddress() {return false;}
122 private:
123 static FaultName _name;
124 static FaultVect _vect;
125 static FaultStat _stat;
126 public:
127 FaultName name() {return _name;}
128 FaultVect vect() {return _vect;}
129 FaultStat & stat() {return _stat;}
130 };
131
132 class NDtbMissFault : public AlphaFault
133 {
134 private:
135 static FaultName _name;
136 static FaultVect _vect;
137 static FaultStat _stat;
138 public:
139 FaultName name() {return _name;}
140 FaultVect vect() {return _vect;}
141 FaultStat & stat() {return _stat;}
142 };
143
144 class PDtbMissFault : public AlphaFault
145 {
146 private:
147 static FaultName _name;
148 static FaultVect _vect;
149 static FaultStat _stat;
150 public:
151 FaultName name() {return _name;}
152 FaultVect vect() {return _vect;}
153 FaultStat & stat() {return _stat;}
154 };
155
156 class DtbPageFault : public AlphaFault
157 {
158 private:
159 static FaultName _name;
160 static FaultVect _vect;
161 static FaultStat _stat;
162 public:
163 FaultName name() {return _name;}
164 FaultVect vect() {return _vect;}
165 FaultStat & stat() {return _stat;}
166 };
167
168 class DtbAcvFault : public AlphaFault
169 {
170 private:
171 static FaultName _name;
172 static FaultVect _vect;
173 static FaultStat _stat;
174 public:
175 FaultName name() {return _name;}
176 FaultVect vect() {return _vect;}
177 FaultStat & stat() {return _stat;}
178 };
179
180 class ItbMissFault : public AlphaFault
181 {
182 private:
183 static FaultName _name;
184 static FaultVect _vect;
185 static FaultStat _stat;
186 public:
187 FaultName name() {return _name;}
188 FaultVect vect() {return _vect;}
189 FaultStat & stat() {return _stat;}
190 };
191
192 class ItbPageFault : public AlphaFault
193 {
194 private:
195 static FaultName _name;
196 static FaultVect _vect;
197 static FaultStat _stat;
198 public:
199 FaultName name() {return _name;}
200 FaultVect vect() {return _vect;}
201 FaultStat & stat() {return _stat;}
202 };
203
204 class ItbAcvFault : public AlphaFault
205 {
206 private:
207 static FaultName _name;
208 static FaultVect _vect;
209 static FaultStat _stat;
210 public:
211 FaultName name() {return _name;}
212 FaultVect vect() {return _vect;}
213 FaultStat & stat() {return _stat;}
214 };
215
216 class UnimplementedOpcodeFault : public AlphaFault
217 {
218 private:
219 static FaultName _name;
220 static FaultVect _vect;
221 static FaultStat _stat;
222 public:
223 FaultName name() {return _name;}
224 FaultVect vect() {return _vect;}
225 FaultStat & stat() {return _stat;}
226 };
227
228 class FloatEnableFault : public AlphaFault
229 {
230 private:
231 static FaultName _name;
232 static FaultVect _vect;
233 static FaultStat _stat;
234 public:
235 FaultName name() {return _name;}
236 FaultVect vect() {return _vect;}
237 FaultStat & stat() {return _stat;}
238 };
239
240 class PalFault : public AlphaFault
241 {
242 protected:
243 bool skipFaultingInstruction() {return true;}
244 private:
245 static FaultName _name;
246 static FaultVect _vect;
247 static FaultStat _stat;
248 public:
249 FaultName name() {return _name;}
250 FaultVect vect() {return _vect;}
251 FaultStat & stat() {return _stat;}
252 };
253
254 class IntegerOverflowFault : public AlphaFault
255 {
256 private:
257 static FaultName _name;
258 static FaultVect _vect;
259 static FaultStat _stat;
260 public:
261 FaultName name() {return _name;}
262 FaultVect vect() {return _vect;}
263 FaultStat & stat() {return _stat;}
264 };
265
266 } // AlphaISA namespace
267
268 #endif // __FAULTS_HH__