faults.cc (2632:1bb2f91485ea) faults.cc (2665:a124942bacb8)
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * Authors: Gabe Black
29 * Kevin Lim
27 */
28
29#include "arch/sparc/faults.hh"
30#include "cpu/exec_context.hh"
31#include "cpu/base.hh"
32#include "base/trace.hh"
33
34namespace SparcISA
35{
36
37FaultName InternalProcessorError::_name = "intprocerr";
38TrapType InternalProcessorError::_trapType = 0x029;
39FaultPriority InternalProcessorError::_priority = 4;
40FaultStat InternalProcessorError::_count;
41
42FaultName MemAddressNotAligned::_name = "unalign";
43TrapType MemAddressNotAligned::_trapType = 0x034;
44FaultPriority MemAddressNotAligned::_priority = 10;
45FaultStat MemAddressNotAligned::_count;
46
47FaultName PowerOnReset::_name = "pow_reset";
48TrapType PowerOnReset::_trapType = 0x001;
49FaultPriority PowerOnReset::_priority = 0;
50FaultStat PowerOnReset::_count;
51
52FaultName WatchDogReset::_name = "watch_dog_reset";
53TrapType WatchDogReset::_trapType = 0x002;
54FaultPriority WatchDogReset::_priority = 1;
55FaultStat WatchDogReset::_count;
56
57FaultName ExternallyInitiatedReset::_name = "extern_reset";
58TrapType ExternallyInitiatedReset::_trapType = 0x003;
59FaultPriority ExternallyInitiatedReset::_priority = 1;
60FaultStat ExternallyInitiatedReset::_count;
61
62FaultName SoftwareInitiatedReset::_name = "software_reset";
63TrapType SoftwareInitiatedReset::_trapType = 0x004;
64FaultPriority SoftwareInitiatedReset::_priority = 1;
65FaultStat SoftwareInitiatedReset::_count;
66
67FaultName REDStateException::_name = "red_counte";
68TrapType REDStateException::_trapType = 0x005;
69FaultPriority REDStateException::_priority = 1;
70FaultStat REDStateException::_count;
71
72FaultName InstructionAccessException::_name = "inst_access";
73TrapType InstructionAccessException::_trapType = 0x008;
74FaultPriority InstructionAccessException::_priority = 5;
75FaultStat InstructionAccessException::_count;
76
77FaultName InstructionAccessMMUMiss::_name = "inst_mmu";
78TrapType InstructionAccessMMUMiss::_trapType = 0x009;
79FaultPriority InstructionAccessMMUMiss::_priority = 2;
80FaultStat InstructionAccessMMUMiss::_count;
81
82FaultName InstructionAccessError::_name = "inst_error";
83TrapType InstructionAccessError::_trapType = 0x00A;
84FaultPriority InstructionAccessError::_priority = 3;
85FaultStat InstructionAccessError::_count;
86
87FaultName IllegalInstruction::_name = "illegal_inst";
88TrapType IllegalInstruction::_trapType = 0x010;
89FaultPriority IllegalInstruction::_priority = 7;
90FaultStat IllegalInstruction::_count;
91
92FaultName PrivilegedOpcode::_name = "priv_opcode";
93TrapType PrivilegedOpcode::_trapType = 0x011;
94FaultPriority PrivilegedOpcode::_priority = 6;
95FaultStat PrivilegedOpcode::_count;
96
97FaultName UnimplementedLDD::_name = "unimp_ldd";
98TrapType UnimplementedLDD::_trapType = 0x012;
99FaultPriority UnimplementedLDD::_priority = 6;
100FaultStat 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#if FULL_SYSTEM
219
220void SparcFault::invoke(ExecContext * xc)
221{
222 FaultBase::invoke(xc);
223 countStat()++;
224
225 //Use the SPARC trap state machine
226 /*// exception restart address
227 if (setRestartAddress() || !xc->inPalMode())
228 xc->setMiscReg(AlphaISA::IPR_EXC_ADDR, xc->regs.pc);
229
230 if (skipFaultingInstruction()) {
231 // traps... skip faulting instruction.
232 xc->setMiscReg(AlphaISA::IPR_EXC_ADDR,
233 xc->readMiscReg(AlphaISA::IPR_EXC_ADDR) + 4);
234 }
235
236 if (!xc->inPalMode())
237 AlphaISA::swap_palshadow(&(xc->regs), true);
238
239 xc->regs.pc = xc->readMiscReg(AlphaISA::IPR_PAL_BASE) + vect();
240 xc->regs.npc = xc->regs.pc + sizeof(MachInst);*/
241}
242
243#endif
244
245#if !FULL_SYSTEM
246
247void TrapInstruction::invoke(ExecContext * xc)
248{
249 xc->syscall(syscall_num);
250}
251
252#endif
253
254} // namespace SparcISA
255
30 */
31
32#include "arch/sparc/faults.hh"
33#include "cpu/exec_context.hh"
34#include "cpu/base.hh"
35#include "base/trace.hh"
36
37namespace SparcISA
38{
39
40FaultName InternalProcessorError::_name = "intprocerr";
41TrapType InternalProcessorError::_trapType = 0x029;
42FaultPriority InternalProcessorError::_priority = 4;
43FaultStat InternalProcessorError::_count;
44
45FaultName MemAddressNotAligned::_name = "unalign";
46TrapType MemAddressNotAligned::_trapType = 0x034;
47FaultPriority MemAddressNotAligned::_priority = 10;
48FaultStat MemAddressNotAligned::_count;
49
50FaultName PowerOnReset::_name = "pow_reset";
51TrapType PowerOnReset::_trapType = 0x001;
52FaultPriority PowerOnReset::_priority = 0;
53FaultStat PowerOnReset::_count;
54
55FaultName WatchDogReset::_name = "watch_dog_reset";
56TrapType WatchDogReset::_trapType = 0x002;
57FaultPriority WatchDogReset::_priority = 1;
58FaultStat WatchDogReset::_count;
59
60FaultName ExternallyInitiatedReset::_name = "extern_reset";
61TrapType ExternallyInitiatedReset::_trapType = 0x003;
62FaultPriority ExternallyInitiatedReset::_priority = 1;
63FaultStat ExternallyInitiatedReset::_count;
64
65FaultName SoftwareInitiatedReset::_name = "software_reset";
66TrapType SoftwareInitiatedReset::_trapType = 0x004;
67FaultPriority SoftwareInitiatedReset::_priority = 1;
68FaultStat SoftwareInitiatedReset::_count;
69
70FaultName REDStateException::_name = "red_counte";
71TrapType REDStateException::_trapType = 0x005;
72FaultPriority REDStateException::_priority = 1;
73FaultStat REDStateException::_count;
74
75FaultName InstructionAccessException::_name = "inst_access";
76TrapType InstructionAccessException::_trapType = 0x008;
77FaultPriority InstructionAccessException::_priority = 5;
78FaultStat InstructionAccessException::_count;
79
80FaultName InstructionAccessMMUMiss::_name = "inst_mmu";
81TrapType InstructionAccessMMUMiss::_trapType = 0x009;
82FaultPriority InstructionAccessMMUMiss::_priority = 2;
83FaultStat InstructionAccessMMUMiss::_count;
84
85FaultName InstructionAccessError::_name = "inst_error";
86TrapType InstructionAccessError::_trapType = 0x00A;
87FaultPriority InstructionAccessError::_priority = 3;
88FaultStat InstructionAccessError::_count;
89
90FaultName IllegalInstruction::_name = "illegal_inst";
91TrapType IllegalInstruction::_trapType = 0x010;
92FaultPriority IllegalInstruction::_priority = 7;
93FaultStat IllegalInstruction::_count;
94
95FaultName PrivilegedOpcode::_name = "priv_opcode";
96TrapType PrivilegedOpcode::_trapType = 0x011;
97FaultPriority PrivilegedOpcode::_priority = 6;
98FaultStat PrivilegedOpcode::_count;
99
100FaultName UnimplementedLDD::_name = "unimp_ldd";
101TrapType UnimplementedLDD::_trapType = 0x012;
102FaultPriority UnimplementedLDD::_priority = 6;
103FaultStat UnimplementedLDD::_count;
104
105FaultName UnimplementedSTD::_name = "unimp_std";
106TrapType UnimplementedSTD::_trapType = 0x013;
107FaultPriority UnimplementedSTD::_priority = 6;
108FaultStat UnimplementedSTD::_count;
109
110FaultName FpDisabled::_name = "fp_disabled";
111TrapType FpDisabled::_trapType = 0x020;
112FaultPriority FpDisabled::_priority = 8;
113FaultStat FpDisabled::_count;
114
115FaultName FpExceptionIEEE754::_name = "fp_754";
116TrapType FpExceptionIEEE754::_trapType = 0x021;
117FaultPriority FpExceptionIEEE754::_priority = 11;
118FaultStat FpExceptionIEEE754::_count;
119
120FaultName FpExceptionOther::_name = "fp_other";
121TrapType FpExceptionOther::_trapType = 0x022;
122FaultPriority FpExceptionOther::_priority = 11;
123FaultStat FpExceptionOther::_count;
124
125FaultName TagOverflow::_name = "tag_overflow";
126TrapType TagOverflow::_trapType = 0x023;
127FaultPriority TagOverflow::_priority = 14;
128FaultStat TagOverflow::_count;
129
130FaultName DivisionByZero::_name = "div_by_zero";
131TrapType DivisionByZero::_trapType = 0x028;
132FaultPriority DivisionByZero::_priority = 15;
133FaultStat DivisionByZero::_count;
134
135FaultName DataAccessException::_name = "data_access";
136TrapType DataAccessException::_trapType = 0x030;
137FaultPriority DataAccessException::_priority = 12;
138FaultStat DataAccessException::_count;
139
140FaultName DataAccessMMUMiss::_name = "data_mmu";
141TrapType DataAccessMMUMiss::_trapType = 0x031;
142FaultPriority DataAccessMMUMiss::_priority = 12;
143FaultStat DataAccessMMUMiss::_count;
144
145FaultName DataAccessError::_name = "data_error";
146TrapType DataAccessError::_trapType = 0x032;
147FaultPriority DataAccessError::_priority = 12;
148FaultStat DataAccessError::_count;
149
150FaultName DataAccessProtection::_name = "data_protection";
151TrapType DataAccessProtection::_trapType = 0x033;
152FaultPriority DataAccessProtection::_priority = 12;
153FaultStat DataAccessProtection::_count;
154
155FaultName LDDFMemAddressNotAligned::_name = "unalign_lddf";
156TrapType LDDFMemAddressNotAligned::_trapType = 0x035;
157FaultPriority LDDFMemAddressNotAligned::_priority = 10;
158FaultStat LDDFMemAddressNotAligned::_count;
159
160FaultName STDFMemAddressNotAligned::_name = "unalign_stdf";
161TrapType STDFMemAddressNotAligned::_trapType = 0x036;
162FaultPriority STDFMemAddressNotAligned::_priority = 10;
163FaultStat STDFMemAddressNotAligned::_count;
164
165FaultName PrivilegedAction::_name = "priv_action";
166TrapType PrivilegedAction::_trapType = 0x037;
167FaultPriority PrivilegedAction::_priority = 11;
168FaultStat PrivilegedAction::_count;
169
170FaultName LDQFMemAddressNotAligned::_name = "unalign_ldqf";
171TrapType LDQFMemAddressNotAligned::_trapType = 0x038;
172FaultPriority LDQFMemAddressNotAligned::_priority = 10;
173FaultStat LDQFMemAddressNotAligned::_count;
174
175FaultName STQFMemAddressNotAligned::_name = "unalign_stqf";
176TrapType STQFMemAddressNotAligned::_trapType = 0x039;
177FaultPriority STQFMemAddressNotAligned::_priority = 10;
178FaultStat STQFMemAddressNotAligned::_count;
179
180FaultName AsyncDataError::_name = "async_data";
181TrapType AsyncDataError::_trapType = 0x040;
182FaultPriority AsyncDataError::_priority = 2;
183FaultStat AsyncDataError::_count;
184
185FaultName CleanWindow::_name = "clean_win";
186TrapType CleanWindow::_trapType = 0x024;
187FaultPriority CleanWindow::_priority = 10;
188FaultStat CleanWindow::_count;
189
190//The enumerated faults
191
192FaultName InterruptLevelN::_name = "interrupt_n";
193TrapType InterruptLevelN::_baseTrapType = 0x041;
194FaultStat InterruptLevelN::_count;
195
196FaultName SpillNNormal::_name = "spill_n_normal";
197TrapType SpillNNormal::_baseTrapType = 0x080;
198FaultPriority SpillNNormal::_priority = 9;
199FaultStat SpillNNormal::_count;
200
201FaultName SpillNOther::_name = "spill_n_other";
202TrapType SpillNOther::_baseTrapType = 0x0A0;
203FaultPriority SpillNOther::_priority = 9;
204FaultStat SpillNOther::_count;
205
206FaultName FillNNormal::_name = "fill_n_normal";
207TrapType FillNNormal::_baseTrapType = 0x0C0;
208FaultPriority FillNNormal::_priority = 9;
209FaultStat FillNNormal::_count;
210
211FaultName FillNOther::_name = "fill_n_other";
212TrapType FillNOther::_baseTrapType = 0x0E0;
213FaultPriority FillNOther::_priority = 9;
214FaultStat FillNOther::_count;
215
216FaultName TrapInstruction::_name = "trap_inst_n";
217TrapType TrapInstruction::_baseTrapType = 0x100;
218FaultPriority TrapInstruction::_priority = 16;
219FaultStat TrapInstruction::_count;
220
221#if FULL_SYSTEM
222
223void SparcFault::invoke(ExecContext * xc)
224{
225 FaultBase::invoke(xc);
226 countStat()++;
227
228 //Use the SPARC trap state machine
229 /*// exception restart address
230 if (setRestartAddress() || !xc->inPalMode())
231 xc->setMiscReg(AlphaISA::IPR_EXC_ADDR, xc->regs.pc);
232
233 if (skipFaultingInstruction()) {
234 // traps... skip faulting instruction.
235 xc->setMiscReg(AlphaISA::IPR_EXC_ADDR,
236 xc->readMiscReg(AlphaISA::IPR_EXC_ADDR) + 4);
237 }
238
239 if (!xc->inPalMode())
240 AlphaISA::swap_palshadow(&(xc->regs), true);
241
242 xc->regs.pc = xc->readMiscReg(AlphaISA::IPR_PAL_BASE) + vect();
243 xc->regs.npc = xc->regs.pc + sizeof(MachInst);*/
244}
245
246#endif
247
248#if !FULL_SYSTEM
249
250void TrapInstruction::invoke(ExecContext * xc)
251{
252 xc->syscall(syscall_num);
253}
254
255#endif
256
257} // namespace SparcISA
258