faults.hh revision 6009
14120Sgblack@eecs.umich.edu/*
24120Sgblack@eecs.umich.edu * Copyright (c) 2007 The Hewlett-Packard Development Company
34120Sgblack@eecs.umich.edu * All rights reserved.
44120Sgblack@eecs.umich.edu *
54120Sgblack@eecs.umich.edu * Redistribution and use of this software in source and binary forms,
64120Sgblack@eecs.umich.edu * with or without modification, are permitted provided that the
74120Sgblack@eecs.umich.edu * following conditions are met:
84120Sgblack@eecs.umich.edu *
94120Sgblack@eecs.umich.edu * The software must be used only for Non-Commercial Use which means any
104120Sgblack@eecs.umich.edu * use which is NOT directed to receiving any direct monetary
114120Sgblack@eecs.umich.edu * compensation for, or commercial advantage from such use.  Illustrative
124120Sgblack@eecs.umich.edu * examples of non-commercial use are academic research, personal study,
134120Sgblack@eecs.umich.edu * teaching, education and corporate research & development.
144120Sgblack@eecs.umich.edu * Illustrative examples of commercial use are distributing products for
154120Sgblack@eecs.umich.edu * commercial advantage and providing services using the software for
164120Sgblack@eecs.umich.edu * commercial advantage.
174120Sgblack@eecs.umich.edu *
184120Sgblack@eecs.umich.edu * If you wish to use this software or functionality therein that may be
194120Sgblack@eecs.umich.edu * covered by patents for commercial use, please contact:
204120Sgblack@eecs.umich.edu *     Director of Intellectual Property Licensing
214120Sgblack@eecs.umich.edu *     Office of Strategy and Technology
224120Sgblack@eecs.umich.edu *     Hewlett-Packard Company
234120Sgblack@eecs.umich.edu *     1501 Page Mill Road
244120Sgblack@eecs.umich.edu *     Palo Alto, California  94304
254120Sgblack@eecs.umich.edu *
264120Sgblack@eecs.umich.edu * Redistributions of source code must retain the above copyright notice,
274120Sgblack@eecs.umich.edu * this list of conditions and the following disclaimer.  Redistributions
284120Sgblack@eecs.umich.edu * in binary form must reproduce the above copyright notice, this list of
294120Sgblack@eecs.umich.edu * conditions and the following disclaimer in the documentation and/or
304120Sgblack@eecs.umich.edu * other materials provided with the distribution.  Neither the name of
314120Sgblack@eecs.umich.edu * the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
324120Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from
334120Sgblack@eecs.umich.edu * this software without specific prior written permission.  No right of
344120Sgblack@eecs.umich.edu * sublicense is granted herewith.  Derivatives of the software and
354120Sgblack@eecs.umich.edu * output created using the software may be prepared, but only for
364120Sgblack@eecs.umich.edu * Non-Commercial Uses.  Derivatives of the software may be shared with
374120Sgblack@eecs.umich.edu * others provided: (i) the others agree to abide by the list of
384120Sgblack@eecs.umich.edu * conditions herein which includes the Non-Commercial Use restrictions;
394120Sgblack@eecs.umich.edu * and (ii) such Derivatives of the software include the above copyright
404120Sgblack@eecs.umich.edu * notice to acknowledge the contribution from this software where
414120Sgblack@eecs.umich.edu * applicable, this list of conditions and the disclaimer below.
424120Sgblack@eecs.umich.edu *
434120Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
444120Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
454120Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
464120Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
474120Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
484120Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
494120Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
504120Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
514120Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
524120Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
534120Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
544120Sgblack@eecs.umich.edu *
554120Sgblack@eecs.umich.edu * Authors: Gabe Black
564120Sgblack@eecs.umich.edu */
574120Sgblack@eecs.umich.edu
584120Sgblack@eecs.umich.edu#ifndef __ARCH_X86_FAULTS_HH__
594120Sgblack@eecs.umich.edu#define __ARCH_X86_FAULTS_HH__
604120Sgblack@eecs.umich.edu
615857Sgblack@eecs.umich.edu#include "base/bitunion.hh"
624139Sgblack@eecs.umich.edu#include "base/misc.hh"
634135Sgblack@eecs.umich.edu#include "sim/faults.hh"
644120Sgblack@eecs.umich.edu
655909Sgblack@eecs.umich.edu#include <string>
665909Sgblack@eecs.umich.edu
674120Sgblack@eecs.umich.edunamespace X86ISA
684120Sgblack@eecs.umich.edu{
695114Sgblack@eecs.umich.edu    // Base class for all x86 "faults" where faults is in the m5 sense
705114Sgblack@eecs.umich.edu    class X86FaultBase : public FaultBase
714135Sgblack@eecs.umich.edu    {
724365Sgblack@eecs.umich.edu      protected:
735114Sgblack@eecs.umich.edu        const char * faultName;
745114Sgblack@eecs.umich.edu        const char * mnem;
755851Sgblack@eecs.umich.edu        uint8_t vector;
765139Sgblack@eecs.umich.edu        uint64_t errorCode;
775114Sgblack@eecs.umich.edu
785139Sgblack@eecs.umich.edu        X86FaultBase(const char * _faultName, const char * _mnem,
796009Snate@binkert.org                     const uint8_t _vector, uint64_t _errorCode = (uint64_t)-1)
806009Snate@binkert.org            : faultName(_faultName), mnem(_mnem),
816009Snate@binkert.org              vector(_vector), errorCode(_errorCode)
825114Sgblack@eecs.umich.edu        {
835114Sgblack@eecs.umich.edu        }
845114Sgblack@eecs.umich.edu
854729Sgblack@eecs.umich.edu        const char * name() const
864365Sgblack@eecs.umich.edu        {
875114Sgblack@eecs.umich.edu            return faultName;
884365Sgblack@eecs.umich.edu        }
894365Sgblack@eecs.umich.edu
905114Sgblack@eecs.umich.edu        virtual bool isBenign()
915114Sgblack@eecs.umich.edu        {
925114Sgblack@eecs.umich.edu            return true;
935114Sgblack@eecs.umich.edu        }
945114Sgblack@eecs.umich.edu
955114Sgblack@eecs.umich.edu        virtual const char * mnemonic() const
965114Sgblack@eecs.umich.edu        {
975114Sgblack@eecs.umich.edu            return mnem;
985114Sgblack@eecs.umich.edu        }
995684Sgblack@eecs.umich.edu
1005858Sgblack@eecs.umich.edu        virtual bool isSoft()
1015684Sgblack@eecs.umich.edu        {
1025858Sgblack@eecs.umich.edu            return false;
1035684Sgblack@eecs.umich.edu        }
1045858Sgblack@eecs.umich.edu
1055858Sgblack@eecs.umich.edu#if FULL_SYSTEM
1065858Sgblack@eecs.umich.edu        void invoke(ThreadContext * tc);
1075909Sgblack@eecs.umich.edu
1085909Sgblack@eecs.umich.edu        virtual std::string describe() const;
1095858Sgblack@eecs.umich.edu#endif
1105114Sgblack@eecs.umich.edu    };
1115114Sgblack@eecs.umich.edu
1125114Sgblack@eecs.umich.edu    // Base class for x86 faults which behave as if the underlying instruction
1135114Sgblack@eecs.umich.edu    // didn't happen.
1145114Sgblack@eecs.umich.edu    class X86Fault : public X86FaultBase
1155114Sgblack@eecs.umich.edu    {
1165114Sgblack@eecs.umich.edu      protected:
1175139Sgblack@eecs.umich.edu        X86Fault(const char * name, const char * mnem,
1186009Snate@binkert.org                 const uint8_t vector, uint64_t _errorCode = (uint64_t)-1)
1196009Snate@binkert.org            : X86FaultBase(name, mnem, vector, _errorCode)
1205114Sgblack@eecs.umich.edu        {}
1215114Sgblack@eecs.umich.edu    };
1225114Sgblack@eecs.umich.edu
1235114Sgblack@eecs.umich.edu    // Base class for x86 traps which behave as if the underlying instruction
1245114Sgblack@eecs.umich.edu    // completed.
1255114Sgblack@eecs.umich.edu    class X86Trap : public X86FaultBase
1265114Sgblack@eecs.umich.edu    {
1275114Sgblack@eecs.umich.edu      protected:
1285139Sgblack@eecs.umich.edu        X86Trap(const char * name, const char * mnem,
1296009Snate@binkert.org                const uint8_t vector, uint64_t _errorCode = (uint64_t)-1)
1306009Snate@binkert.org            : X86FaultBase(name, mnem, vector, _errorCode)
1315114Sgblack@eecs.umich.edu        {}
1325114Sgblack@eecs.umich.edu
1335114Sgblack@eecs.umich.edu#if FULL_SYSTEM
1345124Sgblack@eecs.umich.edu        void invoke(ThreadContext * tc);
1355114Sgblack@eecs.umich.edu#endif
1365114Sgblack@eecs.umich.edu    };
1375114Sgblack@eecs.umich.edu
1385114Sgblack@eecs.umich.edu    // Base class for x86 aborts which seem to be catastrophic failures.
1395114Sgblack@eecs.umich.edu    class X86Abort : public X86FaultBase
1405114Sgblack@eecs.umich.edu    {
1415114Sgblack@eecs.umich.edu      protected:
1425139Sgblack@eecs.umich.edu        X86Abort(const char * name, const char * mnem,
1436009Snate@binkert.org                const uint8_t vector, uint64_t _errorCode = (uint64_t)-1)
1446009Snate@binkert.org            : X86FaultBase(name, mnem, vector, _errorCode)
1455114Sgblack@eecs.umich.edu        {}
1465114Sgblack@eecs.umich.edu
1475114Sgblack@eecs.umich.edu#if FULL_SYSTEM
1485124Sgblack@eecs.umich.edu        void invoke(ThreadContext * tc);
1495114Sgblack@eecs.umich.edu#endif
1505114Sgblack@eecs.umich.edu    };
1515114Sgblack@eecs.umich.edu
1525114Sgblack@eecs.umich.edu    // Base class for x86 interrupts.
1535114Sgblack@eecs.umich.edu    class X86Interrupt : public X86FaultBase
1545114Sgblack@eecs.umich.edu    {
1555114Sgblack@eecs.umich.edu      protected:
1565851Sgblack@eecs.umich.edu        X86Interrupt(const char * name, const char * mnem,
1576009Snate@binkert.org                const uint8_t _vector, uint64_t _errorCode = (uint64_t)-1)
1586009Snate@binkert.org            : X86FaultBase(name, mnem, _vector, _errorCode)
1595114Sgblack@eecs.umich.edu        {}
1604135Sgblack@eecs.umich.edu    };
1614150Sgblack@eecs.umich.edu
1624365Sgblack@eecs.umich.edu    class UnimpInstFault : public FaultBase
1634365Sgblack@eecs.umich.edu    {
1644365Sgblack@eecs.umich.edu      public:
1654729Sgblack@eecs.umich.edu        const char * name() const
1664365Sgblack@eecs.umich.edu        {
1674365Sgblack@eecs.umich.edu            return "unimplemented_micro";
1684365Sgblack@eecs.umich.edu        }
1694365Sgblack@eecs.umich.edu
1704365Sgblack@eecs.umich.edu        void invoke(ThreadContext * tc)
1714365Sgblack@eecs.umich.edu        {
1724365Sgblack@eecs.umich.edu            panic("Unimplemented instruction!");
1734365Sgblack@eecs.umich.edu        }
1744365Sgblack@eecs.umich.edu    };
1754365Sgblack@eecs.umich.edu
1764150Sgblack@eecs.umich.edu    static inline Fault genMachineCheckFault()
1774150Sgblack@eecs.umich.edu    {
1784150Sgblack@eecs.umich.edu        panic("Machine check fault not implemented in x86!\n");
1794150Sgblack@eecs.umich.edu    }
1805114Sgblack@eecs.umich.edu
1815114Sgblack@eecs.umich.edu    // Below is a summary of the interrupt/exception information in the
1825114Sgblack@eecs.umich.edu    // architecture manuals.
1835114Sgblack@eecs.umich.edu
1845114Sgblack@eecs.umich.edu    // Class  |  Type    | vector |               Cause                 | mnem
1855114Sgblack@eecs.umich.edu    //------------------------------------------------------------------------
1865114Sgblack@eecs.umich.edu    //Contrib   Fault     0         Divide-by-Zero-Error                  #DE
1875114Sgblack@eecs.umich.edu    //Benign    Either    1         Debug                                 #DB
1885114Sgblack@eecs.umich.edu    //Benign    Interrupt 2         Non-Maskable-Interrupt                #NMI
1895114Sgblack@eecs.umich.edu    //Benign    Trap      3         Breakpoint                            #BP
1905114Sgblack@eecs.umich.edu    //Benign    Trap      4         Overflow                              #OF
1915114Sgblack@eecs.umich.edu    //Benign    Fault     5         Bound-Range                           #BR
1925114Sgblack@eecs.umich.edu    //Benign    Fault     6         Invalid-Opcode                        #UD
1935114Sgblack@eecs.umich.edu    //Benign    Fault     7         Device-Not-Available                  #NM
1945114Sgblack@eecs.umich.edu    //Benign    Abort     8         Double-Fault                          #DF
1955114Sgblack@eecs.umich.edu    //                    9         Coprocessor-Segment-Overrun
1965114Sgblack@eecs.umich.edu    //Contrib   Fault     10        Invalid-TSS                           #TS
1975114Sgblack@eecs.umich.edu    //Contrib   Fault     11        Segment-Not-Present                   #NP
1985114Sgblack@eecs.umich.edu    //Contrib   Fault     12        Stack                                 #SS
1995114Sgblack@eecs.umich.edu    //Contrib   Fault     13        General-Protection                    #GP
2005114Sgblack@eecs.umich.edu    //Either    Fault     14        Page-Fault                            #PF
2015114Sgblack@eecs.umich.edu    //                    15        Reserved
2025114Sgblack@eecs.umich.edu    //Benign    Fault     16        x87 Floating-Point Exception Pending  #MF
2035114Sgblack@eecs.umich.edu    //Benign    Fault     17        Alignment-Check                       #AC
2045114Sgblack@eecs.umich.edu    //Benign    Abort     18        Machine-Check                         #MC
2055114Sgblack@eecs.umich.edu    //Benign    Fault     19        SIMD Floating-Point                   #XF
2065114Sgblack@eecs.umich.edu    //                    20-29     Reserved
2075114Sgblack@eecs.umich.edu    //Contrib   ?         30        Security Exception                    #SX
2085114Sgblack@eecs.umich.edu    //                    31        Reserved
2095114Sgblack@eecs.umich.edu    //Benign    Interrupt 0-255     External Interrupts                   #INTR
2105114Sgblack@eecs.umich.edu    //Benign    Interrupt 0-255     Software Interrupts                   INTn
2115114Sgblack@eecs.umich.edu
2125114Sgblack@eecs.umich.edu    class DivideByZero : public X86Fault
2135114Sgblack@eecs.umich.edu    {
2145114Sgblack@eecs.umich.edu      public:
2155114Sgblack@eecs.umich.edu        DivideByZero() :
2165851Sgblack@eecs.umich.edu            X86Fault("Divide-by-Zero-Error", "#DE", 0)
2175114Sgblack@eecs.umich.edu        {}
2185114Sgblack@eecs.umich.edu    };
2195114Sgblack@eecs.umich.edu
2205114Sgblack@eecs.umich.edu    class DebugException : public X86FaultBase
2215114Sgblack@eecs.umich.edu    {
2225114Sgblack@eecs.umich.edu      public:
2235114Sgblack@eecs.umich.edu        DebugException() :
2245851Sgblack@eecs.umich.edu            X86FaultBase("Debug", "#DB", 1)
2255114Sgblack@eecs.umich.edu        {}
2265114Sgblack@eecs.umich.edu    };
2275114Sgblack@eecs.umich.edu
2285114Sgblack@eecs.umich.edu    class NonMaskableInterrupt : public X86Interrupt
2295114Sgblack@eecs.umich.edu    {
2305114Sgblack@eecs.umich.edu      public:
2315655Sgblack@eecs.umich.edu        NonMaskableInterrupt(uint8_t _vector) :
2325851Sgblack@eecs.umich.edu            X86Interrupt("Non Maskable Interrupt", "#NMI", 2, _vector)
2335114Sgblack@eecs.umich.edu        {}
2345114Sgblack@eecs.umich.edu    };
2355114Sgblack@eecs.umich.edu
2365114Sgblack@eecs.umich.edu    class Breakpoint : public X86Trap
2375114Sgblack@eecs.umich.edu    {
2385114Sgblack@eecs.umich.edu      public:
2395114Sgblack@eecs.umich.edu        Breakpoint() :
2405851Sgblack@eecs.umich.edu            X86Trap("Breakpoint", "#BP", 3)
2415114Sgblack@eecs.umich.edu        {}
2425114Sgblack@eecs.umich.edu    };
2435114Sgblack@eecs.umich.edu
2445114Sgblack@eecs.umich.edu    class OverflowTrap : public X86Trap
2455114Sgblack@eecs.umich.edu    {
2465114Sgblack@eecs.umich.edu      public:
2475114Sgblack@eecs.umich.edu        OverflowTrap() :
2485851Sgblack@eecs.umich.edu            X86Trap("Overflow", "#OF", 4)
2495114Sgblack@eecs.umich.edu        {}
2505114Sgblack@eecs.umich.edu    };
2515114Sgblack@eecs.umich.edu
2525114Sgblack@eecs.umich.edu    class BoundRange : public X86Fault
2535114Sgblack@eecs.umich.edu    {
2545114Sgblack@eecs.umich.edu      public:
2555114Sgblack@eecs.umich.edu        BoundRange() :
2565851Sgblack@eecs.umich.edu            X86Fault("Bound-Range", "#BR", 5)
2575114Sgblack@eecs.umich.edu        {}
2585114Sgblack@eecs.umich.edu    };
2595114Sgblack@eecs.umich.edu
2605114Sgblack@eecs.umich.edu    class InvalidOpcode : public X86Fault
2615114Sgblack@eecs.umich.edu    {
2625114Sgblack@eecs.umich.edu      public:
2635114Sgblack@eecs.umich.edu        InvalidOpcode() :
2645851Sgblack@eecs.umich.edu            X86Fault("Invalid-Opcode", "#UD", 6)
2655114Sgblack@eecs.umich.edu        {}
2665114Sgblack@eecs.umich.edu    };
2675114Sgblack@eecs.umich.edu
2685114Sgblack@eecs.umich.edu    class DeviceNotAvailable : public X86Fault
2695114Sgblack@eecs.umich.edu    {
2705114Sgblack@eecs.umich.edu      public:
2715114Sgblack@eecs.umich.edu        DeviceNotAvailable() :
2725851Sgblack@eecs.umich.edu            X86Fault("Device-Not-Available", "#NM", 7)
2735114Sgblack@eecs.umich.edu        {}
2745114Sgblack@eecs.umich.edu    };
2755114Sgblack@eecs.umich.edu
2765114Sgblack@eecs.umich.edu    class DoubleFault : public X86Abort
2775114Sgblack@eecs.umich.edu    {
2785114Sgblack@eecs.umich.edu      public:
2795114Sgblack@eecs.umich.edu        DoubleFault() :
2805857Sgblack@eecs.umich.edu            X86Abort("Double-Fault", "#DF", 8, 0)
2815114Sgblack@eecs.umich.edu        {}
2825114Sgblack@eecs.umich.edu    };
2835114Sgblack@eecs.umich.edu
2845114Sgblack@eecs.umich.edu    class InvalidTSS : public X86Fault
2855114Sgblack@eecs.umich.edu    {
2865114Sgblack@eecs.umich.edu      public:
2875857Sgblack@eecs.umich.edu        InvalidTSS(uint32_t _errorCode) :
2885857Sgblack@eecs.umich.edu            X86Fault("Invalid-TSS", "#TS", 10, _errorCode)
2895114Sgblack@eecs.umich.edu        {}
2905114Sgblack@eecs.umich.edu    };
2915114Sgblack@eecs.umich.edu
2925114Sgblack@eecs.umich.edu    class SegmentNotPresent : public X86Fault
2935114Sgblack@eecs.umich.edu    {
2945114Sgblack@eecs.umich.edu      public:
2955857Sgblack@eecs.umich.edu        SegmentNotPresent(uint32_t _errorCode) :
2965857Sgblack@eecs.umich.edu            X86Fault("Segment-Not-Present", "#NP", 11, _errorCode)
2975114Sgblack@eecs.umich.edu        {}
2985114Sgblack@eecs.umich.edu    };
2995114Sgblack@eecs.umich.edu
3005114Sgblack@eecs.umich.edu    class StackFault : public X86Fault
3015114Sgblack@eecs.umich.edu    {
3025114Sgblack@eecs.umich.edu      public:
3035857Sgblack@eecs.umich.edu        StackFault(uint32_t _errorCode) :
3045857Sgblack@eecs.umich.edu            X86Fault("Stack", "#SS", 12, _errorCode)
3055114Sgblack@eecs.umich.edu        {}
3065114Sgblack@eecs.umich.edu    };
3075114Sgblack@eecs.umich.edu
3085114Sgblack@eecs.umich.edu    class GeneralProtection : public X86Fault
3095114Sgblack@eecs.umich.edu    {
3105114Sgblack@eecs.umich.edu      public:
3115857Sgblack@eecs.umich.edu        GeneralProtection(uint32_t _errorCode) :
3125851Sgblack@eecs.umich.edu            X86Fault("General-Protection", "#GP", 13, _errorCode)
3135114Sgblack@eecs.umich.edu        {}
3145114Sgblack@eecs.umich.edu    };
3155114Sgblack@eecs.umich.edu
3165114Sgblack@eecs.umich.edu    class PageFault : public X86Fault
3175114Sgblack@eecs.umich.edu    {
3185857Sgblack@eecs.umich.edu      protected:
3195857Sgblack@eecs.umich.edu        BitUnion32(PageFaultErrorCode)
3205857Sgblack@eecs.umich.edu            Bitfield<0> present;
3215857Sgblack@eecs.umich.edu            Bitfield<1> write;
3225857Sgblack@eecs.umich.edu            Bitfield<2> user;
3235857Sgblack@eecs.umich.edu            Bitfield<3> reserved;
3245857Sgblack@eecs.umich.edu            Bitfield<4> fetch;
3255857Sgblack@eecs.umich.edu        EndBitUnion(PageFaultErrorCode)
3265857Sgblack@eecs.umich.edu
3275858Sgblack@eecs.umich.edu        Addr addr;
3285858Sgblack@eecs.umich.edu
3295114Sgblack@eecs.umich.edu      public:
3305858Sgblack@eecs.umich.edu        PageFault(Addr _addr, uint32_t _errorCode) :
3315858Sgblack@eecs.umich.edu            X86Fault("Page-Fault", "#PF", 14, _errorCode), addr(_addr)
3325114Sgblack@eecs.umich.edu        {}
3335858Sgblack@eecs.umich.edu
3345858Sgblack@eecs.umich.edu        PageFault(Addr _addr, bool present, bool write,
3355858Sgblack@eecs.umich.edu                bool user, bool reserved, bool fetch) :
3365858Sgblack@eecs.umich.edu            X86Fault("Page-Fault", "#PF", 14, 0), addr(_addr)
3375857Sgblack@eecs.umich.edu        {
3385857Sgblack@eecs.umich.edu            PageFaultErrorCode code = 0;
3395857Sgblack@eecs.umich.edu            code.present = present;
3405857Sgblack@eecs.umich.edu            code.write = write;
3415857Sgblack@eecs.umich.edu            code.user = user;
3425857Sgblack@eecs.umich.edu            code.reserved = reserved;
3435857Sgblack@eecs.umich.edu            code.fetch = fetch;
3445857Sgblack@eecs.umich.edu            errorCode = code;
3455857Sgblack@eecs.umich.edu        }
3465858Sgblack@eecs.umich.edu
3475858Sgblack@eecs.umich.edu#if FULL_SYSTEM
3485858Sgblack@eecs.umich.edu        void invoke(ThreadContext * tc);
3495909Sgblack@eecs.umich.edu
3505909Sgblack@eecs.umich.edu        virtual std::string describe() const;
3515858Sgblack@eecs.umich.edu#endif
3525114Sgblack@eecs.umich.edu    };
3535114Sgblack@eecs.umich.edu
3545114Sgblack@eecs.umich.edu    class X87FpExceptionPending : public X86Fault
3555114Sgblack@eecs.umich.edu    {
3565114Sgblack@eecs.umich.edu      public:
3575114Sgblack@eecs.umich.edu        X87FpExceptionPending() :
3585851Sgblack@eecs.umich.edu            X86Fault("x87 Floating-Point Exception Pending", "#MF", 16)
3595114Sgblack@eecs.umich.edu        {}
3605114Sgblack@eecs.umich.edu    };
3615114Sgblack@eecs.umich.edu
3625652Sgblack@eecs.umich.edu    class AlignmentCheck : public X86Fault
3635114Sgblack@eecs.umich.edu    {
3645114Sgblack@eecs.umich.edu      public:
3655114Sgblack@eecs.umich.edu        AlignmentCheck() :
3665857Sgblack@eecs.umich.edu            X86Fault("Alignment-Check", "#AC", 17, 0)
3675114Sgblack@eecs.umich.edu        {}
3685114Sgblack@eecs.umich.edu    };
3695114Sgblack@eecs.umich.edu
3705652Sgblack@eecs.umich.edu    class MachineCheck : public X86Abort
3715114Sgblack@eecs.umich.edu    {
3725114Sgblack@eecs.umich.edu      public:
3735114Sgblack@eecs.umich.edu        MachineCheck() :
3745851Sgblack@eecs.umich.edu            X86Abort("Machine-Check", "#MC", 18)
3755114Sgblack@eecs.umich.edu        {}
3765114Sgblack@eecs.umich.edu    };
3775114Sgblack@eecs.umich.edu
3785652Sgblack@eecs.umich.edu    class SIMDFloatingPointFault : public X86Fault
3795114Sgblack@eecs.umich.edu    {
3805114Sgblack@eecs.umich.edu      public:
3815114Sgblack@eecs.umich.edu        SIMDFloatingPointFault() :
3825851Sgblack@eecs.umich.edu            X86Fault("SIMD Floating-Point", "#XF", 19)
3835114Sgblack@eecs.umich.edu        {}
3845114Sgblack@eecs.umich.edu    };
3855114Sgblack@eecs.umich.edu
3865652Sgblack@eecs.umich.edu    class SecurityException : public X86FaultBase
3875114Sgblack@eecs.umich.edu    {
3885114Sgblack@eecs.umich.edu      public:
3895114Sgblack@eecs.umich.edu        SecurityException() :
3905851Sgblack@eecs.umich.edu            X86FaultBase("Security Exception", "#SX", 30)
3915114Sgblack@eecs.umich.edu        {}
3925114Sgblack@eecs.umich.edu    };
3935114Sgblack@eecs.umich.edu
3945652Sgblack@eecs.umich.edu    class ExternalInterrupt : public X86Interrupt
3955114Sgblack@eecs.umich.edu    {
3965114Sgblack@eecs.umich.edu      public:
3975654Sgblack@eecs.umich.edu        ExternalInterrupt(uint8_t _vector) :
3985681Sgblack@eecs.umich.edu            X86Interrupt("External Interrupt", "#INTR", _vector)
3995114Sgblack@eecs.umich.edu        {}
4005114Sgblack@eecs.umich.edu    };
4015114Sgblack@eecs.umich.edu
4025655Sgblack@eecs.umich.edu    class SystemManagementInterrupt : public X86Interrupt
4035655Sgblack@eecs.umich.edu    {
4045655Sgblack@eecs.umich.edu      public:
4055655Sgblack@eecs.umich.edu        SystemManagementInterrupt() :
4065681Sgblack@eecs.umich.edu            X86Interrupt("System Management Interrupt", "#SMI", 0)
4075655Sgblack@eecs.umich.edu        {}
4085655Sgblack@eecs.umich.edu    };
4095655Sgblack@eecs.umich.edu
4105655Sgblack@eecs.umich.edu    class InitInterrupt : public X86Interrupt
4115655Sgblack@eecs.umich.edu    {
4125655Sgblack@eecs.umich.edu        uint8_t vector;
4135655Sgblack@eecs.umich.edu      public:
4145655Sgblack@eecs.umich.edu        InitInterrupt(uint8_t _vector) :
4155681Sgblack@eecs.umich.edu            X86Interrupt("INIT Interrupt", "#INIT", _vector)
4165655Sgblack@eecs.umich.edu        {}
4175655Sgblack@eecs.umich.edu    };
4185655Sgblack@eecs.umich.edu
4195652Sgblack@eecs.umich.edu    class SoftwareInterrupt : public X86Interrupt
4205114Sgblack@eecs.umich.edu    {
4215114Sgblack@eecs.umich.edu      public:
4225681Sgblack@eecs.umich.edu        SoftwareInterrupt(uint8_t _vector) :
4235909Sgblack@eecs.umich.edu            X86Interrupt("Software Interrupt", "#INTR", _vector)
4245114Sgblack@eecs.umich.edu        {}
4255858Sgblack@eecs.umich.edu
4265858Sgblack@eecs.umich.edu        bool isSoft()
4275858Sgblack@eecs.umich.edu        {
4285858Sgblack@eecs.umich.edu            return true;
4295858Sgblack@eecs.umich.edu        }
4305114Sgblack@eecs.umich.edu    };
4314120Sgblack@eecs.umich.edu};
4324120Sgblack@eecs.umich.edu
4334120Sgblack@eecs.umich.edu#endif // __ARCH_X86_FAULTS_HH__
434