source: mainline/kernel/arch/sparc64/src/trap/exception.c@ 91001e2

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 91001e2 was a000878c, checked in by Martin Decky <martin@…>, 16 years ago

make sure that all statically allocated strings are declared as "const char *"
and are treated as read-only

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