faults.cc revision 2221
12SN/A/* 21762SN/A * Copyright (c) 2003-2005 The Regents of The University of Michigan 32SN/A * All rights reserved. 42SN/A * 52SN/A * Redistribution and use in source and binary forms, with or without 62SN/A * modification, are permitted provided that the following conditions are 72SN/A * met: redistributions of source code must retain the above copyright 82SN/A * notice, this list of conditions and the following disclaimer; 92SN/A * redistributions in binary form must reproduce the above copyright 102SN/A * notice, this list of conditions and the following disclaimer in the 112SN/A * documentation and/or other materials provided with the distribution; 122SN/A * neither the name of the copyright holders nor the names of its 132SN/A * contributors may be used to endorse or promote products derived from 142SN/A * this software without specific prior written permission. 152SN/A * 162SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665Ssaidi@eecs.umich.edu */ 282665Ssaidi@eecs.umich.edu 292665Ssaidi@eecs.umich.edu#include "arch/alpha/faults.hh" 302SN/A#include "cpu/exec_context.hh" 312SN/A#include "cpu/base.hh" 322439SN/A#include "base/trace.hh" 332090SN/A#include "kern/kernel_stats.hh" 342680Sktlim@umich.edu 352222SN/Anamespace AlphaISA 362SN/A{ 372201SN/A 382680Sktlim@umich.eduFaultName MachineCheckFault::_name = "mchk"; 392201SN/AFaultVect MachineCheckFault::_vect = 0x0401; 403363Sstever@eecs.umich.eduFaultStat MachineCheckFault::_stat; 412201SN/A 422222SN/AFaultName AlignmentFault::_name = "unalign"; 432680Sktlim@umich.eduFaultVect AlignmentFault::_vect = 0x0301; 442222SN/AFaultStat AlignmentFault::_stat; 452680Sktlim@umich.edu 462680Sktlim@umich.eduFaultName ResetFault::_name = "reset"; 472222SN/AFaultVect ResetFault::_vect = 0x0001; 482680Sktlim@umich.eduFaultStat ResetFault::_stat; 492222SN/A 502201SN/AFaultName ArithmeticFault::_name = "arith"; 512612SN/AFaultVect ArithmeticFault::_vect = 0x0501; 522680Sktlim@umich.eduFaultStat ArithmeticFault::_stat; 532612SN/A 542612SN/AFaultName InterruptFault::_name = "interrupt"; 552612SN/AFaultVect InterruptFault::_vect = 0x0101; 56FaultStat InterruptFault::_stat; 57 58FaultName NDtbMissFault::_name = "dtb_miss_single"; 59FaultVect NDtbMissFault::_vect = 0x0201; 60FaultStat NDtbMissFault::_stat; 61 62FaultName PDtbMissFault::_name = "dtb_miss_double"; 63FaultVect PDtbMissFault::_vect = 0x0281; 64FaultStat PDtbMissFault::_stat; 65 66FaultName DtbPageFault::_name = "dfault"; 67FaultVect DtbPageFault::_vect = 0x0381; 68FaultStat DtbPageFault::_stat; 69 70FaultName DtbAcvFault::_name = "dfault"; 71FaultVect DtbAcvFault::_vect = 0x0381; 72FaultStat DtbAcvFault::_stat; 73 74FaultName ItbMissFault::_name = "itbmiss"; 75FaultVect ItbMissFault::_vect = 0x0181; 76FaultStat ItbMissFault::_stat; 77 78FaultName ItbPageFault::_name = "itbmiss"; 79FaultVect ItbPageFault::_vect = 0x0181; 80FaultStat ItbPageFault::_stat; 81 82FaultName ItbAcvFault::_name = "iaccvio"; 83FaultVect ItbAcvFault::_vect = 0x0081; 84FaultStat ItbAcvFault::_stat; 85 86FaultName UnimplementedOpcodeFault::_name = "opdec"; 87FaultVect UnimplementedOpcodeFault::_vect = 0x0481; 88FaultStat UnimplementedOpcodeFault::_stat; 89 90FaultName FloatEnableFault::_name = "fen"; 91FaultVect FloatEnableFault::_vect = 0x0581; 92FaultStat FloatEnableFault::_stat; 93 94FaultName PalFault::_name = "pal"; 95FaultVect PalFault::_vect = 0x2001; 96FaultStat PalFault::_stat; 97 98FaultName IntegerOverflowFault::_name = "intover"; 99FaultVect IntegerOverflowFault::_vect = 0x0501; 100FaultStat IntegerOverflowFault::_stat; 101 102#if FULL_SYSTEM 103 104void AlphaFault::invoke(ExecContext * xc) 105{ 106 DPRINTF(Fault, "Fault %s at PC: %#x\n", name(), xc->regs.pc); 107 xc->cpu->recordEvent(csprintf("Fault %s", name())); 108 109 assert(!xc->misspeculating()); 110 xc->kernelStats->fault(this); 111 112 // exception restart address 113 if (setRestartAddress() || !xc->inPalMode()) 114 xc->setMiscReg(AlphaISA::IPR_EXC_ADDR, xc->regs.pc); 115 116 if (skipFaultingInstruction()) { 117 // traps... skip faulting instruction. 118 xc->setMiscReg(AlphaISA::IPR_EXC_ADDR, 119 xc->readMiscReg(AlphaISA::IPR_EXC_ADDR) + 4); 120 } 121 122 if (!xc->inPalMode()) 123 AlphaISA::swap_palshadow(&(xc->regs), true); 124 125 xc->regs.pc = xc->readMiscReg(AlphaISA::IPR_PAL_BASE) + vect(); 126 xc->regs.npc = xc->regs.pc + sizeof(MachInst); 127} 128 129void ArithmeticFault::invoke(ExecContext * xc) 130{ 131 DPRINTF(Fault, "Fault %s at PC: %#x\n", name(), xc->regs.pc); 132 xc->cpu->recordEvent(csprintf("Fault %s", name())); 133 134 assert(!xc->misspeculating()); 135 xc->kernelStats->fault(this); 136 137 panic("Arithmetic traps are unimplemented!"); 138} 139 140 141/*void ArithmeticFault::invoke(ExecContext * xc) 142{ 143 panic("Arithmetic traps are unimplemented!"); 144}*/ 145 146#endif 147 148} // namespace AlphaISA 149 150/*Fault * ListOfFaults[] = { 151 (Fault *)&NoFault, 152 (Fault *)&ResetFault, 153 (Fault *)&MachineCheckFault, 154 (Fault *)&ArithmeticFault, 155 (Fault *)&InterruptFault, 156 (Fault *)&NDtbMissFault, 157 (Fault *)&PDtbMissFault, 158 (Fault *)&AlignmentFault, 159 (Fault *)&DtbPageFault, 160 (Fault *)&DtbAcvFault, 161 (Fault *)&ItbMissFault, 162 (Fault *)&ItbPageFault, 163 (Fault *)&ItbAcvFault, 164 (Fault *)&UnimplementedOpcodeFault, 165 (Fault *)&FloatEnableFault, 166 (Fault *)&PalFault, 167 (Fault *)&IntegerOverflowFault, 168 }; 169 170int NumFaults = sizeof(ListOfFaults) / sizeof(Fault *);*/ 171