faults.hh revision 8566
12131SN/A/* 25268Sksewell@umich.edu * Copyright (c) 2003-2005 The Regents of The University of Michigan 35224Sksewell@umich.edu * Copyright (c) 2007 MIPS Technologies, Inc. 45224Sksewell@umich.edu * All rights reserved. 52131SN/A * 65224Sksewell@umich.edu * Redistribution and use in source and binary forms, with or without 75224Sksewell@umich.edu * modification, are permitted provided that the following conditions are 85224Sksewell@umich.edu * met: redistributions of source code must retain the above copyright 95224Sksewell@umich.edu * notice, this list of conditions and the following disclaimer; 105224Sksewell@umich.edu * redistributions in binary form must reproduce the above copyright 115224Sksewell@umich.edu * notice, this list of conditions and the following disclaimer in the 125224Sksewell@umich.edu * documentation and/or other materials provided with the distribution; 135224Sksewell@umich.edu * neither the name of the copyright holders nor the names of its 145224Sksewell@umich.edu * contributors may be used to endorse or promote products derived from 155224Sksewell@umich.edu * this software without specific prior written permission. 162131SN/A * 175224Sksewell@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 185224Sksewell@umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 195224Sksewell@umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 205224Sksewell@umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 215224Sksewell@umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 225224Sksewell@umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 235224Sksewell@umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 245224Sksewell@umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 255224Sksewell@umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 265224Sksewell@umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 275224Sksewell@umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 282665Ssaidi@eecs.umich.edu * 295224Sksewell@umich.edu * Authors: Gabe Black 305224Sksewell@umich.edu * Korey Sewell 315222Sksewell@umich.edu * Jaidev Patwardhan 322131SN/A */ 332131SN/A 342239SN/A#ifndef __MIPS_FAULTS_HH__ 352239SN/A#define __MIPS_FAULTS_HH__ 362131SN/A 372131SN/A#include "sim/faults.hh" 382447SN/A 392447SN/Anamespace MipsISA 402447SN/A{ 416378Sgblack@eecs.umich.edu 422447SN/Atypedef const Addr FaultVect; 432131SN/A 448566Sgblack@eecs.umich.educlass MipsFaultBase : public FaultBase 452131SN/A{ 462447SN/A protected: 472447SN/A virtual bool skipFaultingInstruction() {return false;} 482447SN/A virtual bool setRestartAddress() {return true;} 492131SN/A public: 508566Sgblack@eecs.umich.edu struct FaultVals 518566Sgblack@eecs.umich.edu { 528566Sgblack@eecs.umich.edu const FaultName name; 538566Sgblack@eecs.umich.edu const FaultVect vect; 548566Sgblack@eecs.umich.edu FaultStat count; 558566Sgblack@eecs.umich.edu }; 568566Sgblack@eecs.umich.edu 576379Sgblack@eecs.umich.edu Addr badVAddr; 586379Sgblack@eecs.umich.edu Addr entryHiAsid; 596379Sgblack@eecs.umich.edu Addr entryHiVPN2; 606379Sgblack@eecs.umich.edu Addr entryHiVPN2X; 616379Sgblack@eecs.umich.edu Addr contextBadVPN2; 622447SN/A#if FULL_SYSTEM 637678Sgblack@eecs.umich.edu void invoke(ThreadContext * tc, 647678Sgblack@eecs.umich.edu StaticInst::StaticInstPtr inst = StaticInst::nullStaticInstPtr) 657678Sgblack@eecs.umich.edu {} 666378Sgblack@eecs.umich.edu void setExceptionState(ThreadContext *, uint8_t); 676378Sgblack@eecs.umich.edu void setHandlerPC(Addr, ThreadContext *); 682447SN/A#endif 692131SN/A}; 702131SN/A 718566Sgblack@eecs.umich.edutemplate <typename T> 728566Sgblack@eecs.umich.educlass MipsFault : public MipsFaultBase 732131SN/A{ 748566Sgblack@eecs.umich.edu protected: 758566Sgblack@eecs.umich.edu static FaultVals vals; 762131SN/A public: 778566Sgblack@eecs.umich.edu FaultName name() const { return vals.name; } 788566Sgblack@eecs.umich.edu FaultVect vect() const { return vals.vect; } 798566Sgblack@eecs.umich.edu FaultStat & countStat() { return vals.count; } 808566Sgblack@eecs.umich.edu}; 818566Sgblack@eecs.umich.edu 828566Sgblack@eecs.umich.educlass MachineCheckFault : public MipsFault<MachineCheckFault> 838566Sgblack@eecs.umich.edu{ 848566Sgblack@eecs.umich.edu public: 855222Sksewell@umich.edu bool isMachineCheckFault() {return true;} 865222Sksewell@umich.edu}; 875222Sksewell@umich.edu 888566Sgblack@eecs.umich.educlass NonMaskableInterrupt : public MipsFault<NonMaskableInterrupt> 895222Sksewell@umich.edu{ 905222Sksewell@umich.edu public: 915222Sksewell@umich.edu bool isNonMaskableInterrupt() {return true;} 922447SN/A}; 932131SN/A 948566Sgblack@eecs.umich.educlass AlignmentFault : public MipsFault<AlignmentFault> 952131SN/A{ 962131SN/A public: 975222Sksewell@umich.edu bool isAlignmentFault() {return true;} 982447SN/A}; 992131SN/A 1008566Sgblack@eecs.umich.educlass AddressErrorFault : public MipsFault<AddressErrorFault> 1015222Sksewell@umich.edu{ 1025222Sksewell@umich.edu public: 1035222Sksewell@umich.edu#if FULL_SYSTEM 1047678Sgblack@eecs.umich.edu void invoke(ThreadContext * tc, 1057678Sgblack@eecs.umich.edu StaticInstPtr inst = StaticInst::nullStaticInstPtr); 1065222Sksewell@umich.edu#endif 1075222Sksewell@umich.edu 1085222Sksewell@umich.edu}; 1096378Sgblack@eecs.umich.edu 1108566Sgblack@eecs.umich.educlass StoreAddressErrorFault : public MipsFault<StoreAddressErrorFault> 1115222Sksewell@umich.edu{ 1125222Sksewell@umich.edu public: 1135222Sksewell@umich.edu#if FULL_SYSTEM 1147678Sgblack@eecs.umich.edu void invoke(ThreadContext * tc, 1157678Sgblack@eecs.umich.edu StaticInstPtr inst = StaticInst::nullStaticInstPtr); 1165222Sksewell@umich.edu#endif 1176378Sgblack@eecs.umich.edu}; 1185222Sksewell@umich.edu 1198566Sgblack@eecs.umich.educlass UnimplementedOpcodeFault : public MipsFault<UnimplementedOpcodeFault> {}; 1208566Sgblack@eecs.umich.edu 1218566Sgblack@eecs.umich.educlass TLBRefillIFetchFault : public MipsFault<TLBRefillIFetchFault> 1224661Sksewell@umich.edu{ 1234661Sksewell@umich.edu public: 1247678Sgblack@eecs.umich.edu void invoke(ThreadContext * tc, 1257678Sgblack@eecs.umich.edu StaticInstPtr inst = StaticInst::nullStaticInstPtr); 1262447SN/A}; 1276378Sgblack@eecs.umich.edu 1288566Sgblack@eecs.umich.educlass TLBInvalidIFetchFault : public MipsFault<TLBInvalidIFetchFault> 1294661Sksewell@umich.edu{ 1304661Sksewell@umich.edu public: 1317678Sgblack@eecs.umich.edu void invoke(ThreadContext * tc, 1327678Sgblack@eecs.umich.edu StaticInstPtr inst = StaticInst::nullStaticInstPtr); 1334661Sksewell@umich.edu}; 1344661Sksewell@umich.edu 1358566Sgblack@eecs.umich.educlass NDtbMissFault : public MipsFault<NDtbMissFault> {}; 1368566Sgblack@eecs.umich.educlass PDtbMissFault : public MipsFault<PDtbMissFault> {}; 1378566Sgblack@eecs.umich.educlass DtbPageFault : public MipsFault<DtbPageFault> {}; 1388566Sgblack@eecs.umich.educlass DtbAcvFault : public MipsFault<DtbAcvFault> {}; 1395222Sksewell@umich.edu 1405222Sksewell@umich.edustatic inline Fault genMachineCheckFault() 1415222Sksewell@umich.edu{ 1425222Sksewell@umich.edu return new MachineCheckFault; 1435222Sksewell@umich.edu} 1445222Sksewell@umich.edu 1455222Sksewell@umich.edustatic inline Fault genAlignmentFault() 1465222Sksewell@umich.edu{ 1475222Sksewell@umich.edu return new AlignmentFault; 1485222Sksewell@umich.edu} 1495222Sksewell@umich.edu 1508566Sgblack@eecs.umich.educlass ResetFault : public MipsFault<ResetFault> 1515222Sksewell@umich.edu{ 1525222Sksewell@umich.edu public: 1537678Sgblack@eecs.umich.edu void invoke(ThreadContext * tc, 1547678Sgblack@eecs.umich.edu StaticInstPtr inst = StaticInst::nullStaticInstPtr); 1555222Sksewell@umich.edu 1565222Sksewell@umich.edu}; 1576378Sgblack@eecs.umich.edu 1588566Sgblack@eecs.umich.educlass SystemCallFault : public MipsFault<SystemCallFault> 1595222Sksewell@umich.edu{ 1605222Sksewell@umich.edu public: 1618563Sgblack@eecs.umich.edu#if FULL_SYSTEM 1627678Sgblack@eecs.umich.edu void invoke(ThreadContext * tc, 1637678Sgblack@eecs.umich.edu StaticInstPtr inst = StaticInst::nullStaticInstPtr); 1648563Sgblack@eecs.umich.edu#endif 1655222Sksewell@umich.edu}; 1665222Sksewell@umich.edu 1678566Sgblack@eecs.umich.educlass SoftResetFault : public MipsFault<SoftResetFault> 1685222Sksewell@umich.edu{ 1695222Sksewell@umich.edu public: 1707678Sgblack@eecs.umich.edu void invoke(ThreadContext * tc, 1717678Sgblack@eecs.umich.edu StaticInstPtr inst = StaticInst::nullStaticInstPtr); 1725222Sksewell@umich.edu}; 1736378Sgblack@eecs.umich.edu 1748566Sgblack@eecs.umich.educlass DebugSingleStep : public MipsFault<DebugSingleStep> 1755222Sksewell@umich.edu{ 1765222Sksewell@umich.edu public: 1777678Sgblack@eecs.umich.edu void invoke(ThreadContext * tc, 1787678Sgblack@eecs.umich.edu StaticInstPtr inst = StaticInst::nullStaticInstPtr); 1795222Sksewell@umich.edu}; 1806378Sgblack@eecs.umich.edu 1818566Sgblack@eecs.umich.educlass DebugInterrupt : public MipsFault<DebugInterrupt> 1825222Sksewell@umich.edu{ 1835222Sksewell@umich.edu public: 1847678Sgblack@eecs.umich.edu void invoke(ThreadContext * tc, 1857678Sgblack@eecs.umich.edu StaticInstPtr inst = StaticInst::nullStaticInstPtr); 1865222Sksewell@umich.edu}; 1875222Sksewell@umich.edu 1888566Sgblack@eecs.umich.educlass CoprocessorUnusableFault : public MipsFault<CoprocessorUnusableFault> 1895222Sksewell@umich.edu{ 1908566Sgblack@eecs.umich.edu protected: 1915222Sksewell@umich.edu int coProcID; 1925222Sksewell@umich.edu public: 1938566Sgblack@eecs.umich.edu CoprocessorUnusableFault(int _procid) : coProcID(_procid) 1948566Sgblack@eecs.umich.edu {} 1955222Sksewell@umich.edu 1967678Sgblack@eecs.umich.edu void invoke(ThreadContext * tc, 1977678Sgblack@eecs.umich.edu StaticInstPtr inst = StaticInst::nullStaticInstPtr); 1985222Sksewell@umich.edu}; 1995222Sksewell@umich.edu 2008566Sgblack@eecs.umich.educlass ReservedInstructionFault : public MipsFault<ReservedInstructionFault> 2015222Sksewell@umich.edu{ 2025222Sksewell@umich.edu public: 2037678Sgblack@eecs.umich.edu void invoke(ThreadContext * tc, 2047678Sgblack@eecs.umich.edu StaticInstPtr inst = StaticInst::nullStaticInstPtr); 2055222Sksewell@umich.edu}; 2065222Sksewell@umich.edu 2078566Sgblack@eecs.umich.educlass ThreadFault : public MipsFault<ThreadFault> 2088566Sgblack@eecs.umich.edu{ 2098566Sgblack@eecs.umich.edu public: 2108566Sgblack@eecs.umich.edu void invoke(ThreadContext * tc, 2118566Sgblack@eecs.umich.edu StaticInstPtr inst = StaticInst::nullStaticInstPtr); 2128566Sgblack@eecs.umich.edu}; 2138566Sgblack@eecs.umich.edu 2148566Sgblack@eecs.umich.educlass ArithmeticFault : public MipsFault<ArithmeticFault> 2155222Sksewell@umich.edu{ 2165222Sksewell@umich.edu protected: 2175222Sksewell@umich.edu bool skipFaultingInstruction() {return true;} 2185222Sksewell@umich.edu public: 2195222Sksewell@umich.edu#if FULL_SYSTEM 2207678Sgblack@eecs.umich.edu void invoke(ThreadContext * tc, 2217678Sgblack@eecs.umich.edu StaticInstPtr inst = StaticInst::nullStaticInstPtr); 2225222Sksewell@umich.edu#endif 2235222Sksewell@umich.edu}; 2245222Sksewell@umich.edu 2258566Sgblack@eecs.umich.educlass InterruptFault : public MipsFault<InterruptFault> 2265222Sksewell@umich.edu{ 2275222Sksewell@umich.edu protected: 2285222Sksewell@umich.edu bool setRestartAddress() {return false;} 2295222Sksewell@umich.edu public: 2305222Sksewell@umich.edu#if FULL_SYSTEM 2317678Sgblack@eecs.umich.edu void invoke(ThreadContext * tc, 2327678Sgblack@eecs.umich.edu StaticInstPtr inst = StaticInst::nullStaticInstPtr); 2335222Sksewell@umich.edu#endif 2345222Sksewell@umich.edu}; 2355222Sksewell@umich.edu 2368566Sgblack@eecs.umich.educlass TrapFault : public MipsFault<TrapFault> 2375222Sksewell@umich.edu{ 2385222Sksewell@umich.edu public: 2395222Sksewell@umich.edu#if FULL_SYSTEM 2407678Sgblack@eecs.umich.edu void invoke(ThreadContext * tc, 2417678Sgblack@eecs.umich.edu StaticInstPtr inst = StaticInst::nullStaticInstPtr); 2425222Sksewell@umich.edu#endif 2435222Sksewell@umich.edu}; 2445222Sksewell@umich.edu 2458566Sgblack@eecs.umich.educlass BreakpointFault : public MipsFault<BreakpointFault> 2465222Sksewell@umich.edu{ 2475222Sksewell@umich.edu public: 2485222Sksewell@umich.edu#if FULL_SYSTEM 2497678Sgblack@eecs.umich.edu void invoke(ThreadContext * tc, 2507678Sgblack@eecs.umich.edu StaticInstPtr inst = StaticInst::nullStaticInstPtr); 2515222Sksewell@umich.edu#endif 2525222Sksewell@umich.edu}; 2535222Sksewell@umich.edu 2548566Sgblack@eecs.umich.educlass ItbRefillFault : public MipsFault<ItbRefillFault> 2555222Sksewell@umich.edu{ 2565222Sksewell@umich.edu public: 2575222Sksewell@umich.edu#if FULL_SYSTEM 2587678Sgblack@eecs.umich.edu void invoke(ThreadContext * tc, 2597678Sgblack@eecs.umich.edu StaticInstPtr inst = StaticInst::nullStaticInstPtr); 2605222Sksewell@umich.edu#endif 2615222Sksewell@umich.edu}; 2626378Sgblack@eecs.umich.edu 2638566Sgblack@eecs.umich.educlass DtbRefillFault : public MipsFault<DtbRefillFault> 2645222Sksewell@umich.edu{ 2655222Sksewell@umich.edu public: 2665222Sksewell@umich.edu#if FULL_SYSTEM 2677678Sgblack@eecs.umich.edu void invoke(ThreadContext * tc, 2687678Sgblack@eecs.umich.edu StaticInstPtr inst = StaticInst::nullStaticInstPtr); 2695222Sksewell@umich.edu#endif 2705222Sksewell@umich.edu}; 2715222Sksewell@umich.edu 2728566Sgblack@eecs.umich.educlass ItbPageFault : public MipsFault<ItbPageFault> 2735222Sksewell@umich.edu{ 2745222Sksewell@umich.edu public: 2755222Sksewell@umich.edu#if FULL_SYSTEM 2767678Sgblack@eecs.umich.edu void invoke(ThreadContext * tc, 2777678Sgblack@eecs.umich.edu StaticInstPtr inst = StaticInst::nullStaticInstPtr); 2785222Sksewell@umich.edu#endif 2795222Sksewell@umich.edu}; 2805222Sksewell@umich.edu 2818566Sgblack@eecs.umich.educlass ItbInvalidFault : public MipsFault<ItbInvalidFault> 2825222Sksewell@umich.edu{ 2835222Sksewell@umich.edu public: 2845222Sksewell@umich.edu#if FULL_SYSTEM 2857678Sgblack@eecs.umich.edu void invoke(ThreadContext * tc, 2867678Sgblack@eecs.umich.edu StaticInstPtr inst = StaticInst::nullStaticInstPtr); 2875222Sksewell@umich.edu#endif 2886378Sgblack@eecs.umich.edu}; 2895222Sksewell@umich.edu 2908566Sgblack@eecs.umich.educlass TLBModifiedFault : public MipsFault<TLBModifiedFault> 2915222Sksewell@umich.edu{ 2925222Sksewell@umich.edu public: 2935222Sksewell@umich.edu#if FULL_SYSTEM 2947678Sgblack@eecs.umich.edu void invoke(ThreadContext * tc, 2957678Sgblack@eecs.umich.edu StaticInstPtr inst = StaticInst::nullStaticInstPtr); 2965222Sksewell@umich.edu#endif 2975222Sksewell@umich.edu}; 2985222Sksewell@umich.edu 2998566Sgblack@eecs.umich.educlass DtbInvalidFault : public MipsFault<DtbInvalidFault> 3005222Sksewell@umich.edu{ 3015222Sksewell@umich.edu public: 3025222Sksewell@umich.edu#if FULL_SYSTEM 3037678Sgblack@eecs.umich.edu void invoke(ThreadContext * tc, 3047678Sgblack@eecs.umich.edu StaticInst::StaticInstPtr inst = nullStaticInstPtr); 3055222Sksewell@umich.edu#endif 3065222Sksewell@umich.edu}; 3075222Sksewell@umich.edu 3088566Sgblack@eecs.umich.educlass FloatEnableFault : public MipsFault<FloatEnableFault> {}; 3098566Sgblack@eecs.umich.educlass ItbMissFault : public MipsFault<ItbMissFault> {}; 3108566Sgblack@eecs.umich.educlass ItbAcvFault : public MipsFault<ItbAcvFault> {}; 3118566Sgblack@eecs.umich.educlass IntegerOverflowFault : public MipsFault<IntegerOverflowFault> {}; 3128566Sgblack@eecs.umich.edu 3138566Sgblack@eecs.umich.educlass DspStateDisabledFault : public MipsFault<DspStateDisabledFault> 3145222Sksewell@umich.edu{ 3155222Sksewell@umich.edu public: 3167678Sgblack@eecs.umich.edu void invoke(ThreadContext * tc, 3177678Sgblack@eecs.umich.edu StaticInstPtr inst = StaticInst::nullStaticInstPtr); 3184661Sksewell@umich.edu}; 3194661Sksewell@umich.edu 3207811Ssteve.reinhardt@amd.com} // namespace MipsISA 3212131SN/A 3225222Sksewell@umich.edu#endif // __MIPS_FAULTS_HH__ 323