Rev 3790 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
667 | jermar | 1 | /* |
2071 | jermar | 2 | * Copyright (c) 2005 Jakub Jermar |
667 | jermar | 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 |
||
7 | * are met: |
||
8 | * |
||
9 | * - Redistributions of source code must retain the above copyright |
||
10 | * notice, this list of conditions and the following disclaimer. |
||
11 | * - Redistributions in binary form must reproduce the above copyright |
||
12 | * notice, this list of conditions and the following disclaimer in the |
||
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 |
||
15 | * derived from this software without specific prior written permission. |
||
16 | * |
||
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 |
||
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
||
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
||
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
||
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 |
||
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 |
||
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
27 | */ |
||
28 | |||
1703 | jermar | 29 | /** @addtogroup sparc64interrupt |
1702 | cejka | 30 | * @{ |
31 | */ |
||
32 | /** @file |
||
1703 | jermar | 33 | * |
1702 | cejka | 34 | */ |
35 | |||
667 | jermar | 36 | #include <arch/trap/exception.h> |
1946 | jermar | 37 | #include <arch/mm/tlb.h> |
1861 | jermar | 38 | #include <arch/interrupt.h> |
1870 | jermar | 39 | #include <interrupt.h> |
883 | jermar | 40 | #include <arch/asm.h> |
1882 | jermar | 41 | #include <arch/register.h> |
667 | jermar | 42 | #include <debug.h> |
1880 | jermar | 43 | #include <print.h> |
667 | jermar | 44 | |
4132 | svoboda | 45 | #ifdef CONFIG_SYMTAB |
46 | #include <symtab.h> |
||
47 | #endif |
||
48 | |||
1880 | jermar | 49 | void dump_istate(istate_t *istate) |
50 | { |
||
4132 | svoboda | 51 | char *tpcs, *tnpcs; |
52 | |||
53 | #ifdef CONFIG_SYMTAB |
||
54 | tpcs = get_symtab_entry(istate->tpc); |
||
55 | tnpcs = get_symtab_entry(istate->tnpc); |
||
56 | #else |
||
57 | tpcs = tnpcs = "n/a"; |
||
58 | #endif |
||
3071 | decky | 59 | printf("TSTATE=%#" PRIx64 "\n", istate->tstate); |
4132 | svoboda | 60 | printf("TPC=%#" PRIx64 " (%s)\n", istate->tpc, tpcs); |
61 | printf("TNPC=%#" PRIx64 " (%s)\n", istate->tnpc, tnpcs); |
||
1880 | jermar | 62 | } |
63 | |||
1870 | jermar | 64 | /** Handle instruction_access_exception. (0x8) */ |
65 | void instruction_access_exception(int n, istate_t *istate) |
||
667 | jermar | 66 | { |
3790 | svoboda | 67 | fault_if_from_uspace(istate, "%s.", __func__); |
1880 | jermar | 68 | dump_istate(istate); |
3790 | svoboda | 69 | panic("%s.", __func__); |
667 | jermar | 70 | } |
71 | |||
1870 | jermar | 72 | /** Handle instruction_access_error. (0xa) */ |
73 | void instruction_access_error(int n, istate_t *istate) |
||
667 | jermar | 74 | { |
3790 | svoboda | 75 | fault_if_from_uspace(istate, "%s.", __func__); |
1880 | jermar | 76 | dump_istate(istate); |
3790 | svoboda | 77 | panic("%s.", __func__); |
667 | jermar | 78 | } |
883 | jermar | 79 | |
1870 | jermar | 80 | /** Handle illegal_instruction. (0x10) */ |
81 | void illegal_instruction(int n, istate_t *istate) |
||
897 | jermar | 82 | { |
3790 | svoboda | 83 | fault_if_from_uspace(istate, "%s.", __func__); |
1880 | jermar | 84 | dump_istate(istate); |
3790 | svoboda | 85 | panic("%s.", __func__); |
897 | jermar | 86 | } |
87 | |||
1870 | jermar | 88 | /** Handle privileged_opcode. (0x11) */ |
89 | void privileged_opcode(int n, istate_t *istate) |
||
883 | jermar | 90 | { |
3790 | svoboda | 91 | fault_if_from_uspace(istate, "%s.", __func__); |
1880 | jermar | 92 | dump_istate(istate); |
3790 | svoboda | 93 | panic("%s.", __func__); |
883 | jermar | 94 | } |
1702 | cejka | 95 | |
1883 | jermar | 96 | /** Handle unimplemented_LDD. (0x12) */ |
97 | void unimplemented_LDD(int n, istate_t *istate) |
||
98 | { |
||
3790 | svoboda | 99 | fault_if_from_uspace(istate, "%s.", __func__); |
1883 | jermar | 100 | dump_istate(istate); |
3790 | svoboda | 101 | panic("%s.", __func__); |
1883 | jermar | 102 | } |
103 | |||
104 | /** Handle unimplemented_STD. (0x13) */ |
||
105 | void unimplemented_STD(int n, istate_t *istate) |
||
106 | { |
||
3790 | svoboda | 107 | fault_if_from_uspace(istate, "%s.", __func__); |
1883 | jermar | 108 | dump_istate(istate); |
3790 | svoboda | 109 | panic("%s.", __func__); |
1883 | jermar | 110 | } |
111 | |||
1882 | jermar | 112 | /** Handle fp_disabled. (0x20) */ |
113 | void fp_disabled(int n, istate_t *istate) |
||
114 | { |
||
115 | fprs_reg_t fprs; |
||
116 | |||
117 | fprs.value = fprs_read(); |
||
118 | if (!fprs.fef) { |
||
119 | fprs.fef = true; |
||
120 | fprs_write(fprs.value); |
||
121 | return; |
||
122 | } |
||
123 | |||
124 | #ifdef CONFIG_FPU_LAZY |
||
125 | scheduler_fpu_lazy_request(); |
||
126 | #else |
||
3790 | svoboda | 127 | fault_if_from_uspace(istate, "%s.", __func__); |
1882 | jermar | 128 | dump_istate(istate); |
3790 | svoboda | 129 | panic("%s.", __func__); |
1882 | jermar | 130 | #endif |
131 | } |
||
132 | |||
1883 | jermar | 133 | /** Handle fp_exception_ieee_754. (0x21) */ |
134 | void fp_exception_ieee_754(int n, istate_t *istate) |
||
135 | { |
||
3790 | svoboda | 136 | fault_if_from_uspace(istate, "%s.", __func__); |
1883 | jermar | 137 | dump_istate(istate); |
3790 | svoboda | 138 | panic("%s.", __func__); |
1883 | jermar | 139 | } |
140 | |||
141 | /** Handle fp_exception_other. (0x22) */ |
||
142 | void fp_exception_other(int n, istate_t *istate) |
||
143 | { |
||
3790 | svoboda | 144 | fault_if_from_uspace(istate, "%s.", __func__); |
1883 | jermar | 145 | dump_istate(istate); |
3790 | svoboda | 146 | panic("%s.", __func__); |
1883 | jermar | 147 | } |
148 | |||
149 | /** Handle tag_overflow. (0x23) */ |
||
150 | void tag_overflow(int n, istate_t *istate) |
||
151 | { |
||
3790 | svoboda | 152 | fault_if_from_uspace(istate, "%s.", __func__); |
1883 | jermar | 153 | dump_istate(istate); |
3790 | svoboda | 154 | panic("%s.", __func__); |
1883 | jermar | 155 | } |
156 | |||
1870 | jermar | 157 | /** Handle division_by_zero. (0x28) */ |
158 | void division_by_zero(int n, istate_t *istate) |
||
159 | { |
||
3790 | svoboda | 160 | fault_if_from_uspace(istate, "%s.", __func__); |
1880 | jermar | 161 | dump_istate(istate); |
3790 | svoboda | 162 | panic("%s.", __func__); |
1870 | jermar | 163 | } |
164 | |||
165 | /** Handle data_access_exception. (0x30) */ |
||
166 | void data_access_exception(int n, istate_t *istate) |
||
167 | { |
||
3790 | svoboda | 168 | fault_if_from_uspace(istate, "%s.", __func__); |
1880 | jermar | 169 | dump_istate(istate); |
1946 | jermar | 170 | dump_sfsr_and_sfar(); |
3790 | svoboda | 171 | panic("%s.", __func__); |
1870 | jermar | 172 | } |
173 | |||
174 | /** Handle data_access_error. (0x32) */ |
||
175 | void data_access_error(int n, istate_t *istate) |
||
176 | { |
||
3790 | svoboda | 177 | fault_if_from_uspace(istate, "%s.", __func__); |
1880 | jermar | 178 | dump_istate(istate); |
3790 | svoboda | 179 | panic("%s.", __func__); |
1870 | jermar | 180 | } |
181 | |||
182 | /** Handle mem_address_not_aligned. (0x34) */ |
||
183 | void mem_address_not_aligned(int n, istate_t *istate) |
||
184 | { |
||
3790 | svoboda | 185 | fault_if_from_uspace(istate, "%s.", __func__); |
1880 | jermar | 186 | dump_istate(istate); |
3790 | svoboda | 187 | panic("%s.", __func__); |
1870 | jermar | 188 | } |
189 | |||
1883 | jermar | 190 | /** Handle LDDF_mem_address_not_aligned. (0x35) */ |
191 | void LDDF_mem_address_not_aligned(int n, istate_t *istate) |
||
192 | { |
||
3790 | svoboda | 193 | fault_if_from_uspace(istate, "%s.", __func__); |
1883 | jermar | 194 | dump_istate(istate); |
3790 | svoboda | 195 | panic("%s.", __func__); |
1883 | jermar | 196 | } |
197 | |||
198 | /** Handle STDF_mem_address_not_aligned. (0x36) */ |
||
199 | void STDF_mem_address_not_aligned(int n, istate_t *istate) |
||
200 | { |
||
3790 | svoboda | 201 | fault_if_from_uspace(istate, "%s.", __func__); |
1883 | jermar | 202 | dump_istate(istate); |
3790 | svoboda | 203 | panic("%s.", __func__); |
1883 | jermar | 204 | } |
205 | |||
1870 | jermar | 206 | /** Handle privileged_action. (0x37) */ |
207 | void privileged_action(int n, istate_t *istate) |
||
208 | { |
||
3790 | svoboda | 209 | fault_if_from_uspace(istate, "%s.", __func__); |
1880 | jermar | 210 | dump_istate(istate); |
3790 | svoboda | 211 | panic("%s.", __func__); |
1870 | jermar | 212 | } |
213 | |||
1883 | jermar | 214 | /** Handle LDQF_mem_address_not_aligned. (0x38) */ |
215 | void LDQF_mem_address_not_aligned(int n, istate_t *istate) |
||
216 | { |
||
3790 | svoboda | 217 | fault_if_from_uspace(istate, "%s.", __func__); |
1883 | jermar | 218 | dump_istate(istate); |
3790 | svoboda | 219 | panic("%s.", __func__); |
1883 | jermar | 220 | } |
221 | |||
222 | /** Handle STQF_mem_address_not_aligned. (0x39) */ |
||
223 | void STQF_mem_address_not_aligned(int n, istate_t *istate) |
||
224 | { |
||
3790 | svoboda | 225 | fault_if_from_uspace(istate, "%s.", __func__); |
1883 | jermar | 226 | dump_istate(istate); |
3790 | svoboda | 227 | panic("%s.", __func__); |
1883 | jermar | 228 | } |
229 | |||
1703 | jermar | 230 | /** @} |
1702 | cejka | 231 | */ |