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