faults.hh revision 4661
12131SN/A/*
22131SN/A * Copyright (c) 2003-2005 The Regents of The University of Michigan
32131SN/A * All rights reserved.
42131SN/A *
52131SN/A * Redistribution and use in source and binary forms, with or without
62131SN/A * modification, are permitted provided that the following conditions are
72131SN/A * met: redistributions of source code must retain the above copyright
82131SN/A * notice, this list of conditions and the following disclaimer;
92131SN/A * redistributions in binary form must reproduce the above copyright
102131SN/A * notice, this list of conditions and the following disclaimer in the
112131SN/A * documentation and/or other materials provided with the distribution;
122131SN/A * neither the name of the copyright holders nor the names of its
132131SN/A * contributors may be used to endorse or promote products derived from
142131SN/A * this software without specific prior written permission.
152131SN/A *
162131SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172131SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182131SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192131SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202131SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212131SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222131SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232131SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242131SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252131SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262131SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu *
282935Sksewell@umich.edu * Authors: Gabe Black
292935Sksewell@umich.edu *          Korey Sewell
302131SN/A */
312131SN/A
322239SN/A#ifndef __MIPS_FAULTS_HH__
332239SN/A#define __MIPS_FAULTS_HH__
342131SN/A
352131SN/A#include "sim/faults.hh"
362447SN/A
372447SN/A// The design of the "name" and "vect" functions is in sim/faults.hh
382447SN/A
392447SN/Anamespace MipsISA
402447SN/A{
412447SN/A
422447SN/Atypedef const Addr FaultVect;
432131SN/A
442239SN/Aclass MipsFault : public FaultBase
452131SN/A{
462447SN/A  protected:
472447SN/A    virtual bool skipFaultingInstruction() {return false;}
482447SN/A    virtual bool setRestartAddress() {return true;}
492131SN/A  public:
502447SN/A#if FULL_SYSTEM
512680Sktlim@umich.edu    void invoke(ThreadContext * tc);
522447SN/A#endif
532447SN/A    virtual FaultVect vect() = 0;
542447SN/A    virtual FaultStat & countStat() = 0;
552131SN/A};
562131SN/A
572447SN/Aclass MachineCheckFault : public MipsFault
582131SN/A{
592447SN/A  private:
602447SN/A    static FaultName _name;
612447SN/A    static FaultVect _vect;
622447SN/A    static FaultStat _count;
632131SN/A  public:
642447SN/A    FaultName name() {return _name;}
652447SN/A    FaultVect vect() {return _vect;}
662447SN/A    FaultStat & countStat() {return _count;}
672447SN/A    bool isMachineCheckFault() {return true;}
682447SN/A};
692131SN/A
702447SN/Aclass AlignmentFault : public MipsFault
712131SN/A{
722447SN/A  private:
732447SN/A    static FaultName _name;
742447SN/A    static FaultVect _vect;
752447SN/A    static FaultStat _count;
762131SN/A  public:
772447SN/A    FaultName name() {return _name;}
782447SN/A    FaultVect vect() {return _vect;}
792447SN/A    FaultStat & countStat() {return _count;}
802447SN/A    bool isAlignmentFault() {return true;}
812447SN/A};
822131SN/A
834661Sksewell@umich.educlass UnimplementedOpcodeFault : public MipsFault
844661Sksewell@umich.edu{
854661Sksewell@umich.edu  private:
864661Sksewell@umich.edu    static FaultName _name;
874661Sksewell@umich.edu    static FaultVect _vect;
884661Sksewell@umich.edu    static FaultStat _count;
894661Sksewell@umich.edu  public:
904661Sksewell@umich.edu    FaultName name() {return _name;}
914661Sksewell@umich.edu    FaultVect vect() {return _vect;}
924661Sksewell@umich.edu    FaultStat & countStat() {return _count;}
934661Sksewell@umich.edu};
944661Sksewell@umich.edu
954661Sksewell@umich.edu#if !FULL_SYSTEM
964661Sksewell@umich.edu//class PageTableFault : public MipsFault
974661Sksewell@umich.edu//{
984661Sksewell@umich.edu//private:
994661Sksewell@umich.edu//  Addr vaddr;
1004661Sksewell@umich.edu//  static FaultName _name;
1014661Sksewell@umich.edu//  static FaultVect _vect;
1024661Sksewell@umich.edu//  static FaultStat _count;
1034661Sksewell@umich.edu//public:
1044661Sksewell@umich.edu//  PageTableFault(Addr va)
1054661Sksewell@umich.edu//      : vaddr(va) {}
1064661Sksewell@umich.edu//  FaultName name() {return _name;}
1074661Sksewell@umich.edu//  FaultVect vect() {return _vect;}
1084661Sksewell@umich.edu//  FaultStat & countStat() {return _count;}
1094661Sksewell@umich.edu//  void invoke(ThreadContext * tc);
1104661Sksewell@umich.edu//};
1114661Sksewell@umich.edu
1124661Sksewell@umich.edustatic inline Fault genPageTableFault(Addr va)
1134661Sksewell@umich.edu{
1144661Sksewell@umich.edu    return new PageTableFault(va);
1154661Sksewell@umich.edu}
1164661Sksewell@umich.edu#endif
1174661Sksewell@umich.edu
1184661Sksewell@umich.edu
1192447SN/Astatic inline Fault genMachineCheckFault()
1202131SN/A{
1212447SN/A    return new MachineCheckFault;
1222447SN/A}
1232447SN/A
1242447SN/Astatic inline Fault genAlignmentFault()
1252447SN/A{
1262447SN/A    return new AlignmentFault;
1272447SN/A}
1282447SN/A
1292447SN/Aclass ResetFault : public MipsFault
1302447SN/A{
1312447SN/A  private:
1322447SN/A    static FaultName _name;
1332447SN/A    static FaultVect _vect;
1342447SN/A    static FaultStat _count;
1352131SN/A  public:
1362447SN/A    FaultName name() {return _name;}
1372447SN/A    FaultVect vect() {return _vect;}
1382447SN/A    FaultStat & countStat() {return _count;}
1394661Sksewell@umich.edu    void invoke(ThreadContext * tc);
1402447SN/A};
1412131SN/A
1424661Sksewell@umich.educlass CoprocessorUnusableFault : public MipsFault
1434661Sksewell@umich.edu{
1444661Sksewell@umich.edu  private:
1454661Sksewell@umich.edu    static FaultName _name;
1464661Sksewell@umich.edu    static FaultVect _vect;
1474661Sksewell@umich.edu    static FaultStat _count;
1484661Sksewell@umich.edu  public:
1494661Sksewell@umich.edu    FaultName name() {return _name;}
1504661Sksewell@umich.edu    FaultVect vect() {return _vect;}
1514661Sksewell@umich.edu    FaultStat & countStat() {return _count;}
1524661Sksewell@umich.edu    void invoke(ThreadContext * tc);
1534661Sksewell@umich.edu};
1544661Sksewell@umich.edu
1554661Sksewell@umich.educlass ReservedInstructionFault : public MipsFault
1564661Sksewell@umich.edu{
1574661Sksewell@umich.edu  private:
1584661Sksewell@umich.edu    static FaultName _name;
1594661Sksewell@umich.edu    static FaultVect _vect;
1604661Sksewell@umich.edu    static FaultStat _count;
1614661Sksewell@umich.edu  public:
1624661Sksewell@umich.edu    FaultName name() {return _name;}
1634661Sksewell@umich.edu    FaultVect vect() {return _vect;}
1644661Sksewell@umich.edu    FaultStat & countStat() {return _count;}
1654661Sksewell@umich.edu    void invoke(ThreadContext * tc);
1664661Sksewell@umich.edu};
1674661Sksewell@umich.edu
1684661Sksewell@umich.educlass ThreadFault : public MipsFault
1694661Sksewell@umich.edu{
1704661Sksewell@umich.edu  private:
1714661Sksewell@umich.edu    static FaultName _name;
1724661Sksewell@umich.edu    static FaultVect _vect;
1734661Sksewell@umich.edu    static FaultStat _count;
1744661Sksewell@umich.edu  public:
1754661Sksewell@umich.edu    FaultName name() {return _name;}
1764661Sksewell@umich.edu    FaultVect vect() {return _vect;}
1774661Sksewell@umich.edu    FaultStat & countStat() {return _count;}
1784661Sksewell@umich.edu    void invoke(ThreadContext * tc);
1794661Sksewell@umich.edu};
1804661Sksewell@umich.edu
1814661Sksewell@umich.edu
1822447SN/Aclass ArithmeticFault : public MipsFault
1832131SN/A{
1842447SN/A  protected:
1852447SN/A    bool skipFaultingInstruction() {return true;}
1862447SN/A  private:
1872447SN/A    static FaultName _name;
1882447SN/A    static FaultVect _vect;
1892447SN/A    static FaultStat _count;
1902131SN/A  public:
1912447SN/A    FaultName name() {return _name;}
1922447SN/A    FaultVect vect() {return _vect;}
1932447SN/A    FaultStat & countStat() {return _count;}
1942447SN/A#if FULL_SYSTEM
1952680Sktlim@umich.edu    void invoke(ThreadContext * tc);
1962447SN/A#endif
1972447SN/A};
1982131SN/A
1992447SN/Aclass InterruptFault : public MipsFault
2002131SN/A{
2012447SN/A  protected:
2022447SN/A    bool setRestartAddress() {return false;}
2032447SN/A  private:
2042447SN/A    static FaultName _name;
2052447SN/A    static FaultVect _vect;
2062447SN/A    static FaultStat _count;
2072131SN/A  public:
2082447SN/A    FaultName name() {return _name;}
2092447SN/A    FaultVect vect() {return _vect;}
2102447SN/A    FaultStat & countStat() {return _count;}
2112447SN/A};
2122131SN/A
2132447SN/Aclass NDtbMissFault : public MipsFault
2142131SN/A{
2152447SN/A  private:
2162447SN/A    static FaultName _name;
2172447SN/A    static FaultVect _vect;
2182447SN/A    static FaultStat _count;
2192131SN/A  public:
2202447SN/A    FaultName name() {return _name;}
2212447SN/A    FaultVect vect() {return _vect;}
2222447SN/A    FaultStat & countStat() {return _count;}
2232447SN/A};
2242131SN/A
2252447SN/Aclass PDtbMissFault : public MipsFault
2262131SN/A{
2272447SN/A  private:
2282447SN/A    static FaultName _name;
2292447SN/A    static FaultVect _vect;
2302447SN/A    static FaultStat _count;
2312131SN/A  public:
2322447SN/A    FaultName name() {return _name;}
2332447SN/A    FaultVect vect() {return _vect;}
2342447SN/A    FaultStat & countStat() {return _count;}
2352447SN/A};
2362131SN/A
2372447SN/Aclass DtbPageFault : public MipsFault
2382131SN/A{
2392447SN/A  private:
2402447SN/A    static FaultName _name;
2412447SN/A    static FaultVect _vect;
2422447SN/A    static FaultStat _count;
2432131SN/A  public:
2442447SN/A    FaultName name() {return _name;}
2452447SN/A    FaultVect vect() {return _vect;}
2462447SN/A    FaultStat & countStat() {return _count;}
2472447SN/A};
2482131SN/A
2492447SN/Aclass DtbAcvFault : public MipsFault
2502131SN/A{
2512447SN/A  private:
2522447SN/A    static FaultName _name;
2532447SN/A    static FaultVect _vect;
2542447SN/A    static FaultStat _count;
2552131SN/A  public:
2562447SN/A    FaultName name() {return _name;}
2572447SN/A    FaultVect vect() {return _vect;}
2582447SN/A    FaultStat & countStat() {return _count;}
2592447SN/A};
2602131SN/A
2612447SN/Aclass ItbMissFault : public MipsFault
2622131SN/A{
2632447SN/A  private:
2642447SN/A    static FaultName _name;
2652447SN/A    static FaultVect _vect;
2662447SN/A    static FaultStat _count;
2672131SN/A  public:
2682447SN/A    FaultName name() {return _name;}
2692447SN/A    FaultVect vect() {return _vect;}
2702447SN/A    FaultStat & countStat() {return _count;}
2712447SN/A};
2722131SN/A
2732447SN/Aclass ItbPageFault : public MipsFault
2742131SN/A{
2752447SN/A  private:
2762447SN/A    static FaultName _name;
2772447SN/A    static FaultVect _vect;
2782447SN/A    static FaultStat _count;
2792131SN/A  public:
2802447SN/A    FaultName name() {return _name;}
2812447SN/A    FaultVect vect() {return _vect;}
2822447SN/A    FaultStat & countStat() {return _count;}
2832447SN/A};
2842131SN/A
2852447SN/Aclass ItbAcvFault : public MipsFault
2862131SN/A{
2872447SN/A  private:
2882447SN/A    static FaultName _name;
2892447SN/A    static FaultVect _vect;
2902447SN/A    static FaultStat _count;
2912131SN/A  public:
2922447SN/A    FaultName name() {return _name;}
2932447SN/A    FaultVect vect() {return _vect;}
2942447SN/A    FaultStat & countStat() {return _count;}
2952447SN/A};
2962131SN/A
2972447SN/Aclass FloatEnableFault : public MipsFault
2982131SN/A{
2992447SN/A  private:
3002447SN/A    static FaultName _name;
3012447SN/A    static FaultVect _vect;
3022447SN/A    static FaultStat _count;
3032131SN/A  public:
3042447SN/A    FaultName name() {return _name;}
3052447SN/A    FaultVect vect() {return _vect;}
3062447SN/A    FaultStat & countStat() {return _count;}
3072447SN/A};
3082131SN/A
3092447SN/Aclass IntegerOverflowFault : public MipsFault
3102447SN/A{
3112447SN/A  private:
3122447SN/A    static FaultName _name;
3132447SN/A    static FaultVect _vect;
3142447SN/A    static FaultStat _count;
3152447SN/A  public:
3162447SN/A    FaultName name() {return _name;}
3172447SN/A    FaultVect vect() {return _vect;}
3182447SN/A    FaultStat & countStat() {return _count;}
3192447SN/A};
3202447SN/A
3214661Sksewell@umich.educlass DspStateDisabledFault : public MipsFault
3224661Sksewell@umich.edu{
3234661Sksewell@umich.edu  private:
3244661Sksewell@umich.edu    static FaultName _name;
3254661Sksewell@umich.edu    static FaultVect _vect;
3264661Sksewell@umich.edu    static FaultStat _count;
3274661Sksewell@umich.edu  public:
3284661Sksewell@umich.edu    FaultName name() {return _name;}
3294661Sksewell@umich.edu    FaultVect vect() {return _vect;}
3304661Sksewell@umich.edu    FaultStat & countStat() {return _count;}
3314661Sksewell@umich.edu    void invoke(ThreadContext * tc);
3324661Sksewell@umich.edu};
3334661Sksewell@umich.edu
3342447SN/A} // MipsISA namespace
3352131SN/A
3362131SN/A#endif // __FAULTS_HH__
337