source: mainline/kernel/arch/sparc64/src/trap/exception.c@ 86018c1

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 86018c1 was ba50a34, checked in by Pavel Rimsky <pavel@…>, 16 years ago

Merged fast instr. access MMU miss handler, now the first few instructions of the userspace tasks can be reached.

  • Property mode set to 100644
File size: 5.9 KB
Line 
1/*
2 * Copyright (c) 2005 Jakub 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
29/** @addtogroup sparc64interrupt
30 * @{
31 */
32/** @file
33 *
34 */
35
36#include <arch/trap/exception.h>
37#include <arch/mm/tlb.h>
38#include <arch/interrupt.h>
39#include <interrupt.h>
40#include <arch/asm.h>
41#include <arch/register.h>
42#include <debug.h>
43#include <print.h>
44#include <symtab.h>
45
46void dump_istate(istate_t *istate)
47{
48 char *tpcs, *tnpcs;
49
50 tpcs = symtab_fmt_name_lookup(istate->tpc);
51 tnpcs = symtab_fmt_name_lookup(istate->tnpc);
52
53 printf("TSTATE=%#" PRIx64 "\n", istate->tstate);
54 printf("TPC=%#" PRIx64 " (%s)\n", istate->tpc, tpcs);
55 printf("TNPC=%#" PRIx64 " (%s)\n", istate->tnpc, tnpcs);
56}
57
58/** Handle instruction_access_exception. (0x8) */
59void instruction_access_exception(int n, istate_t *istate)
60{
61 fault_if_from_uspace(istate, "%s.", __func__);
62 dump_istate(istate);
63 panic("%s.", __func__);
64}
65
66/** Handle instruction_access_error. (0xa) */
67void instruction_access_error(int n, istate_t *istate)
68{
69 fault_if_from_uspace(istate, "%s.", __func__);
70 dump_istate(istate);
71 panic("%s.", __func__);
72}
73
74/** Handle illegal_instruction. (0x10) */
75void illegal_instruction(int n, istate_t *istate)
76{
77 fault_if_from_uspace(istate, "%s.", __func__);
78 dump_istate(istate);
79 panic("%s.", __func__);
80}
81
82/** Handle privileged_opcode. (0x11) */
83void privileged_opcode(int n, istate_t *istate)
84{
85 fault_if_from_uspace(istate, "%s.", __func__);
86 dump_istate(istate);
87 panic("%s.", __func__);
88}
89
90/** Handle unimplemented_LDD. (0x12) */
91void unimplemented_LDD(int n, istate_t *istate)
92{
93 fault_if_from_uspace(istate, "%s.", __func__);
94 dump_istate(istate);
95 panic("%s.", __func__);
96}
97
98/** Handle unimplemented_STD. (0x13) */
99void unimplemented_STD(int n, istate_t *istate)
100{
101 fault_if_from_uspace(istate, "%s.", __func__);
102 dump_istate(istate);
103 panic("%s.", __func__);
104}
105
106/** Handle fp_disabled. (0x20) */
107void fp_disabled(int n, istate_t *istate)
108{
109 fprs_reg_t fprs;
110
111 fprs.value = fprs_read();
112 if (!fprs.fef) {
113 fprs.fef = true;
114 fprs_write(fprs.value);
115 return;
116 }
117
118#ifdef CONFIG_FPU_LAZY
119 scheduler_fpu_lazy_request();
120#else
121 fault_if_from_uspace(istate, "%s.", __func__);
122 dump_istate(istate);
123 panic("%s.", __func__);
124#endif
125}
126
127/** Handle fp_exception_ieee_754. (0x21) */
128void fp_exception_ieee_754(int n, istate_t *istate)
129{
130 fault_if_from_uspace(istate, "%s.", __func__);
131 dump_istate(istate);
132 panic("%s.", __func__);
133}
134
135/** Handle fp_exception_other. (0x22) */
136void fp_exception_other(int n, istate_t *istate)
137{
138 fault_if_from_uspace(istate, "%s.", __func__);
139 dump_istate(istate);
140 panic("%s.", __func__);
141}
142
143/** Handle tag_overflow. (0x23) */
144void tag_overflow(int n, istate_t *istate)
145{
146 fault_if_from_uspace(istate, "%s.", __func__);
147 dump_istate(istate);
148 panic("%s.", __func__);
149}
150
151/** Handle division_by_zero. (0x28) */
152void division_by_zero(int n, istate_t *istate)
153{
154 fault_if_from_uspace(istate, "%s.", __func__);
155 dump_istate(istate);
156 panic("%s.", __func__);
157}
158
159/** Handle data_access_exception. (0x30) */
160void data_access_exception(int n, istate_t *istate)
161{
162 fault_if_from_uspace(istate, "%s.", __func__);
163 dump_istate(istate);
164//MH
165// dump_sfsr_and_sfar();
166 panic("%s.", __func__);
167}
168
169/** Handle data_access_error. (0x32) */
170void data_access_error(int n, istate_t *istate)
171{
172 fault_if_from_uspace(istate, "%s.", __func__);
173 dump_istate(istate);
174 panic("%s.", __func__);
175}
176
177/** Handle mem_address_not_aligned. (0x34) */
178void mem_address_not_aligned(int n, istate_t *istate)
179{
180 fault_if_from_uspace(istate, "%s.", __func__);
181 dump_istate(istate);
182 panic("%s.", __func__);
183}
184
185/** Handle LDDF_mem_address_not_aligned. (0x35) */
186void LDDF_mem_address_not_aligned(int n, istate_t *istate)
187{
188 fault_if_from_uspace(istate, "%s.", __func__);
189 dump_istate(istate);
190 panic("%s.", __func__);
191}
192
193/** Handle STDF_mem_address_not_aligned. (0x36) */
194void STDF_mem_address_not_aligned(int n, istate_t *istate)
195{
196 fault_if_from_uspace(istate, "%s.", __func__);
197 dump_istate(istate);
198 panic("%s.", __func__);
199}
200
201/** Handle privileged_action. (0x37) */
202void privileged_action(int n, istate_t *istate)
203{
204 fault_if_from_uspace(istate, "%s.", __func__);
205 dump_istate(istate);
206 panic("%s.", __func__);
207}
208
209/** Handle LDQF_mem_address_not_aligned. (0x38) */
210void LDQF_mem_address_not_aligned(int n, istate_t *istate)
211{
212 fault_if_from_uspace(istate, "%s.", __func__);
213 dump_istate(istate);
214 panic("%s.", __func__);
215}
216
217/** Handle STQF_mem_address_not_aligned. (0x39) */
218void STQF_mem_address_not_aligned(int n, istate_t *istate)
219{
220 fault_if_from_uspace(istate, "%s.", __func__);
221 dump_istate(istate);
222 panic("%s.", __func__);
223}
224
225/** @}
226 */
Note: See TracBrowser for help on using the repository browser.