faults.hh revision 2632:1bb2f91485ea
1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; 9 * redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution; 12 * neither the name of the copyright holders nor the names of its 13 * contributors may be used to endorse or promote products derived from 14 * this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29#ifndef __MIPS_FAULTS_HH__ 30#define __MIPS_FAULTS_HH__ 31 32#include "sim/faults.hh" 33 34// The design of the "name" and "vect" functions is in sim/faults.hh 35 36namespace MipsISA 37{ 38 39typedef const Addr FaultVect; 40 41class MipsFault : public FaultBase 42{ 43 protected: 44 virtual bool skipFaultingInstruction() {return false;} 45 virtual bool setRestartAddress() {return true;} 46 public: 47#if FULL_SYSTEM 48 void invoke(ExecContext * xc); 49#endif 50 virtual FaultVect vect() = 0; 51 virtual FaultStat & countStat() = 0; 52}; 53 54class MachineCheckFault : public MipsFault 55{ 56 private: 57 static FaultName _name; 58 static FaultVect _vect; 59 static FaultStat _count; 60 public: 61 FaultName name() {return _name;} 62 FaultVect vect() {return _vect;} 63 FaultStat & countStat() {return _count;} 64 bool isMachineCheckFault() {return true;} 65}; 66 67class AlignmentFault : public MipsFault 68{ 69 private: 70 static FaultName _name; 71 static FaultVect _vect; 72 static FaultStat _count; 73 public: 74 FaultName name() {return _name;} 75 FaultVect vect() {return _vect;} 76 FaultStat & countStat() {return _count;} 77 bool isAlignmentFault() {return true;} 78}; 79 80static inline Fault genMachineCheckFault() 81{ 82 return new MachineCheckFault; 83} 84 85static inline Fault genAlignmentFault() 86{ 87 return new AlignmentFault; 88} 89 90class ResetFault : public MipsFault 91{ 92 private: 93 static FaultName _name; 94 static FaultVect _vect; 95 static FaultStat _count; 96 public: 97 FaultName name() {return _name;} 98 FaultVect vect() {return _vect;} 99 FaultStat & countStat() {return _count;} 100}; 101 102class ArithmeticFault : public MipsFault 103{ 104 protected: 105 bool skipFaultingInstruction() {return true;} 106 private: 107 static FaultName _name; 108 static FaultVect _vect; 109 static FaultStat _count; 110 public: 111 FaultName name() {return _name;} 112 FaultVect vect() {return _vect;} 113 FaultStat & countStat() {return _count;} 114#if FULL_SYSTEM 115 void invoke(ExecContext * xc); 116#endif 117}; 118 119class InterruptFault : public MipsFault 120{ 121 protected: 122 bool setRestartAddress() {return false;} 123 private: 124 static FaultName _name; 125 static FaultVect _vect; 126 static FaultStat _count; 127 public: 128 FaultName name() {return _name;} 129 FaultVect vect() {return _vect;} 130 FaultStat & countStat() {return _count;} 131}; 132 133class NDtbMissFault : public MipsFault 134{ 135 private: 136 static FaultName _name; 137 static FaultVect _vect; 138 static FaultStat _count; 139 public: 140 FaultName name() {return _name;} 141 FaultVect vect() {return _vect;} 142 FaultStat & countStat() {return _count;} 143}; 144 145class PDtbMissFault : public MipsFault 146{ 147 private: 148 static FaultName _name; 149 static FaultVect _vect; 150 static FaultStat _count; 151 public: 152 FaultName name() {return _name;} 153 FaultVect vect() {return _vect;} 154 FaultStat & countStat() {return _count;} 155}; 156 157class DtbPageFault : public MipsFault 158{ 159 private: 160 static FaultName _name; 161 static FaultVect _vect; 162 static FaultStat _count; 163 public: 164 FaultName name() {return _name;} 165 FaultVect vect() {return _vect;} 166 FaultStat & countStat() {return _count;} 167}; 168 169class DtbAcvFault : public MipsFault 170{ 171 private: 172 static FaultName _name; 173 static FaultVect _vect; 174 static FaultStat _count; 175 public: 176 FaultName name() {return _name;} 177 FaultVect vect() {return _vect;} 178 FaultStat & countStat() {return _count;} 179}; 180 181class ItbMissFault : public MipsFault 182{ 183 private: 184 static FaultName _name; 185 static FaultVect _vect; 186 static FaultStat _count; 187 public: 188 FaultName name() {return _name;} 189 FaultVect vect() {return _vect;} 190 FaultStat & countStat() {return _count;} 191}; 192 193class ItbPageFault : public MipsFault 194{ 195 private: 196 static FaultName _name; 197 static FaultVect _vect; 198 static FaultStat _count; 199 public: 200 FaultName name() {return _name;} 201 FaultVect vect() {return _vect;} 202 FaultStat & countStat() {return _count;} 203}; 204 205class ItbAcvFault : public MipsFault 206{ 207 private: 208 static FaultName _name; 209 static FaultVect _vect; 210 static FaultStat _count; 211 public: 212 FaultName name() {return _name;} 213 FaultVect vect() {return _vect;} 214 FaultStat & countStat() {return _count;} 215}; 216 217class UnimplementedOpcodeFault : public MipsFault 218{ 219 private: 220 static FaultName _name; 221 static FaultVect _vect; 222 static FaultStat _count; 223 public: 224 FaultName name() {return _name;} 225 FaultVect vect() {return _vect;} 226 FaultStat & countStat() {return _count;} 227}; 228 229class FloatEnableFault : public MipsFault 230{ 231 private: 232 static FaultName _name; 233 static FaultVect _vect; 234 static FaultStat _count; 235 public: 236 FaultName name() {return _name;} 237 FaultVect vect() {return _vect;} 238 FaultStat & countStat() {return _count;} 239}; 240 241class PalFault : public MipsFault 242{ 243 protected: 244 bool skipFaultingInstruction() {return true;} 245 private: 246 static FaultName _name; 247 static FaultVect _vect; 248 static FaultStat _count; 249 public: 250 FaultName name() {return _name;} 251 FaultVect vect() {return _vect;} 252 FaultStat & countStat() {return _count;} 253}; 254 255class IntegerOverflowFault : public MipsFault 256{ 257 private: 258 static FaultName _name; 259 static FaultVect _vect; 260 static FaultStat _count; 261 public: 262 FaultName name() {return _name;} 263 FaultVect vect() {return _vect;} 264 FaultStat & countStat() {return _count;} 265}; 266 267} // MipsISA namespace 268 269#endif // __FAULTS_HH__ 270