faults.hh revision 2447
112855Sgabeblack@google.com/* 212855Sgabeblack@google.com * Copyright (c) 2003-2005 The Regents of The University of Michigan 312855Sgabeblack@google.com * All rights reserved. 412855Sgabeblack@google.com * 512855Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without 612855Sgabeblack@google.com * modification, are permitted provided that the following conditions are 712855Sgabeblack@google.com * met: redistributions of source code must retain the above copyright 812855Sgabeblack@google.com * notice, this list of conditions and the following disclaimer; 912855Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright 1012855Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the 1112855Sgabeblack@google.com * documentation and/or other materials provided with the distribution; 1212855Sgabeblack@google.com * neither the name of the copyright holders nor the names of its 1312855Sgabeblack@google.com * contributors may be used to endorse or promote products derived from 1412855Sgabeblack@google.com * this software without specific prior written permission. 1512855Sgabeblack@google.com * 1612855Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1712855Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1812855Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1912855Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2012855Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2112855Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2212855Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2312855Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2412855Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2512855Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2612855Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2712855Sgabeblack@google.com */ 2812855Sgabeblack@google.com 2912855Sgabeblack@google.com#ifndef __MIPS_FAULTS_HH__ 3012855Sgabeblack@google.com#define __MIPS_FAULTS_HH__ 3112855Sgabeblack@google.com 3212855Sgabeblack@google.com#include "sim/faults.hh" 3312855Sgabeblack@google.com 3412855Sgabeblack@google.com// The design of the "name" and "vect" functions is in sim/faults.hh 3512855Sgabeblack@google.com 3612855Sgabeblack@google.comnamespace MipsISA 3712855Sgabeblack@google.com{ 3812855Sgabeblack@google.com 3912855Sgabeblack@google.comtypedef const Addr FaultVect; 4012855Sgabeblack@google.com 4112855Sgabeblack@google.comclass MipsFault : public FaultBase 4212855Sgabeblack@google.com{ 4312855Sgabeblack@google.com protected: 4412855Sgabeblack@google.com virtual bool skipFaultingInstruction() {return false;} 4512855Sgabeblack@google.com virtual bool setRestartAddress() {return true;} 4612855Sgabeblack@google.com public: 4712855Sgabeblack@google.com#if FULL_SYSTEM 4812855Sgabeblack@google.com void invoke(ExecContext * xc); 4912855Sgabeblack@google.com#endif 5012855Sgabeblack@google.com virtual FaultVect vect() = 0; 5112855Sgabeblack@google.com virtual FaultStat & countStat() = 0; 5212855Sgabeblack@google.com}; 5312855Sgabeblack@google.com 5412855Sgabeblack@google.comclass MachineCheckFault : public MipsFault 5512855Sgabeblack@google.com{ 5612855Sgabeblack@google.com private: 5712855Sgabeblack@google.com static FaultName _name; 5812855Sgabeblack@google.com static FaultVect _vect; 5912855Sgabeblack@google.com static FaultStat _count; 6012855Sgabeblack@google.com public: 6112855Sgabeblack@google.com FaultName name() {return _name;} 6212855Sgabeblack@google.com FaultVect vect() {return _vect;} 6312855Sgabeblack@google.com FaultStat & countStat() {return _count;} 6412855Sgabeblack@google.com bool isMachineCheckFault() {return true;} 6512855Sgabeblack@google.com}; 6612855Sgabeblack@google.com 6712855Sgabeblack@google.comclass AlignmentFault : public MipsFault 6812855Sgabeblack@google.com{ 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