faults.hh revision 2198
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
36namespace AlphaISA
37{
38
39typedef const Addr FaultVect;
40
41class AlphaFault : public virtual FaultBase
42{
43  public:
44#if FULL_SYSTEM
45    void invoke(ExecContext * xc);
46#endif
47    virtual FaultVect vect() = 0;
48};
49
50class AlphaMachineCheckFault :
51    public MachineCheckFault,
52    public AlphaFault
53{
54  private:
55    static FaultVect _vect;
56    static FaultStat _stat;
57  public:
58    FaultVect vect() {return _vect;}
59    FaultStat & stat() {return _stat;}
60};
61
62class AlphaAlignmentFault :
63    public AlignmentFault,
64    public AlphaFault
65{
66  private:
67    static FaultVect _vect;
68    static FaultStat _stat;
69  public:
70    FaultVect vect() {return _vect;}
71    FaultStat & stat() {return _stat;}
72};
73
74static inline Fault genMachineCheckFault()
75{
76    return new AlphaMachineCheckFault;
77}
78
79static inline Fault genAlignmentFault()
80{
81    return new AlphaAlignmentFault;
82}
83
84class ResetFault : public AlphaFault
85{
86  private:
87    static FaultName _name;
88    static FaultVect _vect;
89    static FaultStat _stat;
90  public:
91    FaultName name() {return _name;}
92    FaultVect vect() {return _vect;}
93    FaultStat & stat() {return _stat;}
94};
95
96class ArithmeticFault : public AlphaFault
97{
98  private:
99    static FaultName _name;
100    static FaultVect _vect;
101    static FaultStat _stat;
102  public:
103    FaultName name() {return _name;}
104    FaultVect vect() {return _vect;}
105    FaultStat & stat() {return _stat;}
106};
107
108class InterruptFault : public AlphaFault
109{
110  private:
111    static FaultName _name;
112    static FaultVect _vect;
113    static FaultStat _stat;
114  public:
115    FaultName name() {return _name;}
116    FaultVect vect() {return _vect;}
117    FaultStat & stat() {return _stat;}
118};
119
120class NDtbMissFault : public AlphaFault
121{
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
132class PDtbMissFault : 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
144class DtbPageFault : 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
156class DtbAcvFault : 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
168class ItbMissFault : 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
180class ItbPageFault : 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
192class ItbAcvFault : 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
204class UnimplementedOpcodeFault : 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
216class FloatEnableFault : 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
228class PalFault : 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
240class IntegerOverflowFault : public AlphaFault
241{
242  private:
243    static FaultName _name;
244    static FaultVect _vect;
245    static FaultStat _stat;
246  public:
247    FaultName name() {return _name;}
248    FaultVect vect() {return _vect;}
249    FaultStat & stat() {return _stat;}
250};
251
252} // AlphaISA namespace
253
254#endif // __FAULTS_HH__
255