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