Rev 4132 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4132 | Rev 4137 | ||
---|---|---|---|
1 | /* |
1 | /* |
2 | * Copyright (c) 2005 Jakub Jermar |
2 | * Copyright (c) 2005 Jakub Jermar |
3 | * All rights reserved. |
3 | * All rights reserved. |
4 | * |
4 | * |
5 | * Redistribution and use in source and binary forms, with or without |
5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions |
6 | * modification, are permitted provided that the following conditions |
7 | * are met: |
7 | * are met: |
8 | * |
8 | * |
9 | * - Redistributions of source code must retain the above copyright |
9 | * - Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. |
10 | * notice, this list of conditions and the following disclaimer. |
11 | * - Redistributions in binary form must reproduce the above copyright |
11 | * - Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the |
12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. |
13 | * documentation and/or other materials provided with the distribution. |
14 | * - The name of the author may not be used to endorse or promote products |
14 | * - The name of the author may not be used to endorse or promote products |
15 | * derived from this software without specific prior written permission. |
15 | * derived from this software without specific prior written permission. |
16 | * |
16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
27 | */ |
28 | 28 | ||
29 | /** @addtogroup sparc64interrupt |
29 | /** @addtogroup sparc64interrupt |
30 | * @{ |
30 | * @{ |
31 | */ |
31 | */ |
32 | /** @file |
32 | /** @file |
33 | * |
33 | * |
34 | */ |
34 | */ |
35 | 35 | ||
36 | #include <arch/trap/exception.h> |
36 | #include <arch/trap/exception.h> |
37 | #include <arch/mm/tlb.h> |
37 | #include <arch/mm/tlb.h> |
38 | #include <arch/interrupt.h> |
38 | #include <arch/interrupt.h> |
39 | #include <interrupt.h> |
39 | #include <interrupt.h> |
40 | #include <arch/asm.h> |
40 | #include <arch/asm.h> |
41 | #include <arch/register.h> |
41 | #include <arch/register.h> |
42 | #include <debug.h> |
42 | #include <debug.h> |
43 | #include <print.h> |
43 | #include <print.h> |
44 | - | ||
45 | #ifdef CONFIG_SYMTAB |
- | |
46 | #include <symtab.h> |
44 | #include <symtab.h> |
47 | #endif |
- | |
48 | 45 | ||
49 | void dump_istate(istate_t *istate) |
46 | void dump_istate(istate_t *istate) |
50 | { |
47 | { |
51 | char *tpcs, *tnpcs; |
48 | char *tpcs, *tnpcs; |
52 | 49 | ||
53 | #ifdef CONFIG_SYMTAB |
- | |
54 | tpcs = get_symtab_entry(istate->tpc); |
50 | tpcs = symtab_fmt_name_lookup(istate->tpc); |
55 | tnpcs = get_symtab_entry(istate->tnpc); |
51 | tnpcs = symtab_fmt_name_lookup(istate->tnpc); |
56 | #else |
52 | |
57 | tpcs = tnpcs = "n/a"; |
- | |
58 | #endif |
- | |
59 | printf("TSTATE=%#" PRIx64 "\n", istate->tstate); |
53 | printf("TSTATE=%#" PRIx64 "\n", istate->tstate); |
60 | printf("TPC=%#" PRIx64 " (%s)\n", istate->tpc, tpcs); |
54 | printf("TPC=%#" PRIx64 " (%s)\n", istate->tpc, tpcs); |
61 | printf("TNPC=%#" PRIx64 " (%s)\n", istate->tnpc, tnpcs); |
55 | printf("TNPC=%#" PRIx64 " (%s)\n", istate->tnpc, tnpcs); |
62 | } |
56 | } |
63 | 57 | ||
64 | /** Handle instruction_access_exception. (0x8) */ |
58 | /** Handle instruction_access_exception. (0x8) */ |
65 | void instruction_access_exception(int n, istate_t *istate) |
59 | void instruction_access_exception(int n, istate_t *istate) |
66 | { |
60 | { |
67 | fault_if_from_uspace(istate, "%s.", __func__); |
61 | fault_if_from_uspace(istate, "%s.", __func__); |
68 | dump_istate(istate); |
62 | dump_istate(istate); |
69 | panic("%s.", __func__); |
63 | panic("%s.", __func__); |
70 | } |
64 | } |
71 | 65 | ||
72 | /** Handle instruction_access_error. (0xa) */ |
66 | /** Handle instruction_access_error. (0xa) */ |
73 | void instruction_access_error(int n, istate_t *istate) |
67 | void instruction_access_error(int n, istate_t *istate) |
74 | { |
68 | { |
75 | fault_if_from_uspace(istate, "%s.", __func__); |
69 | fault_if_from_uspace(istate, "%s.", __func__); |
76 | dump_istate(istate); |
70 | dump_istate(istate); |
77 | panic("%s.", __func__); |
71 | panic("%s.", __func__); |
78 | } |
72 | } |
79 | 73 | ||
80 | /** Handle illegal_instruction. (0x10) */ |
74 | /** Handle illegal_instruction. (0x10) */ |
81 | void illegal_instruction(int n, istate_t *istate) |
75 | void illegal_instruction(int n, istate_t *istate) |
82 | { |
76 | { |
83 | fault_if_from_uspace(istate, "%s.", __func__); |
77 | fault_if_from_uspace(istate, "%s.", __func__); |
84 | dump_istate(istate); |
78 | dump_istate(istate); |
85 | panic("%s.", __func__); |
79 | panic("%s.", __func__); |
86 | } |
80 | } |
87 | 81 | ||
88 | /** Handle privileged_opcode. (0x11) */ |
82 | /** Handle privileged_opcode. (0x11) */ |
89 | void privileged_opcode(int n, istate_t *istate) |
83 | void privileged_opcode(int n, istate_t *istate) |
90 | { |
84 | { |
91 | fault_if_from_uspace(istate, "%s.", __func__); |
85 | fault_if_from_uspace(istate, "%s.", __func__); |
92 | dump_istate(istate); |
86 | dump_istate(istate); |
93 | panic("%s.", __func__); |
87 | panic("%s.", __func__); |
94 | } |
88 | } |
95 | 89 | ||
96 | /** Handle unimplemented_LDD. (0x12) */ |
90 | /** Handle unimplemented_LDD. (0x12) */ |
97 | void unimplemented_LDD(int n, istate_t *istate) |
91 | void unimplemented_LDD(int n, istate_t *istate) |
98 | { |
92 | { |
99 | fault_if_from_uspace(istate, "%s.", __func__); |
93 | fault_if_from_uspace(istate, "%s.", __func__); |
100 | dump_istate(istate); |
94 | dump_istate(istate); |
101 | panic("%s.", __func__); |
95 | panic("%s.", __func__); |
102 | } |
96 | } |
103 | 97 | ||
104 | /** Handle unimplemented_STD. (0x13) */ |
98 | /** Handle unimplemented_STD. (0x13) */ |
105 | void unimplemented_STD(int n, istate_t *istate) |
99 | void unimplemented_STD(int n, istate_t *istate) |
106 | { |
100 | { |
107 | fault_if_from_uspace(istate, "%s.", __func__); |
101 | fault_if_from_uspace(istate, "%s.", __func__); |
108 | dump_istate(istate); |
102 | dump_istate(istate); |
109 | panic("%s.", __func__); |
103 | panic("%s.", __func__); |
110 | } |
104 | } |
111 | 105 | ||
112 | /** Handle fp_disabled. (0x20) */ |
106 | /** Handle fp_disabled. (0x20) */ |
113 | void fp_disabled(int n, istate_t *istate) |
107 | void fp_disabled(int n, istate_t *istate) |
114 | { |
108 | { |
115 | fprs_reg_t fprs; |
109 | fprs_reg_t fprs; |
116 | 110 | ||
117 | fprs.value = fprs_read(); |
111 | fprs.value = fprs_read(); |
118 | if (!fprs.fef) { |
112 | if (!fprs.fef) { |
119 | fprs.fef = true; |
113 | fprs.fef = true; |
120 | fprs_write(fprs.value); |
114 | fprs_write(fprs.value); |
121 | return; |
115 | return; |
122 | } |
116 | } |
123 | 117 | ||
124 | #ifdef CONFIG_FPU_LAZY |
118 | #ifdef CONFIG_FPU_LAZY |
125 | scheduler_fpu_lazy_request(); |
119 | scheduler_fpu_lazy_request(); |
126 | #else |
120 | #else |
127 | fault_if_from_uspace(istate, "%s.", __func__); |
121 | fault_if_from_uspace(istate, "%s.", __func__); |
128 | dump_istate(istate); |
122 | dump_istate(istate); |
129 | panic("%s.", __func__); |
123 | panic("%s.", __func__); |
130 | #endif |
124 | #endif |
131 | } |
125 | } |
132 | 126 | ||
133 | /** Handle fp_exception_ieee_754. (0x21) */ |
127 | /** Handle fp_exception_ieee_754. (0x21) */ |
134 | void fp_exception_ieee_754(int n, istate_t *istate) |
128 | void fp_exception_ieee_754(int n, istate_t *istate) |
135 | { |
129 | { |
136 | fault_if_from_uspace(istate, "%s.", __func__); |
130 | fault_if_from_uspace(istate, "%s.", __func__); |
137 | dump_istate(istate); |
131 | dump_istate(istate); |
138 | panic("%s.", __func__); |
132 | panic("%s.", __func__); |
139 | } |
133 | } |
140 | 134 | ||
141 | /** Handle fp_exception_other. (0x22) */ |
135 | /** Handle fp_exception_other. (0x22) */ |
142 | void fp_exception_other(int n, istate_t *istate) |
136 | void fp_exception_other(int n, istate_t *istate) |
143 | { |
137 | { |
144 | fault_if_from_uspace(istate, "%s.", __func__); |
138 | fault_if_from_uspace(istate, "%s.", __func__); |
145 | dump_istate(istate); |
139 | dump_istate(istate); |
146 | panic("%s.", __func__); |
140 | panic("%s.", __func__); |
147 | } |
141 | } |
148 | 142 | ||
149 | /** Handle tag_overflow. (0x23) */ |
143 | /** Handle tag_overflow. (0x23) */ |
150 | void tag_overflow(int n, istate_t *istate) |
144 | void tag_overflow(int n, istate_t *istate) |
151 | { |
145 | { |
152 | fault_if_from_uspace(istate, "%s.", __func__); |
146 | fault_if_from_uspace(istate, "%s.", __func__); |
153 | dump_istate(istate); |
147 | dump_istate(istate); |
154 | panic("%s.", __func__); |
148 | panic("%s.", __func__); |
155 | } |
149 | } |
156 | 150 | ||
157 | /** Handle division_by_zero. (0x28) */ |
151 | /** Handle division_by_zero. (0x28) */ |
158 | void division_by_zero(int n, istate_t *istate) |
152 | void division_by_zero(int n, istate_t *istate) |
159 | { |
153 | { |
160 | fault_if_from_uspace(istate, "%s.", __func__); |
154 | fault_if_from_uspace(istate, "%s.", __func__); |
161 | dump_istate(istate); |
155 | dump_istate(istate); |
162 | panic("%s.", __func__); |
156 | panic("%s.", __func__); |
163 | } |
157 | } |
164 | 158 | ||
165 | /** Handle data_access_exception. (0x30) */ |
159 | /** Handle data_access_exception. (0x30) */ |
166 | void data_access_exception(int n, istate_t *istate) |
160 | void data_access_exception(int n, istate_t *istate) |
167 | { |
161 | { |
168 | fault_if_from_uspace(istate, "%s.", __func__); |
162 | fault_if_from_uspace(istate, "%s.", __func__); |
169 | dump_istate(istate); |
163 | dump_istate(istate); |
170 | dump_sfsr_and_sfar(); |
164 | dump_sfsr_and_sfar(); |
171 | panic("%s.", __func__); |
165 | panic("%s.", __func__); |
172 | } |
166 | } |
173 | 167 | ||
174 | /** Handle data_access_error. (0x32) */ |
168 | /** Handle data_access_error. (0x32) */ |
175 | void data_access_error(int n, istate_t *istate) |
169 | void data_access_error(int n, istate_t *istate) |
176 | { |
170 | { |
177 | fault_if_from_uspace(istate, "%s.", __func__); |
171 | fault_if_from_uspace(istate, "%s.", __func__); |
178 | dump_istate(istate); |
172 | dump_istate(istate); |
179 | panic("%s.", __func__); |
173 | panic("%s.", __func__); |
180 | } |
174 | } |
181 | 175 | ||
182 | /** Handle mem_address_not_aligned. (0x34) */ |
176 | /** Handle mem_address_not_aligned. (0x34) */ |
183 | void mem_address_not_aligned(int n, istate_t *istate) |
177 | void mem_address_not_aligned(int n, istate_t *istate) |
184 | { |
178 | { |
185 | fault_if_from_uspace(istate, "%s.", __func__); |
179 | fault_if_from_uspace(istate, "%s.", __func__); |
186 | dump_istate(istate); |
180 | dump_istate(istate); |
187 | panic("%s.", __func__); |
181 | panic("%s.", __func__); |
188 | } |
182 | } |
189 | 183 | ||
190 | /** Handle LDDF_mem_address_not_aligned. (0x35) */ |
184 | /** Handle LDDF_mem_address_not_aligned. (0x35) */ |
191 | void LDDF_mem_address_not_aligned(int n, istate_t *istate) |
185 | void LDDF_mem_address_not_aligned(int n, istate_t *istate) |
192 | { |
186 | { |
193 | fault_if_from_uspace(istate, "%s.", __func__); |
187 | fault_if_from_uspace(istate, "%s.", __func__); |
194 | dump_istate(istate); |
188 | dump_istate(istate); |
195 | panic("%s.", __func__); |
189 | panic("%s.", __func__); |
196 | } |
190 | } |
197 | 191 | ||
198 | /** Handle STDF_mem_address_not_aligned. (0x36) */ |
192 | /** Handle STDF_mem_address_not_aligned. (0x36) */ |
199 | void STDF_mem_address_not_aligned(int n, istate_t *istate) |
193 | void STDF_mem_address_not_aligned(int n, istate_t *istate) |
200 | { |
194 | { |
201 | fault_if_from_uspace(istate, "%s.", __func__); |
195 | fault_if_from_uspace(istate, "%s.", __func__); |
202 | dump_istate(istate); |
196 | dump_istate(istate); |
203 | panic("%s.", __func__); |
197 | panic("%s.", __func__); |
204 | } |
198 | } |
205 | 199 | ||
206 | /** Handle privileged_action. (0x37) */ |
200 | /** Handle privileged_action. (0x37) */ |
207 | void privileged_action(int n, istate_t *istate) |
201 | void privileged_action(int n, istate_t *istate) |
208 | { |
202 | { |
209 | fault_if_from_uspace(istate, "%s.", __func__); |
203 | fault_if_from_uspace(istate, "%s.", __func__); |
210 | dump_istate(istate); |
204 | dump_istate(istate); |
211 | panic("%s.", __func__); |
205 | panic("%s.", __func__); |
212 | } |
206 | } |
213 | 207 | ||
214 | /** Handle LDQF_mem_address_not_aligned. (0x38) */ |
208 | /** Handle LDQF_mem_address_not_aligned. (0x38) */ |
215 | void LDQF_mem_address_not_aligned(int n, istate_t *istate) |
209 | void LDQF_mem_address_not_aligned(int n, istate_t *istate) |
216 | { |
210 | { |
217 | fault_if_from_uspace(istate, "%s.", __func__); |
211 | fault_if_from_uspace(istate, "%s.", __func__); |
218 | dump_istate(istate); |
212 | dump_istate(istate); |
219 | panic("%s.", __func__); |
213 | panic("%s.", __func__); |
220 | } |
214 | } |
221 | 215 | ||
222 | /** Handle STQF_mem_address_not_aligned. (0x39) */ |
216 | /** Handle STQF_mem_address_not_aligned. (0x39) */ |
223 | void STQF_mem_address_not_aligned(int n, istate_t *istate) |
217 | void STQF_mem_address_not_aligned(int n, istate_t *istate) |
224 | { |
218 | { |
225 | fault_if_from_uspace(istate, "%s.", __func__); |
219 | fault_if_from_uspace(istate, "%s.", __func__); |
226 | dump_istate(istate); |
220 | dump_istate(istate); |
227 | panic("%s.", __func__); |
221 | panic("%s.", __func__); |
228 | } |
222 | } |
229 | 223 | ||
230 | /** @} |
224 | /** @} |
231 | */ |
225 | */ |
232 | 226 |