faults.cc revision 2469
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/sparc/faults.hh"
302SN/A#include "cpu/exec_context.hh"
312SN/A#include "cpu/base.hh"
322SN/A#include "base/trace.hh"
332SN/A
342SN/Anamespace SparcISA
352SN/A{
362SN/A
372432SN/AFaultName     InternalProcessorError::_name = "intprocerr";
381147SN/ATrapType      InternalProcessorError::_trapType = 0x029;
393453Sgblack@eecs.umich.eduFaultPriority InternalProcessorError::_priority = 4;
402984Sgblack@eecs.umich.eduFaultStat     InternalProcessorError::_count;
412984Sgblack@eecs.umich.edu
421147SN/AFaultName     MemAddressNotAligned::_name = "unalign";
432517SN/ATrapType      MemAddressNotAligned::_trapType = 0x034;
442984Sgblack@eecs.umich.eduFaultPriority MemAddressNotAligned::_priority = 10;
4556SN/AFaultStat     MemAddressNotAligned::_count;
462SN/A
472680Sktlim@umich.eduFaultName     PowerOnReset::_name = "pow_reset";
482SN/ATrapType      PowerOnReset::_trapType = 0x001;
493453Sgblack@eecs.umich.eduFaultPriority PowerOnReset::_priority = 0;
502SN/AFaultStat     PowerOnReset::_count;
513453Sgblack@eecs.umich.edu
522SN/AFaultName     WatchDogReset::_name = "watch_dog_reset";
533453Sgblack@eecs.umich.eduTrapType      WatchDogReset::_trapType = 0x002;
543453Sgblack@eecs.umich.eduFaultPriority WatchDogReset::_priority = 1;
553453Sgblack@eecs.umich.eduFaultStat     WatchDogReset::_count;
563453Sgblack@eecs.umich.edu
573453Sgblack@eecs.umich.eduFaultName     ExternallyInitiatedReset::_name = "extern_reset";
582SN/ATrapType      ExternallyInitiatedReset::_trapType = 0x003;
593453Sgblack@eecs.umich.eduFaultPriority ExternallyInitiatedReset::_priority = 1;
603453Sgblack@eecs.umich.eduFaultStat     ExternallyInitiatedReset::_count;
613453Sgblack@eecs.umich.edu
622SN/AFaultName     SoftwareInitiatedReset::_name = "software_reset";
633453Sgblack@eecs.umich.eduTrapType      SoftwareInitiatedReset::_trapType = 0x004;
643453Sgblack@eecs.umich.eduFaultPriority SoftwareInitiatedReset::_priority = 1;
652SN/AFaultStat     SoftwareInitiatedReset::_count;
663453Sgblack@eecs.umich.edu
673453Sgblack@eecs.umich.eduFaultName     REDStateException::_name = "red_counte";
683453Sgblack@eecs.umich.eduTrapType      REDStateException::_trapType = 0x005;
692SN/AFaultPriority REDStateException::_priority = 1;
703453Sgblack@eecs.umich.eduFaultStat     REDStateException::_count;
712SN/A
723453Sgblack@eecs.umich.eduFaultName     InstructionAccessException::_name = "inst_access";
733453Sgblack@eecs.umich.eduTrapType      InstructionAccessException::_trapType = 0x008;
742SN/AFaultPriority InstructionAccessException::_priority = 5;
753453Sgblack@eecs.umich.eduFaultStat     InstructionAccessException::_count;
763453Sgblack@eecs.umich.edu
773453Sgblack@eecs.umich.eduFaultName     InstructionAccessMMUMiss::_name = "inst_mmu";
782SN/ATrapType      InstructionAccessMMUMiss::_trapType = 0x009;
793453Sgblack@eecs.umich.eduFaultPriority InstructionAccessMMUMiss::_priority = 2;
803453Sgblack@eecs.umich.eduFaultStat     InstructionAccessMMUMiss::_count;
813453Sgblack@eecs.umich.edu
823453Sgblack@eecs.umich.eduFaultName     InstructionAccessError::_name = "inst_error";
833453Sgblack@eecs.umich.eduTrapType      InstructionAccessError::_trapType = 0x00A;
843453Sgblack@eecs.umich.eduFaultPriority InstructionAccessError::_priority = 3;
852SN/AFaultStat     InstructionAccessError::_count;
863453Sgblack@eecs.umich.edu
872SN/AFaultName     IllegalInstruction::_name = "illegal_inst";
883453Sgblack@eecs.umich.eduTrapType      IllegalInstruction::_trapType = 0x010;
893453Sgblack@eecs.umich.eduFaultPriority IllegalInstruction::_priority = 7;
903453Sgblack@eecs.umich.eduFaultStat     IllegalInstruction::_count;
914957Sacolyte@umich.edu
924957Sacolyte@umich.eduFaultName     PrivilegedOpcode::_name = "priv_opcode";
934957Sacolyte@umich.eduTrapType      PrivilegedOpcode::_trapType = 0x011;
944957Sacolyte@umich.eduFaultPriority PrivilegedOpcode::_priority = 6;
953453Sgblack@eecs.umich.eduFaultStat     PrivilegedOpcode::_count;
962SN/A
973453Sgblack@eecs.umich.eduFaultName     UnimplementedLDD::_name = "unimp_ldd";
983453Sgblack@eecs.umich.eduTrapType      UnimplementedLDD::_trapType = 0x012;
993453Sgblack@eecs.umich.eduFaultPriority UnimplementedLDD::_priority = 6;
1003453Sgblack@eecs.umich.eduFaultStat     UnimplementedLDD::_count;
1013453Sgblack@eecs.umich.edu
1023453Sgblack@eecs.umich.eduFaultName     UnimplementedSTD::_name = "unimp_std";
1033453Sgblack@eecs.umich.eduTrapType      UnimplementedSTD::_trapType = 0x013;
1042SN/AFaultPriority UnimplementedSTD::_priority = 6;
1053453Sgblack@eecs.umich.eduFaultStat     UnimplementedSTD::_count;
1063453Sgblack@eecs.umich.edu
1073453Sgblack@eecs.umich.eduFaultName     FpDisabled::_name = "fp_disabled";
1082SN/ATrapType      FpDisabled::_trapType = 0x020;
1093453Sgblack@eecs.umich.eduFaultPriority FpDisabled::_priority = 8;
1103453Sgblack@eecs.umich.eduFaultStat     FpDisabled::_count;
1112SN/A
1123453Sgblack@eecs.umich.eduFaultName     FpExceptionIEEE754::_name = "fp_754";
1133453Sgblack@eecs.umich.eduTrapType      FpExceptionIEEE754::_trapType = 0x021;
1143453Sgblack@eecs.umich.eduFaultPriority FpExceptionIEEE754::_priority = 11;
1153453Sgblack@eecs.umich.eduFaultStat     FpExceptionIEEE754::_count;
1163453Sgblack@eecs.umich.edu
1173453Sgblack@eecs.umich.eduFaultName     FpExceptionOther::_name = "fp_other";
1183453Sgblack@eecs.umich.eduTrapType      FpExceptionOther::_trapType = 0x022;
1193453Sgblack@eecs.umich.eduFaultPriority FpExceptionOther::_priority = 11;
1203453Sgblack@eecs.umich.eduFaultStat     FpExceptionOther::_count;
1213453Sgblack@eecs.umich.edu
1223453Sgblack@eecs.umich.eduFaultName     TagOverflow::_name = "tag_overflow";
1233453Sgblack@eecs.umich.eduTrapType      TagOverflow::_trapType = 0x023;
1243453Sgblack@eecs.umich.eduFaultPriority TagOverflow::_priority = 14;
1253453Sgblack@eecs.umich.eduFaultStat     TagOverflow::_count;
1263453Sgblack@eecs.umich.edu
1272SN/AFaultName     DivisionByZero::_name = "div_by_zero";
1283453Sgblack@eecs.umich.eduTrapType      DivisionByZero::_trapType = 0x028;
1293453Sgblack@eecs.umich.eduFaultPriority DivisionByZero::_priority = 15;
1303453Sgblack@eecs.umich.eduFaultStat     DivisionByZero::_count;
1313453Sgblack@eecs.umich.edu
1323453Sgblack@eecs.umich.eduFaultName     DataAccessException::_name = "data_access";
1333453Sgblack@eecs.umich.eduTrapType      DataAccessException::_trapType = 0x030;
1343453Sgblack@eecs.umich.eduFaultPriority DataAccessException::_priority = 12;
1352SN/AFaultStat     DataAccessException::_count;
1362SN/A
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
182//The enumerated faults
183
184FaultName     CleanWindow::_name = "clean_win";
185TrapType      CleanWindow::_baseTrapType = 0x024;
186FaultPriority CleanWindow::_priority = 10;
187FaultStat     CleanWindow::_count;
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