Rev 3743 | Rev 3862 | 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> |
3743 | rimsky | 37 | #include <arch/mm/sun4u/tlb.h> |
3770 | rimsky | 38 | #include <arch/mm/sun4u/tlb.h> |
1861 | jermar | 39 | #include <arch/interrupt.h> |
1870 | jermar | 40 | #include <interrupt.h> |
883 | jermar | 41 | #include <arch/asm.h> |
1882 | jermar | 42 | #include <arch/register.h> |
667 | jermar | 43 | #include <debug.h> |
1880 | jermar | 44 | #include <symtab.h> |
45 | #include <print.h> |
||
667 | jermar | 46 | |
1880 | jermar | 47 | void dump_istate(istate_t *istate) |
48 | { |
||
3071 | decky | 49 | printf("TSTATE=%#" PRIx64 "\n", istate->tstate); |
50 | printf("TPC=%#" PRIx64 " (%s)\n", istate->tpc, get_symtab_entry(istate->tpc)); |
||
51 | printf("TNPC=%#" PRIx64 " (%s)\n", istate->tnpc, get_symtab_entry(istate->tnpc)); |
||
1880 | jermar | 52 | } |
53 | |||
1870 | jermar | 54 | /** Handle instruction_access_exception. (0x8) */ |
55 | void instruction_access_exception(int n, istate_t *istate) |
||
667 | jermar | 56 | { |
2462 | jermar | 57 | fault_if_from_uspace(istate, "%s\n", __func__); |
1880 | jermar | 58 | dump_istate(istate); |
2462 | jermar | 59 | panic("%s\n", __func__); |
667 | jermar | 60 | } |
61 | |||
1870 | jermar | 62 | /** Handle instruction_access_error. (0xa) */ |
63 | void instruction_access_error(int n, istate_t *istate) |
||
667 | jermar | 64 | { |
2462 | jermar | 65 | fault_if_from_uspace(istate, "%s\n", __func__); |
1880 | jermar | 66 | dump_istate(istate); |
2462 | jermar | 67 | panic("%s\n", __func__); |
667 | jermar | 68 | } |
883 | jermar | 69 | |
1870 | jermar | 70 | /** Handle illegal_instruction. (0x10) */ |
71 | void illegal_instruction(int n, istate_t *istate) |
||
897 | jermar | 72 | { |
2462 | jermar | 73 | fault_if_from_uspace(istate, "%s\n", __func__); |
1880 | jermar | 74 | dump_istate(istate); |
2462 | jermar | 75 | panic("%s\n", __func__); |
897 | jermar | 76 | } |
77 | |||
1870 | jermar | 78 | /** Handle privileged_opcode. (0x11) */ |
79 | void privileged_opcode(int n, istate_t *istate) |
||
883 | jermar | 80 | { |
2462 | jermar | 81 | fault_if_from_uspace(istate, "%s\n", __func__); |
1880 | jermar | 82 | dump_istate(istate); |
2462 | jermar | 83 | panic("%s\n", __func__); |
883 | jermar | 84 | } |
1702 | cejka | 85 | |
1883 | jermar | 86 | /** Handle unimplemented_LDD. (0x12) */ |
87 | void unimplemented_LDD(int n, istate_t *istate) |
||
88 | { |
||
2462 | jermar | 89 | fault_if_from_uspace(istate, "%s\n", __func__); |
1883 | jermar | 90 | dump_istate(istate); |
2462 | jermar | 91 | panic("%s\n", __func__); |
1883 | jermar | 92 | } |
93 | |||
94 | /** Handle unimplemented_STD. (0x13) */ |
||
95 | void unimplemented_STD(int n, istate_t *istate) |
||
96 | { |
||
2462 | jermar | 97 | fault_if_from_uspace(istate, "%s\n", __func__); |
1883 | jermar | 98 | dump_istate(istate); |
2462 | jermar | 99 | panic("%s\n", __func__); |
1883 | jermar | 100 | } |
101 | |||
1882 | jermar | 102 | /** Handle fp_disabled. (0x20) */ |
103 | void fp_disabled(int n, istate_t *istate) |
||
104 | { |
||
105 | fprs_reg_t fprs; |
||
106 | |||
107 | fprs.value = fprs_read(); |
||
108 | if (!fprs.fef) { |
||
109 | fprs.fef = true; |
||
110 | fprs_write(fprs.value); |
||
111 | return; |
||
112 | } |
||
113 | |||
114 | #ifdef CONFIG_FPU_LAZY |
||
115 | scheduler_fpu_lazy_request(); |
||
116 | #else |
||
2462 | jermar | 117 | fault_if_from_uspace(istate, "%s\n", __func__); |
1882 | jermar | 118 | dump_istate(istate); |
2462 | jermar | 119 | panic("%s\n", __func__); |
1882 | jermar | 120 | #endif |
121 | } |
||
122 | |||
1883 | jermar | 123 | /** Handle fp_exception_ieee_754. (0x21) */ |
124 | void fp_exception_ieee_754(int n, istate_t *istate) |
||
125 | { |
||
2462 | jermar | 126 | fault_if_from_uspace(istate, "%s\n", __func__); |
1883 | jermar | 127 | dump_istate(istate); |
2462 | jermar | 128 | panic("%s\n", __func__); |
1883 | jermar | 129 | } |
130 | |||
131 | /** Handle fp_exception_other. (0x22) */ |
||
132 | void fp_exception_other(int n, istate_t *istate) |
||
133 | { |
||
2462 | jermar | 134 | fault_if_from_uspace(istate, "%s\n", __func__); |
1883 | jermar | 135 | dump_istate(istate); |
2462 | jermar | 136 | panic("%s\n", __func__); |
1883 | jermar | 137 | } |
138 | |||
139 | /** Handle tag_overflow. (0x23) */ |
||
140 | void tag_overflow(int n, istate_t *istate) |
||
141 | { |
||
2462 | jermar | 142 | fault_if_from_uspace(istate, "%s\n", __func__); |
1883 | jermar | 143 | dump_istate(istate); |
2462 | jermar | 144 | panic("%s\n", __func__); |
1883 | jermar | 145 | } |
146 | |||
1870 | jermar | 147 | /** Handle division_by_zero. (0x28) */ |
148 | void division_by_zero(int n, istate_t *istate) |
||
149 | { |
||
2462 | jermar | 150 | fault_if_from_uspace(istate, "%s\n", __func__); |
1880 | jermar | 151 | dump_istate(istate); |
2462 | jermar | 152 | panic("%s\n", __func__); |
1870 | jermar | 153 | } |
154 | |||
155 | /** Handle data_access_exception. (0x30) */ |
||
156 | void data_access_exception(int n, istate_t *istate) |
||
157 | { |
||
2462 | jermar | 158 | fault_if_from_uspace(istate, "%s\n", __func__); |
1880 | jermar | 159 | dump_istate(istate); |
3770 | rimsky | 160 | describe_mmu_fault(); |
2462 | jermar | 161 | panic("%s\n", __func__); |
1870 | jermar | 162 | } |
163 | |||
164 | /** Handle data_access_error. (0x32) */ |
||
165 | void data_access_error(int n, istate_t *istate) |
||
166 | { |
||
2462 | jermar | 167 | fault_if_from_uspace(istate, "%s\n", __func__); |
1880 | jermar | 168 | dump_istate(istate); |
2462 | jermar | 169 | panic("%s\n", __func__); |
1870 | jermar | 170 | } |
171 | |||
172 | /** Handle mem_address_not_aligned. (0x34) */ |
||
173 | void mem_address_not_aligned(int n, istate_t *istate) |
||
174 | { |
||
2462 | jermar | 175 | fault_if_from_uspace(istate, "%s\n", __func__); |
1880 | jermar | 176 | dump_istate(istate); |
2462 | jermar | 177 | panic("%s\n", __func__); |
1870 | jermar | 178 | } |
179 | |||
1883 | jermar | 180 | /** Handle LDDF_mem_address_not_aligned. (0x35) */ |
181 | void LDDF_mem_address_not_aligned(int n, istate_t *istate) |
||
182 | { |
||
2462 | jermar | 183 | fault_if_from_uspace(istate, "%s\n", __func__); |
1883 | jermar | 184 | dump_istate(istate); |
2462 | jermar | 185 | panic("%s\n", __func__); |
1883 | jermar | 186 | } |
187 | |||
188 | /** Handle STDF_mem_address_not_aligned. (0x36) */ |
||
189 | void STDF_mem_address_not_aligned(int n, istate_t *istate) |
||
190 | { |
||
2462 | jermar | 191 | fault_if_from_uspace(istate, "%s\n", __func__); |
1883 | jermar | 192 | dump_istate(istate); |
2462 | jermar | 193 | panic("%s\n", __func__); |
1883 | jermar | 194 | } |
195 | |||
1870 | jermar | 196 | /** Handle privileged_action. (0x37) */ |
197 | void privileged_action(int n, istate_t *istate) |
||
198 | { |
||
2462 | jermar | 199 | fault_if_from_uspace(istate, "%s\n", __func__); |
1880 | jermar | 200 | dump_istate(istate); |
2462 | jermar | 201 | panic("%s\n", __func__); |
1870 | jermar | 202 | } |
203 | |||
1883 | jermar | 204 | /** Handle LDQF_mem_address_not_aligned. (0x38) */ |
205 | void LDQF_mem_address_not_aligned(int n, istate_t *istate) |
||
206 | { |
||
2462 | jermar | 207 | fault_if_from_uspace(istate, "%s\n", __func__); |
1883 | jermar | 208 | dump_istate(istate); |
2462 | jermar | 209 | panic("%s\n", __func__); |
1883 | jermar | 210 | } |
211 | |||
212 | /** Handle STQF_mem_address_not_aligned. (0x39) */ |
||
213 | void STQF_mem_address_not_aligned(int n, istate_t *istate) |
||
214 | { |
||
2462 | jermar | 215 | fault_if_from_uspace(istate, "%s\n", __func__); |
1883 | jermar | 216 | dump_istate(istate); |
2462 | jermar | 217 | panic("%s\n", __func__); |
1883 | jermar | 218 | } |
219 | |||
1703 | jermar | 220 | /** @} |
1702 | cejka | 221 | */ |