faults.hh revision 2800:18a615ca6e19
1955SN/A/*
2955SN/A * Copyright (c) 2003-2005 The Regents of The University of Michigan
312230Sgiacomo.travaglini@arm.com * All rights reserved.
49812Sandreas.hansson@arm.com *
59812Sandreas.hansson@arm.com * Redistribution and use in source and binary forms, with or without
69812Sandreas.hansson@arm.com * modification, are permitted provided that the following conditions are
79812Sandreas.hansson@arm.com * met: redistributions of source code must retain the above copyright
89812Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer;
99812Sandreas.hansson@arm.com * redistributions in binary form must reproduce the above copyright
109812Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer in the
119812Sandreas.hansson@arm.com * documentation and/or other materials provided with the distribution;
129812Sandreas.hansson@arm.com * neither the name of the copyright holders nor the names of its
139812Sandreas.hansson@arm.com * contributors may be used to endorse or promote products derived from
149812Sandreas.hansson@arm.com * this software without specific prior written permission.
157816Ssteve.reinhardt@amd.com *
165871Snate@binkert.org * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
171762SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18955SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19955SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20955SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21955SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22955SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23955SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24955SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25955SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26955SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27955SN/A *
28955SN/A * Authors: Korey Sewell
29955SN/A */
30955SN/A
31955SN/A#ifndef __MIPS_FAULTS_HH__
32955SN/A#define __MIPS_FAULTS_HH__
33955SN/A
34955SN/A#include "sim/faults.hh"
35955SN/A
36955SN/A// The design of the "name" and "vect" functions is in sim/faults.hh
37955SN/A
38955SN/Anamespace MipsISA
39955SN/A{
40955SN/A
41955SN/Atypedef const Addr FaultVect;
422665Ssaidi@eecs.umich.edu
432665Ssaidi@eecs.umich.educlass MipsFault : public FaultBase
445863Snate@binkert.org{
45955SN/A  protected:
46955SN/A    virtual bool skipFaultingInstruction() {return false;}
47955SN/A    virtual bool setRestartAddress() {return true;}
48955SN/A  public:
49955SN/A#if FULL_SYSTEM
508878Ssteve.reinhardt@amd.com    void invoke(ThreadContext * tc);
512632Sstever@eecs.umich.edu#endif
528878Ssteve.reinhardt@amd.com    virtual FaultVect vect() = 0;
532632Sstever@eecs.umich.edu    virtual FaultStat & countStat() = 0;
54955SN/A};
558878Ssteve.reinhardt@amd.com
562632Sstever@eecs.umich.educlass MachineCheckFault : public MipsFault
572761Sstever@eecs.umich.edu{
582632Sstever@eecs.umich.edu  private:
592632Sstever@eecs.umich.edu    static FaultName _name;
602632Sstever@eecs.umich.edu    static FaultVect _vect;
612761Sstever@eecs.umich.edu    static FaultStat _count;
622761Sstever@eecs.umich.edu  public:
632761Sstever@eecs.umich.edu    FaultName name() {return _name;}
648878Ssteve.reinhardt@amd.com    FaultVect vect() {return _vect;}
658878Ssteve.reinhardt@amd.com    FaultStat & countStat() {return _count;}
662761Sstever@eecs.umich.edu    bool isMachineCheckFault() {return true;}
672761Sstever@eecs.umich.edu};
682761Sstever@eecs.umich.edu
692761Sstever@eecs.umich.educlass AlignmentFault : public MipsFault
702761Sstever@eecs.umich.edu{
718878Ssteve.reinhardt@amd.com  private:
728878Ssteve.reinhardt@amd.com    static FaultName _name;
732632Sstever@eecs.umich.edu    static FaultVect _vect;
742632Sstever@eecs.umich.edu    static FaultStat _count;
758878Ssteve.reinhardt@amd.com  public:
768878Ssteve.reinhardt@amd.com    FaultName name() {return _name;}
772632Sstever@eecs.umich.edu    FaultVect vect() {return _vect;}
78955SN/A    FaultStat & countStat() {return _count;}
79955SN/A    bool isAlignmentFault() {return true;}
80955SN/A};
8112563Sgabeblack@google.com
8212563Sgabeblack@google.com#if !FULL_SYSTEM
836654Snate@binkert.orgclass PageTableFault : public MipsFault
8410196SCurtis.Dunham@arm.com{
85955SN/A  private:
865396Ssaidi@eecs.umich.edu    Addr vaddr;
8711401Sandreas.sandberg@arm.com    static FaultName _name;
885863Snate@binkert.org    static FaultVect _vect;
895863Snate@binkert.org    static FaultStat _count;
904202Sbinkertn@umich.edu  public:
915863Snate@binkert.org    PageTableFault(Addr va)
925863Snate@binkert.org        : vaddr(va) {}
935863Snate@binkert.org    FaultName name() {return _name;}
945863Snate@binkert.org    FaultVect vect() {return _vect;}
9513541Sandrea.mondelli@ucf.edu    FaultStat & countStat() {return _count;}
96955SN/A    void invoke(ThreadContext * tc);
976654Snate@binkert.org};
985273Sstever@gmail.com
995871Snate@binkert.orgstatic inline Fault genPageTableFault(Addr va)
1005273Sstever@gmail.com{
1016654Snate@binkert.org    return new PageTableFault(va);
1025396Ssaidi@eecs.umich.edu}
1038120Sgblack@eecs.umich.edu#endif
1048120Sgblack@eecs.umich.edu
1058120Sgblack@eecs.umich.edu
1068120Sgblack@eecs.umich.edustatic inline Fault genMachineCheckFault()
1078120Sgblack@eecs.umich.edu{
1088120Sgblack@eecs.umich.edu    return new MachineCheckFault;
1098120Sgblack@eecs.umich.edu}
1108120Sgblack@eecs.umich.edu
1118879Ssteve.reinhardt@amd.comstatic inline Fault genAlignmentFault()
1128879Ssteve.reinhardt@amd.com{
1138879Ssteve.reinhardt@amd.com    return new AlignmentFault;
1148879Ssteve.reinhardt@amd.com}
1158879Ssteve.reinhardt@amd.com
1168879Ssteve.reinhardt@amd.comclass ResetFault : public MipsFault
1178879Ssteve.reinhardt@amd.com{
1188879Ssteve.reinhardt@amd.com  private:
1198879Ssteve.reinhardt@amd.com    static FaultName _name;
1208879Ssteve.reinhardt@amd.com    static FaultVect _vect;
1218879Ssteve.reinhardt@amd.com    static FaultStat _count;
1228879Ssteve.reinhardt@amd.com  public:
1238879Ssteve.reinhardt@amd.com    FaultName name() {return _name;}
1248120Sgblack@eecs.umich.edu    FaultVect vect() {return _vect;}
1258120Sgblack@eecs.umich.edu    FaultStat & countStat() {return _count;}
1268120Sgblack@eecs.umich.edu};
1278120Sgblack@eecs.umich.edu
1288120Sgblack@eecs.umich.educlass ArithmeticFault : public MipsFault
1298120Sgblack@eecs.umich.edu{
1308120Sgblack@eecs.umich.edu  protected:
1318120Sgblack@eecs.umich.edu    bool skipFaultingInstruction() {return true;}
1328120Sgblack@eecs.umich.edu  private:
1338120Sgblack@eecs.umich.edu    static FaultName _name;
1348120Sgblack@eecs.umich.edu    static FaultVect _vect;
1358120Sgblack@eecs.umich.edu    static FaultStat _count;
1368120Sgblack@eecs.umich.edu  public:
1378120Sgblack@eecs.umich.edu    FaultName name() {return _name;}
1388879Ssteve.reinhardt@amd.com    FaultVect vect() {return _vect;}
1398879Ssteve.reinhardt@amd.com    FaultStat & countStat() {return _count;}
1408879Ssteve.reinhardt@amd.com#if FULL_SYSTEM
1418879Ssteve.reinhardt@amd.com    void invoke(ThreadContext * tc);
14210458Sandreas.hansson@arm.com#endif
14310458Sandreas.hansson@arm.com};
14410458Sandreas.hansson@arm.com
1458879Ssteve.reinhardt@amd.comclass InterruptFault : public MipsFault
1468879Ssteve.reinhardt@amd.com{
1478879Ssteve.reinhardt@amd.com  protected:
1488879Ssteve.reinhardt@amd.com    bool setRestartAddress() {return false;}
14913421Sciro.santilli@arm.com  private:
15013421Sciro.santilli@arm.com    static FaultName _name;
1519227Sandreas.hansson@arm.com    static FaultVect _vect;
1529227Sandreas.hansson@arm.com    static FaultStat _count;
15312063Sgabeblack@google.com  public:
15412063Sgabeblack@google.com    FaultName name() {return _name;}
15512063Sgabeblack@google.com    FaultVect vect() {return _vect;}
1568879Ssteve.reinhardt@amd.com    FaultStat & countStat() {return _count;}
1578879Ssteve.reinhardt@amd.com};
1588879Ssteve.reinhardt@amd.com
1598879Ssteve.reinhardt@amd.comclass NDtbMissFault : public MipsFault
16010453SAndrew.Bardsley@arm.com{
16110453SAndrew.Bardsley@arm.com  private:
16210453SAndrew.Bardsley@arm.com    static FaultName _name;
16310456SCurtis.Dunham@arm.com    static FaultVect _vect;
16410456SCurtis.Dunham@arm.com    static FaultStat _count;
16510456SCurtis.Dunham@arm.com  public:
16610457Sandreas.hansson@arm.com    FaultName name() {return _name;}
16710457Sandreas.hansson@arm.com    FaultVect vect() {return _vect;}
16811342Sandreas.hansson@arm.com    FaultStat & countStat() {return _count;}
16911342Sandreas.hansson@arm.com};
1708120Sgblack@eecs.umich.edu
17112063Sgabeblack@google.comclass PDtbMissFault : public MipsFault
17212563Sgabeblack@google.com{
17312063Sgabeblack@google.com  private:
17412063Sgabeblack@google.com    static FaultName _name;
1755871Snate@binkert.org    static FaultVect _vect;
1765871Snate@binkert.org    static FaultStat _count;
1776121Snate@binkert.org  public:
1785871Snate@binkert.org    FaultName name() {return _name;}
1795871Snate@binkert.org    FaultVect vect() {return _vect;}
1809926Sstan.czerniawski@arm.com    FaultStat & countStat() {return _count;}
18112243Sgabeblack@google.com};
1821533SN/A
18312246Sgabeblack@google.comclass DtbPageFault : public MipsFault
18412246Sgabeblack@google.com{
18512246Sgabeblack@google.com  private:
18612246Sgabeblack@google.com    static FaultName _name;
1879239Sandreas.hansson@arm.com    static FaultVect _vect;
1889239Sandreas.hansson@arm.com    static FaultStat _count;
1899239Sandreas.hansson@arm.com  public:
1909239Sandreas.hansson@arm.com    FaultName name() {return _name;}
19112563Sgabeblack@google.com    FaultVect vect() {return _vect;}
1929239Sandreas.hansson@arm.com    FaultStat & countStat() {return _count;}
1939239Sandreas.hansson@arm.com};
194955SN/A
195955SN/Aclass DtbAcvFault : public MipsFault
1962632Sstever@eecs.umich.edu{
1972632Sstever@eecs.umich.edu  private:
198955SN/A    static FaultName _name;
199955SN/A    static FaultVect _vect;
200955SN/A    static FaultStat _count;
201955SN/A  public:
2028878Ssteve.reinhardt@amd.com    FaultName name() {return _name;}
203955SN/A    FaultVect vect() {return _vect;}
2042632Sstever@eecs.umich.edu    FaultStat & countStat() {return _count;}
2052632Sstever@eecs.umich.edu};
2062632Sstever@eecs.umich.edu
2072632Sstever@eecs.umich.educlass ItbMissFault : public MipsFault
2082632Sstever@eecs.umich.edu{
2092632Sstever@eecs.umich.edu  private:
2102632Sstever@eecs.umich.edu    static FaultName _name;
2118268Ssteve.reinhardt@amd.com    static FaultVect _vect;
2128268Ssteve.reinhardt@amd.com    static FaultStat _count;
2138268Ssteve.reinhardt@amd.com  public:
2148268Ssteve.reinhardt@amd.com    FaultName name() {return _name;}
2158268Ssteve.reinhardt@amd.com    FaultVect vect() {return _vect;}
2168268Ssteve.reinhardt@amd.com    FaultStat & countStat() {return _count;}
2178268Ssteve.reinhardt@amd.com};
2182632Sstever@eecs.umich.edu
2192632Sstever@eecs.umich.educlass ItbPageFault : public MipsFault
2202632Sstever@eecs.umich.edu{
2212632Sstever@eecs.umich.edu  private:
2228268Ssteve.reinhardt@amd.com    static FaultName _name;
2232632Sstever@eecs.umich.edu    static FaultVect _vect;
2248268Ssteve.reinhardt@amd.com    static FaultStat _count;
2258268Ssteve.reinhardt@amd.com  public:
2268268Ssteve.reinhardt@amd.com    FaultName name() {return _name;}
2278268Ssteve.reinhardt@amd.com    FaultVect vect() {return _vect;}
2283718Sstever@eecs.umich.edu    FaultStat & countStat() {return _count;}
2292634Sstever@eecs.umich.edu};
2302634Sstever@eecs.umich.edu
2315863Snate@binkert.orgclass ItbAcvFault : public MipsFault
2322638Sstever@eecs.umich.edu{
2338268Ssteve.reinhardt@amd.com  private:
2342632Sstever@eecs.umich.edu    static FaultName _name;
2352632Sstever@eecs.umich.edu    static FaultVect _vect;
2362632Sstever@eecs.umich.edu    static FaultStat _count;
2372632Sstever@eecs.umich.edu  public:
23812563Sgabeblack@google.com    FaultName name() {return _name;}
2391858SN/A    FaultVect vect() {return _vect;}
2403716Sstever@eecs.umich.edu    FaultStat & countStat() {return _count;}
2412638Sstever@eecs.umich.edu};
2422638Sstever@eecs.umich.edu
2432638Sstever@eecs.umich.educlass UnimplementedOpcodeFault : public MipsFault
2442638Sstever@eecs.umich.edu{
24512563Sgabeblack@google.com  private:
24612563Sgabeblack@google.com    static FaultName _name;
2472638Sstever@eecs.umich.edu    static FaultVect _vect;
2485863Snate@binkert.org    static FaultStat _count;
2495863Snate@binkert.org  public:
2505863Snate@binkert.org    FaultName name() {return _name;}
251955SN/A    FaultVect vect() {return _vect;}
2525341Sstever@gmail.com    FaultStat & countStat() {return _count;}
2535341Sstever@gmail.com};
2545863Snate@binkert.org
2557756SAli.Saidi@ARM.comclass FloatEnableFault : public MipsFault
2565341Sstever@gmail.com{
2576121Snate@binkert.org  private:
2584494Ssaidi@eecs.umich.edu    static FaultName _name;
2596121Snate@binkert.org    static FaultVect _vect;
2601105SN/A    static FaultStat _count;
2612667Sstever@eecs.umich.edu  public:
2622667Sstever@eecs.umich.edu    FaultName name() {return _name;}
2632667Sstever@eecs.umich.edu    FaultVect vect() {return _vect;}
2642667Sstever@eecs.umich.edu    FaultStat & countStat() {return _count;}
2656121Snate@binkert.org};
2662667Sstever@eecs.umich.edu
2675341Sstever@gmail.comclass PalFault : public MipsFault
2685863Snate@binkert.org{
2695341Sstever@gmail.com  protected:
2705341Sstever@gmail.com    bool skipFaultingInstruction() {return true;}
2715341Sstever@gmail.com  private:
2728120Sgblack@eecs.umich.edu    static FaultName _name;
2735341Sstever@gmail.com    static FaultVect _vect;
2748120Sgblack@eecs.umich.edu    static FaultStat _count;
2755341Sstever@gmail.com  public:
2768120Sgblack@eecs.umich.edu    FaultName name() {return _name;}
2776121Snate@binkert.org    FaultVect vect() {return _vect;}
2786121Snate@binkert.org    FaultStat & countStat() {return _count;}
2799396Sandreas.hansson@arm.com};
2805397Ssaidi@eecs.umich.edu
2815397Ssaidi@eecs.umich.educlass IntegerOverflowFault : public MipsFault
2827727SAli.Saidi@ARM.com{
2838268Ssteve.reinhardt@amd.com  private:
2846168Snate@binkert.org    static FaultName _name;
2855341Sstever@gmail.com    static FaultVect _vect;
2868120Sgblack@eecs.umich.edu    static FaultStat _count;
2878120Sgblack@eecs.umich.edu  public:
2888120Sgblack@eecs.umich.edu    FaultName name() {return _name;}
2896814Sgblack@eecs.umich.edu    FaultVect vect() {return _vect;}
2905863Snate@binkert.org    FaultStat & countStat() {return _count;}
2918120Sgblack@eecs.umich.edu};
2925341Sstever@gmail.com
2935863Snate@binkert.org} // MipsISA namespace
2948268Ssteve.reinhardt@amd.com
2956121Snate@binkert.org#endif // __FAULTS_HH__
2966121Snate@binkert.org