faults.cc revision 2527
112837Sgabeblack@google.com/* 212837Sgabeblack@google.com * Copyright (c) 2003-2005 The Regents of The University of Michigan 312837Sgabeblack@google.com * All rights reserved. 412837Sgabeblack@google.com * 512837Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without 612837Sgabeblack@google.com * modification, are permitted provided that the following conditions are 712837Sgabeblack@google.com * met: redistributions of source code must retain the above copyright 812837Sgabeblack@google.com * notice, this list of conditions and the following disclaimer; 912837Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright 1012837Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the 1112837Sgabeblack@google.com * documentation and/or other materials provided with the distribution; 1212837Sgabeblack@google.com * neither the name of the copyright holders nor the names of its 1312837Sgabeblack@google.com * contributors may be used to endorse or promote products derived from 1412837Sgabeblack@google.com * this software without specific prior written permission. 1512837Sgabeblack@google.com * 1612837Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1712837Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1812837Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1912837Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2012837Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2112837Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2212837Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2312837Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2412837Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2512837Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2612837Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2712837Sgabeblack@google.com */ 2812837Sgabeblack@google.com 2912837Sgabeblack@google.com#include "arch/sparc/faults.hh" 3012837Sgabeblack@google.com#include "cpu/exec_context.hh" 3112837Sgabeblack@google.com#include "cpu/base.hh" 3212837Sgabeblack@google.com#include "base/trace.hh" 3313048Sgabeblack@google.com 3412837Sgabeblack@google.comnamespace SparcISA 3512837Sgabeblack@google.com{ 3612837Sgabeblack@google.com 3712837Sgabeblack@google.comFaultName InternalProcessorError::_name = "intprocerr"; 3812837Sgabeblack@google.comTrapType InternalProcessorError::_trapType = 0x029; 3912837Sgabeblack@google.comFaultPriority InternalProcessorError::_priority = 4; 4012837Sgabeblack@google.comFaultStat InternalProcessorError::_count; 4112837Sgabeblack@google.com 4212837Sgabeblack@google.comFaultName MemAddressNotAligned::_name = "unalign"; 4312837Sgabeblack@google.comTrapType MemAddressNotAligned::_trapType = 0x034; 4413048Sgabeblack@google.comFaultPriority MemAddressNotAligned::_priority = 10; 4513048Sgabeblack@google.comFaultStat MemAddressNotAligned::_count; 4612992Sgabeblack@google.com 4712992Sgabeblack@google.comFaultName PowerOnReset::_name = "pow_reset"; 4812992Sgabeblack@google.comTrapType PowerOnReset::_trapType = 0x001; 4913059Sgabeblack@google.comFaultPriority PowerOnReset::_priority = 0; 5013059Sgabeblack@google.comFaultStat PowerOnReset::_count; 5113059Sgabeblack@google.com 5213059Sgabeblack@google.comFaultName WatchDogReset::_name = "watch_dog_reset"; 5313059Sgabeblack@google.comTrapType WatchDogReset::_trapType = 0x002; 5413059Sgabeblack@google.comFaultPriority WatchDogReset::_priority = 1; 5513059Sgabeblack@google.comFaultStat WatchDogReset::_count; 5613059Sgabeblack@google.com 5712837Sgabeblack@google.comFaultName ExternallyInitiatedReset::_name = "extern_reset"; 5812837Sgabeblack@google.comTrapType ExternallyInitiatedReset::_trapType = 0x003; 5912837Sgabeblack@google.comFaultPriority ExternallyInitiatedReset::_priority = 1; 6012837Sgabeblack@google.comFaultStat ExternallyInitiatedReset::_count; 6112837Sgabeblack@google.com 6212837Sgabeblack@google.comFaultName SoftwareInitiatedReset::_name = "software_reset"; 6313048Sgabeblack@google.comTrapType SoftwareInitiatedReset::_trapType = 0x004; 6413048Sgabeblack@google.comFaultPriority SoftwareInitiatedReset::_priority = 1; 6513048Sgabeblack@google.comFaultStat SoftwareInitiatedReset::_count; 6613048Sgabeblack@google.com 6713048Sgabeblack@google.comFaultName REDStateException::_name = "red_counte"; 6813048Sgabeblack@google.comTrapType REDStateException::_trapType = 0x005; 6913048Sgabeblack@google.comFaultPriority REDStateException::_priority = 1; 7012837Sgabeblack@google.comFaultStat REDStateException::_count; 7112837Sgabeblack@google.com 7212837Sgabeblack@google.comFaultName InstructionAccessException::_name = "inst_access"; 7313048Sgabeblack@google.comTrapType InstructionAccessException::_trapType = 0x008; 7413048Sgabeblack@google.comFaultPriority InstructionAccessException::_priority = 5; 7513048Sgabeblack@google.comFaultStat InstructionAccessException::_count; 7613048Sgabeblack@google.com 7712837Sgabeblack@google.comFaultName InstructionAccessMMUMiss::_name = "inst_mmu"; 7813048Sgabeblack@google.comTrapType InstructionAccessMMUMiss::_trapType = 0x009; 7913048Sgabeblack@google.comFaultPriority InstructionAccessMMUMiss::_priority = 2; 8012837Sgabeblack@google.comFaultStat InstructionAccessMMUMiss::_count; 8113048Sgabeblack@google.com 8213048Sgabeblack@google.comFaultName InstructionAccessError::_name = "inst_error"; 8312837Sgabeblack@google.comTrapType InstructionAccessError::_trapType = 0x00A; 8412837Sgabeblack@google.comFaultPriority InstructionAccessError::_priority = 3; 8513059Sgabeblack@google.comFaultStat InstructionAccessError::_count; 8613059Sgabeblack@google.com 8713059Sgabeblack@google.comFaultName IllegalInstruction::_name = "illegal_inst"; 8813059Sgabeblack@google.comTrapType IllegalInstruction::_trapType = 0x010; 8912837Sgabeblack@google.comFaultPriority IllegalInstruction::_priority = 7; 9012837Sgabeblack@google.comFaultStat IllegalInstruction::_count; 9113048Sgabeblack@google.com 9213048Sgabeblack@google.comFaultName PrivilegedOpcode::_name = "priv_opcode"; 9312837Sgabeblack@google.comTrapType PrivilegedOpcode::_trapType = 0x011; 9412837Sgabeblack@google.comFaultPriority PrivilegedOpcode::_priority = 6; 9512837Sgabeblack@google.comFaultStat PrivilegedOpcode::_count; 9612837Sgabeblack@google.com 9712837Sgabeblack@google.comFaultName UnimplementedLDD::_name = "unimp_ldd"; 9812837Sgabeblack@google.comTrapType UnimplementedLDD::_trapType = 0x012; 9912837Sgabeblack@google.comFaultPriority UnimplementedLDD::_priority = 6; 10012837Sgabeblack@google.comFaultStat UnimplementedLDD::_count; 101 102FaultName UnimplementedSTD::_name = "unimp_std"; 103TrapType UnimplementedSTD::_trapType = 0x013; 104FaultPriority UnimplementedSTD::_priority = 6; 105FaultStat UnimplementedSTD::_count; 106 107FaultName FpDisabled::_name = "fp_disabled"; 108TrapType FpDisabled::_trapType = 0x020; 109FaultPriority FpDisabled::_priority = 8; 110FaultStat FpDisabled::_count; 111 112FaultName FpExceptionIEEE754::_name = "fp_754"; 113TrapType FpExceptionIEEE754::_trapType = 0x021; 114FaultPriority FpExceptionIEEE754::_priority = 11; 115FaultStat FpExceptionIEEE754::_count; 116 117FaultName FpExceptionOther::_name = "fp_other"; 118TrapType FpExceptionOther::_trapType = 0x022; 119FaultPriority FpExceptionOther::_priority = 11; 120FaultStat FpExceptionOther::_count; 121 122FaultName TagOverflow::_name = "tag_overflow"; 123TrapType TagOverflow::_trapType = 0x023; 124FaultPriority TagOverflow::_priority = 14; 125FaultStat TagOverflow::_count; 126 127FaultName DivisionByZero::_name = "div_by_zero"; 128TrapType DivisionByZero::_trapType = 0x028; 129FaultPriority DivisionByZero::_priority = 15; 130FaultStat DivisionByZero::_count; 131 132FaultName DataAccessException::_name = "data_access"; 133TrapType DataAccessException::_trapType = 0x030; 134FaultPriority DataAccessException::_priority = 12; 135FaultStat DataAccessException::_count; 136 137FaultName DataAccessMMUMiss::_name = "data_mmu"; 138TrapType DataAccessMMUMiss::_trapType = 0x031; 139FaultPriority DataAccessMMUMiss::_priority = 12; 140FaultStat DataAccessMMUMiss::_count; 141 142FaultName DataAccessError::_name = "data_error"; 143TrapType DataAccessError::_trapType = 0x032; 144FaultPriority DataAccessError::_priority = 12; 145FaultStat DataAccessError::_count; 146 147FaultName DataAccessProtection::_name = "data_protection"; 148TrapType DataAccessProtection::_trapType = 0x033; 149FaultPriority DataAccessProtection::_priority = 12; 150FaultStat DataAccessProtection::_count; 151 152FaultName LDDFMemAddressNotAligned::_name = "unalign_lddf"; 153TrapType LDDFMemAddressNotAligned::_trapType = 0x035; 154FaultPriority LDDFMemAddressNotAligned::_priority = 10; 155FaultStat LDDFMemAddressNotAligned::_count; 156 157FaultName STDFMemAddressNotAligned::_name = "unalign_stdf"; 158TrapType STDFMemAddressNotAligned::_trapType = 0x036; 159FaultPriority STDFMemAddressNotAligned::_priority = 10; 160FaultStat STDFMemAddressNotAligned::_count; 161 162FaultName PrivilegedAction::_name = "priv_action"; 163TrapType PrivilegedAction::_trapType = 0x037; 164FaultPriority PrivilegedAction::_priority = 11; 165FaultStat PrivilegedAction::_count; 166 167FaultName LDQFMemAddressNotAligned::_name = "unalign_ldqf"; 168TrapType LDQFMemAddressNotAligned::_trapType = 0x038; 169FaultPriority LDQFMemAddressNotAligned::_priority = 10; 170FaultStat LDQFMemAddressNotAligned::_count; 171 172FaultName STQFMemAddressNotAligned::_name = "unalign_stqf"; 173TrapType STQFMemAddressNotAligned::_trapType = 0x039; 174FaultPriority STQFMemAddressNotAligned::_priority = 10; 175FaultStat STQFMemAddressNotAligned::_count; 176 177FaultName AsyncDataError::_name = "async_data"; 178TrapType AsyncDataError::_trapType = 0x040; 179FaultPriority AsyncDataError::_priority = 2; 180FaultStat AsyncDataError::_count; 181 182FaultName CleanWindow::_name = "clean_win"; 183TrapType CleanWindow::_trapType = 0x024; 184FaultPriority CleanWindow::_priority = 10; 185FaultStat CleanWindow::_count; 186 187//The enumerated faults 188 189FaultName InterruptLevelN::_name = "interrupt_n"; 190TrapType InterruptLevelN::_baseTrapType = 0x041; 191FaultStat InterruptLevelN::_count; 192 193FaultName SpillNNormal::_name = "spill_n_normal"; 194TrapType SpillNNormal::_baseTrapType = 0x080; 195FaultPriority SpillNNormal::_priority = 9; 196FaultStat SpillNNormal::_count; 197 198FaultName SpillNOther::_name = "spill_n_other"; 199TrapType SpillNOther::_baseTrapType = 0x0A0; 200FaultPriority SpillNOther::_priority = 9; 201FaultStat SpillNOther::_count; 202 203FaultName FillNNormal::_name = "fill_n_normal"; 204TrapType FillNNormal::_baseTrapType = 0x0C0; 205FaultPriority FillNNormal::_priority = 9; 206FaultStat FillNNormal::_count; 207 208FaultName FillNOther::_name = "fill_n_other"; 209TrapType FillNOther::_baseTrapType = 0x0E0; 210FaultPriority FillNOther::_priority = 9; 211FaultStat FillNOther::_count; 212 213FaultName TrapInstruction::_name = "trap_inst_n"; 214TrapType TrapInstruction::_baseTrapType = 0x100; 215FaultPriority TrapInstruction::_priority = 16; 216FaultStat TrapInstruction::_count; 217 218 219 220#if FULL_SYSTEM 221 222void SparcFault::invoke(ExecContext * xc) 223{ 224 FaultBase::invoke(xc); 225 countStat()++; 226 227 //Use the SPARC trap state machine 228 /*// exception restart address 229 if (setRestartAddress() || !xc->inPalMode()) 230 xc->setMiscReg(AlphaISA::IPR_EXC_ADDR, xc->regs.pc); 231 232 if (skipFaultingInstruction()) { 233 // traps... skip faulting instruction. 234 xc->setMiscReg(AlphaISA::IPR_EXC_ADDR, 235 xc->readMiscReg(AlphaISA::IPR_EXC_ADDR) + 4); 236 } 237 238 if (!xc->inPalMode()) 239 AlphaISA::swap_palshadow(&(xc->regs), true); 240 241 xc->regs.pc = xc->readMiscReg(AlphaISA::IPR_PAL_BASE) + vect(); 242 xc->regs.npc = xc->regs.pc + sizeof(MachInst);*/ 243} 244 245#endif 246 247} // namespace SparcISA 248 249