faults.hh revision 10474
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 * Authors: Gabe Black 2912855Sgabeblack@google.com * Kevin Lim 3012855Sgabeblack@google.com */ 3112855Sgabeblack@google.com 3212855Sgabeblack@google.com#ifndef __ARCH_ALPHA_FAULTS_HH__ 3312855Sgabeblack@google.com#define __ARCH_ALPHA_FAULTS_HH__ 3412855Sgabeblack@google.com 3512855Sgabeblack@google.com#include "arch/alpha/pagetable.hh" 3612855Sgabeblack@google.com#include "mem/request.hh" 3712855Sgabeblack@google.com#include "sim/faults.hh" 3812855Sgabeblack@google.com 3912855Sgabeblack@google.com// The design of the "name" and "vect" functions is in sim/faults.hh 4012855Sgabeblack@google.com 4112855Sgabeblack@google.comnamespace AlphaISA { 4212855Sgabeblack@google.com 4312855Sgabeblack@google.comtypedef const Addr FaultVect; 4412855Sgabeblack@google.com 4512855Sgabeblack@google.comclass AlphaFault : public FaultBase 4612855Sgabeblack@google.com{ 4712855Sgabeblack@google.com protected: 4812855Sgabeblack@google.com virtual bool skipFaultingInstruction() {return false;} 4912855Sgabeblack@google.com virtual bool setRestartAddress() {return true;} 5012855Sgabeblack@google.com public: 5112855Sgabeblack@google.com virtual ~AlphaFault() {} 5212855Sgabeblack@google.com void invoke(ThreadContext * tc, const StaticInstPtr &inst = 5312855Sgabeblack@google.com StaticInst::nullStaticInstPtr); 5412855Sgabeblack@google.com virtual FaultVect vect() = 0; 5512855Sgabeblack@google.com virtual FaultStat & countStat() = 0; 56}; 57 58class MachineCheckFault : public AlphaFault 59{ 60 private: 61 static FaultName _name; 62 static FaultVect _vect; 63 static FaultStat _count; 64 65 public: 66 FaultName name() const {return _name;} 67 FaultVect vect() {return _vect;} 68 FaultStat & countStat() {return _count;} 69}; 70 71class AlignmentFault : public AlphaFault 72{ 73 private: 74 static FaultName _name; 75 static FaultVect _vect; 76 static FaultStat _count; 77 78 public: 79 FaultName name() const {return _name;} 80 FaultVect vect() {return _vect;} 81 FaultStat & countStat() {return _count;} 82 bool isAlignmentFault() const {return true;} 83}; 84 85class ResetFault : public AlphaFault 86{ 87 private: 88 static FaultName _name; 89 static FaultVect _vect; 90 static FaultStat _count; 91 92 public: 93 FaultName name() const {return _name;} 94 FaultVect vect() {return _vect;} 95 FaultStat & countStat() {return _count;} 96}; 97 98class ArithmeticFault : public AlphaFault 99{ 100 private: 101 static FaultName _name; 102 static FaultVect _vect; 103 static FaultStat _count; 104 105 protected: 106 bool skipFaultingInstruction() {return true;} 107 108 public: 109 FaultName name() const {return _name;} 110 FaultVect vect() {return _vect;} 111 FaultStat & countStat() {return _count;} 112 void invoke(ThreadContext * tc, const StaticInstPtr &inst = 113 StaticInst::nullStaticInstPtr); 114}; 115 116class InterruptFault : public AlphaFault 117{ 118 private: 119 static FaultName _name; 120 static FaultVect _vect; 121 static FaultStat _count; 122 123 protected: 124 bool setRestartAddress() {return false;} 125 126 public: 127 FaultName name() const {return _name;} 128 FaultVect vect() {return _vect;} 129 FaultStat & countStat() {return _count;} 130}; 131 132class DtbFault : public AlphaFault 133{ 134 protected: 135 VAddr vaddr; 136 Request::Flags reqFlags; 137 uint64_t flags; 138 139 public: 140 DtbFault(VAddr _vaddr, Request::Flags _reqFlags, uint64_t _flags) 141 : vaddr(_vaddr), reqFlags(_reqFlags), flags(_flags) 142 { } 143 FaultName name() const = 0; 144 FaultVect vect() = 0; 145 FaultStat & countStat() = 0; 146 void invoke(ThreadContext * tc, const StaticInstPtr &inst = 147 StaticInst::nullStaticInstPtr); 148}; 149 150class NDtbMissFault : public DtbFault 151{ 152 private: 153 static FaultName _name; 154 static FaultVect _vect; 155 static FaultStat _count; 156 157 public: 158 NDtbMissFault(VAddr vaddr, Request::Flags reqFlags, uint64_t flags) 159 : DtbFault(vaddr, reqFlags, flags) 160 { } 161 FaultName name() const {return _name;} 162 FaultVect vect() {return _vect;} 163 FaultStat & countStat() {return _count;} 164 void invoke(ThreadContext * tc, const StaticInstPtr &inst = 165 StaticInst::nullStaticInstPtr); 166}; 167 168class PDtbMissFault : public DtbFault 169{ 170 private: 171 static FaultName _name; 172 static FaultVect _vect; 173 static FaultStat _count; 174 175 public: 176 PDtbMissFault(VAddr vaddr, Request::Flags reqFlags, uint64_t flags) 177 : DtbFault(vaddr, reqFlags, flags) 178 { } 179 FaultName name() const {return _name;} 180 FaultVect vect() {return _vect;} 181 FaultStat & countStat() {return _count;} 182}; 183 184class DtbPageFault : public DtbFault 185{ 186 private: 187 static FaultName _name; 188 static FaultVect _vect; 189 static FaultStat _count; 190 191 public: 192 DtbPageFault(VAddr vaddr, Request::Flags reqFlags, uint64_t flags) 193 : DtbFault(vaddr, reqFlags, flags) 194 { } 195 FaultName name() const {return _name;} 196 FaultVect vect() {return _vect;} 197 FaultStat & countStat() {return _count;} 198}; 199 200class DtbAcvFault : public DtbFault 201{ 202 private: 203 static FaultName _name; 204 static FaultVect _vect; 205 static FaultStat _count; 206 207 public: 208 DtbAcvFault(VAddr vaddr, Request::Flags reqFlags, uint64_t flags) 209 : DtbFault(vaddr, reqFlags, flags) 210 { } 211 FaultName name() const {return _name;} 212 FaultVect vect() {return _vect;} 213 FaultStat & countStat() {return _count;} 214}; 215 216class DtbAlignmentFault : public DtbFault 217{ 218 private: 219 static FaultName _name; 220 static FaultVect _vect; 221 static FaultStat _count; 222 223 public: 224 DtbAlignmentFault(VAddr vaddr, Request::Flags reqFlags, uint64_t flags) 225 : DtbFault(vaddr, reqFlags, flags) 226 { } 227 FaultName name() const {return _name;} 228 FaultVect vect() {return _vect;} 229 FaultStat & countStat() {return _count;} 230}; 231 232class ItbFault : public AlphaFault 233{ 234 protected: 235 Addr pc; 236 237 public: 238 ItbFault(Addr _pc) : pc(_pc) { } 239 FaultName name() const = 0; 240 FaultVect vect() = 0; 241 FaultStat & countStat() = 0; 242 void invoke(ThreadContext * tc, const StaticInstPtr &inst = 243 StaticInst::nullStaticInstPtr); 244}; 245 246class ItbPageFault : public ItbFault 247{ 248 private: 249 static FaultName _name; 250 static FaultVect _vect; 251 static FaultStat _count; 252 253 public: 254 ItbPageFault(Addr pc) : ItbFault(pc) { } 255 FaultName name() const {return _name;} 256 FaultVect vect() {return _vect;} 257 FaultStat & countStat() {return _count;} 258 void invoke(ThreadContext * tc, const StaticInstPtr &inst = 259 StaticInst::nullStaticInstPtr); 260}; 261 262class ItbAcvFault : public ItbFault 263{ 264 private: 265 static FaultName _name; 266 static FaultVect _vect; 267 static FaultStat _count; 268 269 public: 270 ItbAcvFault(Addr pc) : ItbFault(pc) { } 271 FaultName name() const {return _name;} 272 FaultVect vect() {return _vect;} 273 FaultStat & countStat() {return _count;} 274}; 275 276class UnimplementedOpcodeFault : public AlphaFault 277{ 278 private: 279 static FaultName _name; 280 static FaultVect _vect; 281 static FaultStat _count; 282 283 public: 284 FaultName name() const {return _name;} 285 FaultVect vect() {return _vect;} 286 FaultStat & countStat() {return _count;} 287}; 288 289class FloatEnableFault : public AlphaFault 290{ 291 private: 292 static FaultName _name; 293 static FaultVect _vect; 294 static FaultStat _count; 295 296 public: 297 FaultName name() const {return _name;} 298 FaultVect vect() {return _vect;} 299 FaultStat & countStat() {return _count;} 300}; 301 302class PalFault : public AlphaFault 303{ 304 private: 305 static FaultName _name; 306 static FaultVect _vect; 307 static FaultStat _count; 308 309 protected: 310 bool skipFaultingInstruction() {return true;} 311 312 public: 313 FaultName name() const {return _name;} 314 FaultVect vect() {return _vect;} 315 FaultStat & countStat() {return _count;} 316}; 317 318class IntegerOverflowFault : public AlphaFault 319{ 320 private: 321 static FaultName _name; 322 static FaultVect _vect; 323 static FaultStat _count; 324 325 public: 326 FaultName name() const {return _name;} 327 FaultVect vect() {return _vect;} 328 FaultStat & countStat() {return _count;} 329}; 330 331} // namespace AlphaISA 332 333#endif // __ARCH_ALPHA_FAULTS_HH__ 334