faults.hh revision 2221
12381SN/A/*
22381SN/A * Copyright (c) 2003-2005 The Regents of The University of Michigan
32381SN/A * All rights reserved.
42381SN/A *
52381SN/A * Redistribution and use in source and binary forms, with or without
62381SN/A * modification, are permitted provided that the following conditions are
72381SN/A * met: redistributions of source code must retain the above copyright
82381SN/A * notice, this list of conditions and the following disclaimer;
92381SN/A * redistributions in binary form must reproduce the above copyright
102381SN/A * notice, this list of conditions and the following disclaimer in the
112381SN/A * documentation and/or other materials provided with the distribution;
122381SN/A * neither the name of the copyright holders nor the names of its
132381SN/A * contributors may be used to endorse or promote products derived from
142381SN/A * this software without specific prior written permission.
152381SN/A *
162381SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172381SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182381SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192381SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202381SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212381SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222381SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232381SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242381SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252381SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262381SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu */
282665Ssaidi@eecs.umich.edu
292381SN/A#ifndef __ALPHA_FAULTS_HH__
302381SN/A#define __ALPHA_FAULTS_HH__
312381SN/A
322381SN/A#include "sim/faults.hh"
332381SN/A
342381SN/A// The design of the "name" and "vect" functions is in sim/faults.hh
352381SN/A
362381SN/Anamespace AlphaISA
372381SN/A{
382381SN/A
392381SN/Atypedef const Addr FaultVect;
402381SN/A
412381SN/Aclass AlphaFault : public virtual FaultBase
422381SN/A{
432381SN/A  protected:
442381SN/A    virtual bool skipFaultingInstruction() {return false;}
452381SN/A    virtual bool setRestartAddress() {return true;}
462439SN/A  public:
472381SN/A#if FULL_SYSTEM
482381SN/A    void invoke(ExecContext * xc);
492381SN/A#endif
502381SN/A    virtual FaultVect vect() = 0;
512407SN/A};
522407SN/A
532407SN/Aclass MachineCheckFault : public AlphaFault
542407SN/A{
552407SN/A  private:
562407SN/A    static FaultName _name;
572407SN/A    static FaultVect _vect;
582407SN/A    static FaultStat _stat;
592521SN/A  public:
602407SN/A    FaultName name() {return _name;}
612381SN/A    FaultVect vect() {return _vect;}
622381SN/A    FaultStat & stat() {return _stat;}
632381SN/A    bool isMachineCheckFault() {return true;}
642381SN/A};
652381SN/A
662381SN/Aclass AlignmentFault : public AlphaFault
672381SN/A{
682381SN/A  private:
692381SN/A    static FaultName _name;
702381SN/A    static FaultVect _vect;
712381SN/A    static FaultStat _stat;
722381SN/A  public:
732381SN/A    FaultName name() {return _name;}
742640Sstever@eecs.umich.edu    FaultVect vect() {return _vect;}
752640Sstever@eecs.umich.edu    FaultStat & stat() {return _stat;}
762640Sstever@eecs.umich.edu    bool isAlignmentFault() {return true;}
772640Sstever@eecs.umich.edu};
782640Sstever@eecs.umich.edu
792661Sstever@eecs.umich.edustatic inline Fault genMachineCheckFault()
802661Sstever@eecs.umich.edu{
812661Sstever@eecs.umich.edu    return new MachineCheckFault;
822661Sstever@eecs.umich.edu}
832661Sstever@eecs.umich.edu
842381SN/Astatic inline Fault genAlignmentFault()
852381SN/A{
862640Sstever@eecs.umich.edu    return new AlignmentFault;
872640Sstever@eecs.umich.edu}
882640Sstever@eecs.umich.edu
892640Sstever@eecs.umich.educlass ResetFault : public AlphaFault
902640Sstever@eecs.umich.edu{
912640Sstever@eecs.umich.edu  private:
922640Sstever@eecs.umich.edu    static FaultName _name;
932661Sstever@eecs.umich.edu    static FaultVect _vect;
942640Sstever@eecs.umich.edu    static FaultStat _stat;
952640Sstever@eecs.umich.edu  public:
962640Sstever@eecs.umich.edu    FaultName name() {return _name;}
972640Sstever@eecs.umich.edu    FaultVect vect() {return _vect;}
982640Sstever@eecs.umich.edu    FaultStat & stat() {return _stat;}
992474SN/A};
1002640Sstever@eecs.umich.edu
1012381SN/Aclass ArithmeticFault : public AlphaFault
1022657Ssaidi@eecs.umich.edu{
1032657Ssaidi@eecs.umich.edu  protected:
1042381SN/A    bool skipFaultingInstruction() {return true;}
1052381SN/A  private:
1062381SN/A    static FaultName _name;
1072381SN/A    static FaultVect _vect;
1082381SN/A    static FaultStat _stat;
1092381SN/A  public:
1102381SN/A    FaultName name() {return _name;}
1112642Sstever@eecs.umich.edu    FaultVect vect() {return _vect;}
1122381SN/A    FaultStat & stat() {return _stat;}
1132642Sstever@eecs.umich.edu#if FULL_SYSTEM
1142408SN/A    void invoke(ExecContext * xc);
1152408SN/A#endif
1162409SN/A};
1172408SN/A
1182381SN/Aclass InterruptFault : public AlphaFault
1192381SN/A{
1202406SN/A  protected:
1212406SN/A    bool setRestartAddress() {return false;}
1222406SN/A  private:
1232381SN/A    static FaultName _name;
1242630SN/A    static FaultVect _vect;
1252381SN/A    static FaultStat _stat;
1262381SN/A  public:
1272630SN/A    FaultName name() {return _name;}
1282381SN/A    FaultVect vect() {return _vect;}
1292381SN/A    FaultStat & stat() {return _stat;}
1302630SN/A};
1312381SN/A
1322381SN/Aclass NDtbMissFault : public AlphaFault
1332381SN/A{
1342381SN/A  private:
1352381SN/A    static FaultName _name;
1362381SN/A    static FaultVect _vect;
1372381SN/A    static FaultStat _stat;
1382381SN/A  public:
1392657Ssaidi@eecs.umich.edu    FaultName name() {return _name;}
1402381SN/A    FaultVect vect() {return _vect;}
1412381SN/A    FaultStat & stat() {return _stat;}
1422381SN/A};
1432381SN/A
1442381SN/Aclass PDtbMissFault : public AlphaFault
1452381SN/A{
1462406SN/A  private:
1472381SN/A    static FaultName _name;
1482381SN/A    static FaultVect _vect;
1492381SN/A    static FaultStat _stat;
1502521SN/A  public:
1512521SN/A    FaultName name() {return _name;}
1522381SN/A    FaultVect vect() {return _vect;}
1532521SN/A    FaultStat & stat() {return _stat;}
1542521SN/A};
1552407SN/A
1562381SN/Aclass DtbPageFault : public AlphaFault
1572381SN/A{
1582381SN/A  private:
1592381SN/A    static FaultName _name;
1602381SN/A    static FaultVect _vect;
1612381SN/A    static FaultStat _stat;
1622381SN/A  public:
1632381SN/A    FaultName name() {return _name;}
1642657Ssaidi@eecs.umich.edu    FaultVect vect() {return _vect;}
1652381SN/A    FaultStat & stat() {return _stat;}
1662381SN/A};
1672381SN/A
1682630SN/Aclass DtbAcvFault : public AlphaFault
1692381SN/A{
1702662Sstever@eecs.umich.edu  private:
1712662Sstever@eecs.umich.edu    static FaultName _name;
1722662Sstever@eecs.umich.edu    static FaultVect _vect;
1732662Sstever@eecs.umich.edu    static FaultStat _stat;
1742662Sstever@eecs.umich.edu  public:
1752630SN/A    FaultName name() {return _name;}
1762381SN/A    FaultVect vect() {return _vect;}
1772381SN/A    FaultStat & stat() {return _stat;}
1782381SN/A};
1792381SN/A
1802520SN/Aclass ItbMissFault : public AlphaFault
1812520SN/A{
1822381SN/A  private:
1832630SN/A    static FaultName _name;
1842381SN/A    static FaultVect _vect;
1852381SN/A    static FaultStat _stat;
1862381SN/A  public:
1872381SN/A    FaultName name() {return _name;}
1882381SN/A    FaultVect vect() {return _vect;}
1892381SN/A    FaultStat & stat() {return _stat;}
1902381SN/A};
1912381SN/A
1922381SN/Aclass ItbPageFault : public AlphaFault
1932381SN/A{
1942657Ssaidi@eecs.umich.edu  private:
1952381SN/A    static FaultName _name;
1962381SN/A    static FaultVect _vect;
1972381SN/A    static FaultStat _stat;
1982381SN/A  public:
1992406SN/A    FaultName name() {return _name;}
2002381SN/A    FaultVect vect() {return _vect;}
2012381SN/A    FaultStat & stat() {return _stat;}
2022381SN/A};
2032381SN/A
2042521SN/Aclass ItbAcvFault : public AlphaFault
2052521SN/A{
2062381SN/A  private:
2072461SN/A    static FaultName _name;
2082461SN/A    static FaultVect _vect;
2092461SN/A    static FaultStat _stat;
2102461SN/A  public:
2112461SN/A    FaultName name() {return _name;}
2122519SN/A    FaultVect vect() {return _vect;}
2132381SN/A    FaultStat & stat() {return _stat;}
2142381SN/A};
2152381SN/A
2162381SN/Aclass UnimplementedOpcodeFault : public AlphaFault
2172381SN/A{
2182381SN/A  private:
2192519SN/A    static FaultName _name;
2202381SN/A    static FaultVect _vect;
2212381SN/A    static FaultStat _stat;
2222381SN/A  public:
2232461SN/A    FaultName name() {return _name;}
2242381SN/A    FaultVect vect() {return _vect;}
2252381SN/A    FaultStat & stat() {return _stat;}
2262519SN/A};
2272405SN/A
2282405SN/Aclass FloatEnableFault : public AlphaFault
2292405SN/A{
2302405SN/A  private:
2312405SN/A    static FaultName _name;
2322641Sstever@eecs.umich.edu    static FaultVect _vect;
2332381SN/A    static FaultStat _stat;
2342381SN/A  public:
2352520SN/A    FaultName name() {return _name;}
2362520SN/A    FaultVect vect() {return _vect;}
2372520SN/A    FaultStat & stat() {return _stat;}
2382520SN/A};
2392520SN/A
2402520SN/Aclass PalFault : public AlphaFault
2412520SN/A{
2422520SN/A  protected:
2432640Sstever@eecs.umich.edu    bool skipFaultingInstruction() {return true;}
2442640Sstever@eecs.umich.edu  private:
2452640Sstever@eecs.umich.edu    static FaultName _name;
2462640Sstever@eecs.umich.edu    static FaultVect _vect;
2472630SN/A    static FaultStat _stat;
2482630SN/A  public:
2492630SN/A    FaultName name() {return _name;}
2502590SN/A    FaultVect vect() {return _vect;}
2512521SN/A    FaultStat & stat() {return _stat;}
2522521SN/A};
2532521SN/A
2542521SN/Aclass IntegerOverflowFault : public AlphaFault
2552521SN/A{
2562521SN/A  private:
2572521SN/A    static FaultName _name;
2582521SN/A    static FaultVect _vect;
2592521SN/A    static FaultStat _stat;
2602521SN/A  public:
2612521SN/A    FaultName name() {return _name;}
2622521SN/A    FaultVect vect() {return _vect;}
2632521SN/A    FaultStat & stat() {return _stat;}
2642521SN/A};
2652520SN/A
2662520SN/A} // AlphaISA namespace
2672381SN/A
268#endif // __FAULTS_HH__
269