faults.hh revision 2665:a124942bacb8
16145SN/A/* 26145SN/A * Copyright (c) 2003-2005 The Regents of The University of Michigan 36145SN/A * All rights reserved. 46145SN/A * 56145SN/A * Redistribution and use in source and binary forms, with or without 66145SN/A * modification, are permitted provided that the following conditions are 76145SN/A * met: redistributions of source code must retain the above copyright 86145SN/A * notice, this list of conditions and the following disclaimer; 96145SN/A * redistributions in binary form must reproduce the above copyright 106145SN/A * notice, this list of conditions and the following disclaimer in the 116145SN/A * documentation and/or other materials provided with the distribution; 126145SN/A * neither the name of the copyright holders nor the names of its 136145SN/A * contributors may be used to endorse or promote products derived from 146145SN/A * this software without specific prior written permission. 156145SN/A * 166145SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 176145SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 186145SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 196145SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 206145SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 216145SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 226145SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 236145SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 246145SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 256145SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 266145SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 276145SN/A * 286145SN/A * Authors: Gabe Black 2910301Snilay@cs.wisc.edu * Kevin Lim 309171SN/A */ 316145SN/A 326467SN/A#ifndef __ALPHA_FAULTS_HH__ 339507SN/A#define __ALPHA_FAULTS_HH__ 346145SN/A 357039SN/A#include "sim/faults.hh" 369465SN/A 379465SN/A// The design of the "name" and "vect" functions is in sim/faults.hh 387039SN/A 3911025Snilay@cs.wisc.edunamespace SparcISA 406145SN/A{ 416145SN/A 427039SN/Atypedef const uint32_t TrapType; 437039SN/Atypedef const uint32_t FaultPriority; 447039SN/A 457455SN/Aclass SparcFault : public FaultBase 467039SN/A{ 476145SN/A public: 487039SN/A#if FULL_SYSTEM 497039SN/A void invoke(ExecContext * xc); 507039SN/A#endif 517039SN/A virtual TrapType trapType() = 0; 529465SN/A virtual FaultPriority priority() = 0; 536145SN/A virtual FaultStat & countStat() = 0; 546145SN/A}; 5511025Snilay@cs.wisc.edu 567039SN/Aclass InternalProcessorError : public SparcFault 576145SN/A{ 587039SN/A private: 596145SN/A static FaultName _name; 607039SN/A static TrapType _trapType; 617039SN/A static FaultPriority _priority; 627039SN/A static FaultStat _count; 637039SN/A public: 647039SN/A FaultName name() {return _name;} 656145SN/A TrapType trapType() {return _trapType;} 666145SN/A FaultPriority priority() {return _priority;} 677039SN/A FaultStat & countStat() {return _count;} 6811025Snilay@cs.wisc.edu bool isMachineCheckFault() {return true;} 696145SN/A}; 7011025Snilay@cs.wisc.edu 717039SN/Aclass MemAddressNotAligned : public SparcFault 727455SN/A{ 739499SN/A private: 749499SN/A static FaultName _name; 757455SN/A static TrapType _trapType; 767039SN/A static FaultPriority _priority; 779600SN/A static FaultStat _count; 789600SN/A public: 797039SN/A FaultName name() {return _name;} 806145SN/A TrapType trapType() {return _trapType;} 817039SN/A FaultPriority priority() {return _priority;} 827039SN/A FaultStat & countStat() {return _count;} 837039SN/A bool isAlignmentFault() {return true;} 847039SN/A}; 856145SN/A 866145SN/Astatic inline Fault genMachineCheckFault() 877039SN/A{ 8811025Snilay@cs.wisc.edu return new InternalProcessorError; 896145SN/A} 9011025Snilay@cs.wisc.edu 917455SN/Astatic inline Fault genAlignmentFault() 927455SN/A{ 936145SN/A return new MemAddressNotAligned; 947039SN/A} 957039SN/A 967039SN/Aclass PowerOnReset : public SparcFault 977039SN/A{ 986145SN/A private: 996145SN/A static FaultName _name; 1007039SN/A static TrapType _trapType; 1017055SN/A static FaultPriority _priority; 1026145SN/A static FaultStat _count; 1036145SN/A public: 1046145SN/A FaultName name() {return _name;} 1057039SN/A TrapType trapType() {return _trapType;} 1067039SN/A FaultPriority priority() {return _priority;} 1077039SN/A FaultStat & countStat() {return _count;} 1087455SN/A}; 1097455SN/A 1107039SN/Aclass WatchDogReset : public SparcFault 1117039SN/A{ 1126145SN/A private: 1137455SN/A static FaultName _name; 1147455SN/A static TrapType _trapType; 1156145SN/A static FaultPriority _priority; 1167455SN/A static FaultStat _count; 1177455SN/A public: 1187455SN/A FaultName name() {return _name;} 1197455SN/A TrapType trapType() {return _trapType;} 1207455SN/A FaultPriority priority() {return _priority;} 1217455SN/A FaultStat & countStat() {return _count;} 1227455SN/A}; 1237455SN/A 1247039SN/Aclass ExternallyInitiatedReset : public SparcFault 1256145SN/A{ 1267455SN/A private: 1277039SN/A static FaultName _name; 1286145SN/A static TrapType _trapType; 129 static FaultPriority _priority; 130 static FaultStat _count; 131 public: 132 FaultName name() {return _name;} 133 TrapType trapType() {return _trapType;} 134 FaultPriority priority() {return _priority;} 135 FaultStat & countStat() {return _count;} 136}; 137 138class SoftwareInitiatedReset : public SparcFault 139{ 140 private: 141 static FaultName _name; 142 static TrapType _trapType; 143 static FaultPriority _priority; 144 static FaultStat _count; 145 public: 146 FaultName name() {return _name;} 147 TrapType trapType() {return _trapType;} 148 FaultPriority priority() {return _priority;} 149 FaultStat & countStat() {return _count;} 150}; 151 152class REDStateException : public SparcFault 153{ 154 private: 155 static FaultName _name; 156 static TrapType _trapType; 157 static FaultPriority _priority; 158 static FaultStat _count; 159 public: 160 FaultName name() {return _name;} 161 TrapType trapType() {return _trapType;} 162 FaultPriority priority() {return _priority;} 163 FaultStat & countStat() {return _count;} 164}; 165 166class InstructionAccessException : public SparcFault 167{ 168 private: 169 static FaultName _name; 170 static TrapType _trapType; 171 static FaultPriority _priority; 172 static FaultStat _count; 173 public: 174 FaultName name() {return _name;} 175 TrapType trapType() {return _trapType;} 176 FaultPriority priority() {return _priority;} 177 FaultStat & countStat() {return _count;} 178}; 179 180class InstructionAccessMMUMiss : public SparcFault 181{ 182 private: 183 static FaultName _name; 184 static TrapType _trapType; 185 static FaultPriority _priority; 186 static FaultStat _count; 187 public: 188 FaultName name() {return _name;} 189 TrapType trapType() {return _trapType;} 190 FaultPriority priority() {return _priority;} 191 FaultStat & countStat() {return _count;} 192}; 193 194class InstructionAccessError : public SparcFault 195{ 196 private: 197 static FaultName _name; 198 static TrapType _trapType; 199 static FaultPriority _priority; 200 static FaultStat _count; 201 public: 202 FaultName name() {return _name;} 203 TrapType trapType() {return _trapType;} 204 FaultPriority priority() {return _priority;} 205 FaultStat & countStat() {return _count;} 206}; 207 208class IllegalInstruction : public SparcFault 209{ 210 private: 211 static FaultName _name; 212 static TrapType _trapType; 213 static FaultPriority _priority; 214 static FaultStat _count; 215 public: 216 FaultName name() {return _name;} 217 TrapType trapType() {return _trapType;} 218 FaultPriority priority() {return _priority;} 219 FaultStat & countStat() {return _count;} 220}; 221 222class PrivilegedOpcode : public SparcFault 223{ 224 private: 225 static FaultName _name; 226 static TrapType _trapType; 227 static FaultPriority _priority; 228 static FaultStat _count; 229 public: 230 FaultName name() {return _name;} 231 TrapType trapType() {return _trapType;} 232 FaultPriority priority() {return _priority;} 233 FaultStat & countStat() {return _count;} 234}; 235 236class UnimplementedLDD : public SparcFault 237{ 238 private: 239 static FaultName _name; 240 static TrapType _trapType; 241 static FaultPriority _priority; 242 static FaultStat _count; 243 public: 244 FaultName name() {return _name;} 245 TrapType trapType() {return _trapType;} 246 FaultPriority priority() {return _priority;} 247 FaultStat & countStat() {return _count;} 248}; 249 250class UnimplementedSTD : public SparcFault 251{ 252 private: 253 static FaultName _name; 254 static TrapType _trapType; 255 static FaultPriority _priority; 256 static FaultStat _count; 257 public: 258 FaultName name() {return _name;} 259 TrapType trapType() {return _trapType;} 260 FaultPriority priority() {return _priority;} 261 FaultStat & countStat() {return _count;} 262}; 263 264class FpDisabled : public SparcFault 265{ 266 private: 267 static FaultName _name; 268 static TrapType _trapType; 269 static FaultPriority _priority; 270 static FaultStat _count; 271 public: 272 FaultName name() {return _name;} 273 TrapType trapType() {return _trapType;} 274 FaultPriority priority() {return _priority;} 275 FaultStat & countStat() {return _count;} 276}; 277 278class FpExceptionIEEE754 : public SparcFault 279{ 280 private: 281 static FaultName _name; 282 static TrapType _trapType; 283 static FaultPriority _priority; 284 static FaultStat _count; 285 public: 286 FaultName name() {return _name;} 287 TrapType trapType() {return _trapType;} 288 FaultPriority priority() {return _priority;} 289 FaultStat & countStat() {return _count;} 290}; 291 292class FpExceptionOther : public SparcFault 293{ 294 private: 295 static FaultName _name; 296 static TrapType _trapType; 297 static FaultPriority _priority; 298 static FaultStat _count; 299 public: 300 FaultName name() {return _name;} 301 TrapType trapType() {return _trapType;} 302 FaultPriority priority() {return _priority;} 303 FaultStat & countStat() {return _count;} 304}; 305 306class TagOverflow : public SparcFault 307{ 308 private: 309 static FaultName _name; 310 static TrapType _trapType; 311 static FaultPriority _priority; 312 static FaultStat _count; 313 public: 314 FaultName name() {return _name;} 315 TrapType trapType() {return _trapType;} 316 FaultPriority priority() {return _priority;} 317 FaultStat & countStat() {return _count;} 318}; 319 320class DivisionByZero : public SparcFault 321{ 322 private: 323 static FaultName _name; 324 static TrapType _trapType; 325 static FaultPriority _priority; 326 static FaultStat _count; 327 public: 328 FaultName name() {return _name;} 329 TrapType trapType() {return _trapType;} 330 FaultPriority priority() {return _priority;} 331 FaultStat & countStat() {return _count;} 332}; 333 334class DataAccessException : public SparcFault 335{ 336 private: 337 static FaultName _name; 338 static TrapType _trapType; 339 static FaultPriority _priority; 340 static FaultStat _count; 341 public: 342 FaultName name() {return _name;} 343 TrapType trapType() {return _trapType;} 344 FaultPriority priority() {return _priority;} 345 FaultStat & countStat() {return _count;} 346}; 347 348class DataAccessMMUMiss : public SparcFault 349{ 350 private: 351 static FaultName _name; 352 static TrapType _trapType; 353 static FaultPriority _priority; 354 static FaultStat _count; 355 public: 356 FaultName name() {return _name;} 357 TrapType trapType() {return _trapType;} 358 FaultPriority priority() {return _priority;} 359 FaultStat & countStat() {return _count;} 360}; 361 362class DataAccessError : public SparcFault 363{ 364 private: 365 static FaultName _name; 366 static TrapType _trapType; 367 static FaultPriority _priority; 368 static FaultStat _count; 369 public: 370 FaultName name() {return _name;} 371 TrapType trapType() {return _trapType;} 372 FaultPriority priority() {return _priority;} 373 FaultStat & countStat() {return _count;} 374}; 375 376class DataAccessProtection : public SparcFault 377{ 378 private: 379 static FaultName _name; 380 static TrapType _trapType; 381 static FaultPriority _priority; 382 static FaultStat _count; 383 public: 384 FaultName name() {return _name;} 385 TrapType trapType() {return _trapType;} 386 FaultPriority priority() {return _priority;} 387 FaultStat & countStat() {return _count;} 388}; 389 390class LDDFMemAddressNotAligned : public SparcFault 391{ 392 private: 393 static FaultName _name; 394 static TrapType _trapType; 395 static FaultPriority _priority; 396 static FaultStat _count; 397 public: 398 FaultName name() {return _name;} 399 TrapType trapType() {return _trapType;} 400 FaultPriority priority() {return _priority;} 401 FaultStat & countStat() {return _count;} 402}; 403 404class STDFMemAddressNotAligned : public SparcFault 405{ 406 private: 407 static FaultName _name; 408 static TrapType _trapType; 409 static FaultPriority _priority; 410 static FaultStat _count; 411 public: 412 FaultName name() {return _name;} 413 TrapType trapType() {return _trapType;} 414 FaultPriority priority() {return _priority;} 415 FaultStat & countStat() {return _count;} 416}; 417 418class PrivilegedAction : public SparcFault 419{ 420 private: 421 static FaultName _name; 422 static TrapType _trapType; 423 static FaultPriority _priority; 424 static FaultStat _count; 425 public: 426 FaultName name() {return _name;} 427 TrapType trapType() {return _trapType;} 428 FaultPriority priority() {return _priority;} 429 FaultStat & countStat() {return _count;} 430}; 431 432class LDQFMemAddressNotAligned : public SparcFault 433{ 434 private: 435 static FaultName _name; 436 static TrapType _trapType; 437 static FaultPriority _priority; 438 static FaultStat _count; 439 public: 440 FaultName name() {return _name;} 441 TrapType trapType() {return _trapType;} 442 FaultPriority priority() {return _priority;} 443 FaultStat & countStat() {return _count;} 444}; 445 446class STQFMemAddressNotAligned : public SparcFault 447{ 448 private: 449 static FaultName _name; 450 static TrapType _trapType; 451 static FaultPriority _priority; 452 static FaultStat _count; 453 public: 454 FaultName name() {return _name;} 455 TrapType trapType() {return _trapType;} 456 FaultPriority priority() {return _priority;} 457 FaultStat & countStat() {return _count;} 458}; 459 460class AsyncDataError : public SparcFault 461{ 462 private: 463 static FaultName _name; 464 static TrapType _trapType; 465 static FaultPriority _priority; 466 static FaultStat _count; 467 public: 468 FaultName name() {return _name;} 469 TrapType trapType() {return _trapType;} 470 FaultPriority priority() {return _priority;} 471 FaultStat & countStat() {return _count;} 472}; 473 474class CleanWindow : public SparcFault 475{ 476 private: 477 static FaultName _name; 478 static TrapType _trapType; 479 static FaultPriority _priority; 480 static FaultStat _count; 481 public: 482 FaultName name() {return _name;} 483 TrapType trapType() {return _trapType;} 484 FaultPriority priority() {return _priority;} 485 FaultStat & countStat() {return _count;} 486}; 487 488class EnumeratedFault : public SparcFault 489{ 490 protected: 491 uint32_t _n; 492 virtual TrapType baseTrapType() = 0; 493 public: 494 EnumeratedFault(uint32_t n) : SparcFault() {_n = n;} 495 TrapType trapType() {return baseTrapType() + _n;} 496}; 497 498class InterruptLevelN : public EnumeratedFault 499{ 500 private: 501 static FaultName _name; 502 static TrapType _baseTrapType; 503 static FaultStat _count; 504 TrapType baseTrapType() {return _baseTrapType;} 505 public: 506 InterruptLevelN(uint32_t n) : EnumeratedFault(n) {;} 507 FaultName name() {return _name;} 508 FaultPriority priority() {return 32 - _n;} 509 FaultStat & countStat() {return _count;} 510}; 511 512class SpillNNormal : public EnumeratedFault 513{ 514 private: 515 static FaultName _name; 516 static TrapType _baseTrapType; 517 static FaultPriority _priority; 518 static FaultStat _count; 519 TrapType baseTrapType() {return _baseTrapType;} 520 public: 521 SpillNNormal(uint32_t n) : EnumeratedFault(n) {;} 522 FaultName name() {return _name;} 523 FaultPriority priority() {return _priority;} 524 FaultStat & countStat() {return _count;} 525}; 526 527class SpillNOther : public EnumeratedFault 528{ 529 private: 530 static FaultName _name; 531 static TrapType _baseTrapType; 532 static FaultPriority _priority; 533 static FaultStat _count; 534 TrapType baseTrapType() {return _baseTrapType;} 535 public: 536 SpillNOther(uint32_t n) : EnumeratedFault(n) {;} 537 FaultName name() {return _name;} 538 FaultPriority priority() {return _priority;} 539 FaultStat & countStat() {return _count;} 540}; 541 542class FillNNormal : public EnumeratedFault 543{ 544 private: 545 static FaultName _name; 546 static TrapType _baseTrapType; 547 static FaultPriority _priority; 548 static FaultStat _count; 549 TrapType baseTrapType() {return _baseTrapType;} 550 public: 551 FillNNormal(uint32_t n) : EnumeratedFault(n) {;} 552 FaultName name() {return _name;} 553 FaultPriority priority() {return _priority;} 554 FaultStat & countStat() {return _count;} 555}; 556 557class FillNOther : public EnumeratedFault 558{ 559 private: 560 static FaultName _name; 561 static TrapType _baseTrapType; 562 static FaultPriority _priority; 563 static FaultStat _count; 564 TrapType baseTrapType() {return _baseTrapType;} 565 public: 566 FillNOther(uint32_t n) : EnumeratedFault(n) {;} 567 FaultName name() {return _name;} 568 FaultPriority priority() {return _priority;} 569 FaultStat & countStat() {return _count;} 570}; 571 572class TrapInstruction : public EnumeratedFault 573{ 574 private: 575 static FaultName _name; 576 static TrapType _baseTrapType; 577 static FaultPriority _priority; 578 static FaultStat _count; 579 uint64_t syscall_num; 580 TrapType baseTrapType() {return _baseTrapType;} 581 public: 582 TrapInstruction(uint32_t n, uint64_t syscall) : 583 EnumeratedFault(n), syscall_num(syscall) {;} 584 FaultName name() {return _name;} 585 FaultPriority priority() {return _priority;} 586 FaultStat & countStat() {return _count;} 587#if !FULL_SYSTEM 588 void invoke(ExecContext * xc); 589#endif 590}; 591 592} // SparcISA namespace 593 594#endif // __FAULTS_HH__ 595