faults.hh revision 2201
114184Sgabeblack@google.com/*
214184Sgabeblack@google.com * Copyright (c) 2003-2005 The Regents of The University of Michigan
314184Sgabeblack@google.com * All rights reserved.
414184Sgabeblack@google.com *
514184Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without
614184Sgabeblack@google.com * modification, are permitted provided that the following conditions are
714184Sgabeblack@google.com * met: redistributions of source code must retain the above copyright
814184Sgabeblack@google.com * notice, this list of conditions and the following disclaimer;
914184Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright
1014184Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the
1114184Sgabeblack@google.com * documentation and/or other materials provided with the distribution;
1214184Sgabeblack@google.com * neither the name of the copyright holders nor the names of its
1314184Sgabeblack@google.com * contributors may be used to endorse or promote products derived from
1414184Sgabeblack@google.com * this software without specific prior written permission.
1514184Sgabeblack@google.com *
1614184Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1714184Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1814184Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1914184Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2014184Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2114184Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2214184Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2314184Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2414184Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2514184Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2614184Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2714184Sgabeblack@google.com */
2814184Sgabeblack@google.com
2914184Sgabeblack@google.com#ifndef __ALPHA_FAULTS_HH__
3014184Sgabeblack@google.com#define __ALPHA_FAULTS_HH__
3114184Sgabeblack@google.com
3214184Sgabeblack@google.com#include "sim/faults.hh"
3314184Sgabeblack@google.com
3414184Sgabeblack@google.com// The design of the "name" and "vect" functions is in sim/faults.hh
3514184Sgabeblack@google.com
3614184Sgabeblack@google.comnamespace AlphaISA
3714184Sgabeblack@google.com{
3814184Sgabeblack@google.com
3914184Sgabeblack@google.comtypedef const Addr FaultVect;
4014184Sgabeblack@google.com
4114184Sgabeblack@google.comclass AlphaFault : public virtual FaultBase
4214184Sgabeblack@google.com{
4314184Sgabeblack@google.com  protected:
4414184Sgabeblack@google.com    virtual bool skipFaultingInstruction() {return false;}
4514184Sgabeblack@google.com    virtual bool setRestartAddress() {return true;}
4614184Sgabeblack@google.com  public:
4714184Sgabeblack@google.com#if FULL_SYSTEM
4814184Sgabeblack@google.com    void invoke(ExecContext * xc);
4914184Sgabeblack@google.com#endif
5014184Sgabeblack@google.com    virtual FaultVect vect() = 0;
5114184Sgabeblack@google.com};
5214184Sgabeblack@google.com
5314184Sgabeblack@google.comclass AlphaMachineCheckFault :
5414184Sgabeblack@google.com    public MachineCheckFault,
5514184Sgabeblack@google.com    public AlphaFault
5614184Sgabeblack@google.com{
5714184Sgabeblack@google.com  private:
5814184Sgabeblack@google.com    static FaultVect _vect;
5914184Sgabeblack@google.com    static FaultStat _stat;
6014184Sgabeblack@google.com  public:
6114184Sgabeblack@google.com    FaultVect vect() {return _vect;}
6214184Sgabeblack@google.com    FaultStat & stat() {return _stat;}
6314184Sgabeblack@google.com};
6414184Sgabeblack@google.com
6514184Sgabeblack@google.comclass AlphaAlignmentFault :
6614184Sgabeblack@google.com    public AlignmentFault,
6714184Sgabeblack@google.com    public AlphaFault
6814184Sgabeblack@google.com{
6914184Sgabeblack@google.com  private:
7014184Sgabeblack@google.com    static FaultVect _vect;
7114184Sgabeblack@google.com    static FaultStat _stat;
7214184Sgabeblack@google.com  public:
7314184Sgabeblack@google.com    FaultVect vect() {return _vect;}
7414184Sgabeblack@google.com    FaultStat & stat() {return _stat;}
7514184Sgabeblack@google.com};
7614184Sgabeblack@google.com
7714184Sgabeblack@google.comstatic inline Fault genMachineCheckFault()
7814184Sgabeblack@google.com{
7914184Sgabeblack@google.com    return new AlphaMachineCheckFault;
8014184Sgabeblack@google.com}
8114184Sgabeblack@google.com
8214184Sgabeblack@google.comstatic inline Fault genAlignmentFault()
8314184Sgabeblack@google.com{
8414184Sgabeblack@google.com    return new AlphaAlignmentFault;
8514184Sgabeblack@google.com}
8614184Sgabeblack@google.com
8714184Sgabeblack@google.comclass ResetFault : public AlphaFault
8814184Sgabeblack@google.com{
8914184Sgabeblack@google.com  private:
9014184Sgabeblack@google.com    static FaultName _name;
9114184Sgabeblack@google.com    static FaultVect _vect;
9214184Sgabeblack@google.com    static FaultStat _stat;
9314184Sgabeblack@google.com  public:
9414184Sgabeblack@google.com    FaultName name() {return _name;}
9514184Sgabeblack@google.com    FaultVect vect() {return _vect;}
9614184Sgabeblack@google.com    FaultStat & stat() {return _stat;}
9714184Sgabeblack@google.com};
9814184Sgabeblack@google.com
9914184Sgabeblack@google.comclass ArithmeticFault : public AlphaFault
10014184Sgabeblack@google.com{
10114184Sgabeblack@google.com  protected:
10214184Sgabeblack@google.com    bool skipFaultingInstruction() {return true;}
10314184Sgabeblack@google.com  private:
10414184Sgabeblack@google.com    static FaultName _name;
10514184Sgabeblack@google.com    static FaultVect _vect;
10614184Sgabeblack@google.com    static FaultStat _stat;
10714184Sgabeblack@google.com  public:
10814184Sgabeblack@google.com    FaultName name() {return _name;}
10914184Sgabeblack@google.com    FaultVect vect() {return _vect;}
11014184Sgabeblack@google.com    FaultStat & stat() {return _stat;}
11114184Sgabeblack@google.com    void invoke(ExecContext * xc);
11214184Sgabeblack@google.com};
11314184Sgabeblack@google.com
11414184Sgabeblack@google.comclass InterruptFault : public AlphaFault
11514184Sgabeblack@google.com{
11614184Sgabeblack@google.com  protected:
11714184Sgabeblack@google.com    bool setRestartAddress() {return false;}
11814184Sgabeblack@google.com  private:
11914184Sgabeblack@google.com    static FaultName _name;
12014184Sgabeblack@google.com    static FaultVect _vect;
12114184Sgabeblack@google.com    static FaultStat _stat;
12214184Sgabeblack@google.com  public:
12314184Sgabeblack@google.com    FaultName name() {return _name;}
12414184Sgabeblack@google.com    FaultVect vect() {return _vect;}
12514184Sgabeblack@google.com    FaultStat & stat() {return _stat;}
12614184Sgabeblack@google.com};
12714184Sgabeblack@google.com
12814184Sgabeblack@google.comclass NDtbMissFault : public AlphaFault
12914184Sgabeblack@google.com{
13014184Sgabeblack@google.com  private:
13114184Sgabeblack@google.com    static FaultName _name;
13214184Sgabeblack@google.com    static FaultVect _vect;
13314184Sgabeblack@google.com    static FaultStat _stat;
13414184Sgabeblack@google.com  public:
13514184Sgabeblack@google.com    FaultName name() {return _name;}
13614184Sgabeblack@google.com    FaultVect vect() {return _vect;}
13714184Sgabeblack@google.com    FaultStat & stat() {return _stat;}
13814184Sgabeblack@google.com};
13914184Sgabeblack@google.com
14014184Sgabeblack@google.comclass PDtbMissFault : public AlphaFault
14114184Sgabeblack@google.com{
14214184Sgabeblack@google.com  private:
14314184Sgabeblack@google.com    static FaultName _name;
14414184Sgabeblack@google.com    static FaultVect _vect;
14514184Sgabeblack@google.com    static FaultStat _stat;
14614184Sgabeblack@google.com  public:
14714184Sgabeblack@google.com    FaultName name() {return _name;}
14814184Sgabeblack@google.com    FaultVect vect() {return _vect;}
14914184Sgabeblack@google.com    FaultStat & stat() {return _stat;}
15014184Sgabeblack@google.com};
15114184Sgabeblack@google.com
15214184Sgabeblack@google.comclass DtbPageFault : public AlphaFault
15314184Sgabeblack@google.com{
15414184Sgabeblack@google.com  private:
15514184Sgabeblack@google.com    static FaultName _name;
15614184Sgabeblack@google.com    static FaultVect _vect;
15714184Sgabeblack@google.com    static FaultStat _stat;
15814184Sgabeblack@google.com  public:
15914184Sgabeblack@google.com    FaultName name() {return _name;}
16014184Sgabeblack@google.com    FaultVect vect() {return _vect;}
16114184Sgabeblack@google.com    FaultStat & stat() {return _stat;}
16214184Sgabeblack@google.com};
16314184Sgabeblack@google.com
16414184Sgabeblack@google.comclass DtbAcvFault : public AlphaFault
16514184Sgabeblack@google.com{
16614184Sgabeblack@google.com  private:
16714184Sgabeblack@google.com    static FaultName _name;
16814184Sgabeblack@google.com    static FaultVect _vect;
16914184Sgabeblack@google.com    static FaultStat _stat;
17014184Sgabeblack@google.com  public:
17114184Sgabeblack@google.com    FaultName name() {return _name;}
17214184Sgabeblack@google.com    FaultVect vect() {return _vect;}
17314184Sgabeblack@google.com    FaultStat & stat() {return _stat;}
17414184Sgabeblack@google.com};
17514184Sgabeblack@google.com
17614184Sgabeblack@google.comclass ItbMissFault : public AlphaFault
17714184Sgabeblack@google.com{
17814184Sgabeblack@google.com  private:
17914184Sgabeblack@google.com    static FaultName _name;
18014184Sgabeblack@google.com    static FaultVect _vect;
18114184Sgabeblack@google.com    static FaultStat _stat;
18214184Sgabeblack@google.com  public:
18314184Sgabeblack@google.com    FaultName name() {return _name;}
18414184Sgabeblack@google.com    FaultVect vect() {return _vect;}
18514184Sgabeblack@google.com    FaultStat & stat() {return _stat;}
18614184Sgabeblack@google.com};
18714184Sgabeblack@google.com
18814184Sgabeblack@google.comclass ItbPageFault : public AlphaFault
18914184Sgabeblack@google.com{
19014184Sgabeblack@google.com  private:
19114184Sgabeblack@google.com    static FaultName _name;
19214184Sgabeblack@google.com    static FaultVect _vect;
19314184Sgabeblack@google.com    static FaultStat _stat;
19414184Sgabeblack@google.com  public:
19514184Sgabeblack@google.com    FaultName name() {return _name;}
19614184Sgabeblack@google.com    FaultVect vect() {return _vect;}
19714184Sgabeblack@google.com    FaultStat & stat() {return _stat;}
19814184Sgabeblack@google.com};
19914184Sgabeblack@google.com
20014184Sgabeblack@google.comclass ItbAcvFault : public AlphaFault
20114184Sgabeblack@google.com{
20214184Sgabeblack@google.com  private:
20314184Sgabeblack@google.com    static FaultName _name;
20414184Sgabeblack@google.com    static FaultVect _vect;
20514184Sgabeblack@google.com    static FaultStat _stat;
20614184Sgabeblack@google.com  public:
20714184Sgabeblack@google.com    FaultName name() {return _name;}
20814184Sgabeblack@google.com    FaultVect vect() {return _vect;}
20914184Sgabeblack@google.com    FaultStat & stat() {return _stat;}
21014184Sgabeblack@google.com};
21114184Sgabeblack@google.com
21214184Sgabeblack@google.comclass UnimplementedOpcodeFault : public AlphaFault
21314184Sgabeblack@google.com{
21414184Sgabeblack@google.com  private:
21514184Sgabeblack@google.com    static FaultName _name;
21614184Sgabeblack@google.com    static FaultVect _vect;
21714184Sgabeblack@google.com    static FaultStat _stat;
21814184Sgabeblack@google.com  public:
21914184Sgabeblack@google.com    FaultName name() {return _name;}
22014184Sgabeblack@google.com    FaultVect vect() {return _vect;}
22114184Sgabeblack@google.com    FaultStat & stat() {return _stat;}
22214184Sgabeblack@google.com};
22314184Sgabeblack@google.com
22414184Sgabeblack@google.comclass FloatEnableFault : public AlphaFault
22514184Sgabeblack@google.com{
22614184Sgabeblack@google.com  private:
22714184Sgabeblack@google.com    static FaultName _name;
22814184Sgabeblack@google.com    static FaultVect _vect;
22914184Sgabeblack@google.com    static FaultStat _stat;
23014184Sgabeblack@google.com  public:
23114184Sgabeblack@google.com    FaultName name() {return _name;}
23214184Sgabeblack@google.com    FaultVect vect() {return _vect;}
23314184Sgabeblack@google.com    FaultStat & stat() {return _stat;}
23414184Sgabeblack@google.com};
23514184Sgabeblack@google.com
23614184Sgabeblack@google.comclass PalFault : public AlphaFault
23714184Sgabeblack@google.com{
23814184Sgabeblack@google.com  protected:
23914184Sgabeblack@google.com    bool skipFaultingInstruction() {return true;}
24014184Sgabeblack@google.com  private:
24114184Sgabeblack@google.com    static FaultName _name;
24214184Sgabeblack@google.com    static FaultVect _vect;
24314184Sgabeblack@google.com    static FaultStat _stat;
24414184Sgabeblack@google.com  public:
24514184Sgabeblack@google.com    FaultName name() {return _name;}
24614184Sgabeblack@google.com    FaultVect vect() {return _vect;}
24714184Sgabeblack@google.com    FaultStat & stat() {return _stat;}
24814184Sgabeblack@google.com};
24914184Sgabeblack@google.com
25014184Sgabeblack@google.comclass IntegerOverflowFault : public AlphaFault
25114184Sgabeblack@google.com{
25214184Sgabeblack@google.com  private:
25314184Sgabeblack@google.com    static FaultName _name;
25414184Sgabeblack@google.com    static FaultVect _vect;
25514184Sgabeblack@google.com    static FaultStat _stat;
25614184Sgabeblack@google.com  public:
25714184Sgabeblack@google.com    FaultName name() {return _name;}
25814184Sgabeblack@google.com    FaultVect vect() {return _vect;}
25914184Sgabeblack@google.com    FaultStat & stat() {return _stat;}
26014184Sgabeblack@google.com};
26114184Sgabeblack@google.com
26214184Sgabeblack@google.com} // AlphaISA namespace
26314184Sgabeblack@google.com
26414184Sgabeblack@google.com#endif // __FAULTS_HH__
26514184Sgabeblack@google.com