source: mainline/kernel/arch/sparc64/src/trap/exception.c@ 22a28a69

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 22a28a69 was 22a28a69, checked in by Jakub Jermar <jakub@…>, 15 years ago

Rename decode_istate() to istate_decode() and declare it only once in
the generic interrupt.h.

  • Property mode set to 100644
File size: 5.8 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
[22a28a69]46void istate_decode(istate_t *istate)
[7bb6b06]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__);
[7008097]60 panic_badtrap(istate, n, "%s.", __func__);
[feb5915]61}
62
[e2bf639]63/** Handle instruction_access_error. (0xa) */
64void instruction_access_error(int n, istate_t *istate)
[feb5915]65{
[f651e80]66 fault_if_from_uspace(istate, "%s.", __func__);
[7008097]67 panic_badtrap(istate, n, "%s.", __func__);
[feb5915]68}
[7cb53f62]69
[e2bf639]70/** Handle illegal_instruction. (0x10) */
71void illegal_instruction(int n, istate_t *istate)
[97f1691]72{
[f651e80]73 fault_if_from_uspace(istate, "%s.", __func__);
[7008097]74 panic_badtrap(istate, n, "%s.", __func__);
[97f1691]75}
76
[e2bf639]77/** Handle privileged_opcode. (0x11) */
78void privileged_opcode(int n, istate_t *istate)
[7cb53f62]79{
[f651e80]80 fault_if_from_uspace(istate, "%s.", __func__);
[7008097]81 panic_badtrap(istate, n, "%s.", __func__);
[e2bf639]82}
83
[34d9469e]84/** Handle unimplemented_LDD. (0x12) */
85void unimplemented_LDD(int n, istate_t *istate)
86{
[f651e80]87 fault_if_from_uspace(istate, "%s.", __func__);
[7008097]88 panic_badtrap(istate, n, "%s.", __func__);
[34d9469e]89}
90
91/** Handle unimplemented_STD. (0x13) */
92void unimplemented_STD(int n, istate_t *istate)
93{
[f651e80]94 fault_if_from_uspace(istate, "%s.", __func__);
[7008097]95 panic_badtrap(istate, n, "%s.", __func__);
[34d9469e]96}
97
[6eabb6e6]98/** Handle fp_disabled. (0x20) */
99void fp_disabled(int n, istate_t *istate)
100{
101 fprs_reg_t fprs;
102
103 fprs.value = fprs_read();
104 if (!fprs.fef) {
105 fprs.fef = true;
106 fprs_write(fprs.value);
107 return;
108 }
109
110#ifdef CONFIG_FPU_LAZY
111 scheduler_fpu_lazy_request();
112#else
[f651e80]113 fault_if_from_uspace(istate, "%s.", __func__);
[7008097]114 panic_badtrap(istate, n, "%s.", __func__);
[6eabb6e6]115#endif
116}
117
[34d9469e]118/** Handle fp_exception_ieee_754. (0x21) */
119void fp_exception_ieee_754(int n, istate_t *istate)
120{
[f651e80]121 fault_if_from_uspace(istate, "%s.", __func__);
[7008097]122 panic_badtrap(istate, n, "%s.", __func__);
[34d9469e]123}
124
125/** Handle fp_exception_other. (0x22) */
126void fp_exception_other(int n, istate_t *istate)
127{
[f651e80]128 fault_if_from_uspace(istate, "%s.", __func__);
[7008097]129 panic_badtrap(istate, n, "%s.", __func__);
[34d9469e]130}
131
132/** Handle tag_overflow. (0x23) */
133void tag_overflow(int n, istate_t *istate)
134{
[f651e80]135 fault_if_from_uspace(istate, "%s.", __func__);
[7008097]136 panic_badtrap(istate, n, "%s.", __func__);
[34d9469e]137}
138
[e2bf639]139/** Handle division_by_zero. (0x28) */
140void division_by_zero(int n, istate_t *istate)
141{
[f651e80]142 fault_if_from_uspace(istate, "%s.", __func__);
[7008097]143 panic_badtrap(istate, n, "%s.", __func__);
[e2bf639]144}
145
146/** Handle data_access_exception. (0x30) */
147void data_access_exception(int n, istate_t *istate)
148{
[f651e80]149 fault_if_from_uspace(istate, "%s.", __func__);
[7008097]150 panic_badtrap(istate, n, "%s.", __func__);
[e2bf639]151}
152
153/** Handle data_access_error. (0x32) */
154void data_access_error(int n, istate_t *istate)
155{
[f651e80]156 fault_if_from_uspace(istate, "%s.", __func__);
[7008097]157 panic_badtrap(istate, n, "%s.", __func__);
[e2bf639]158}
159
160/** Handle mem_address_not_aligned. (0x34) */
161void mem_address_not_aligned(int n, istate_t *istate)
162{
[f651e80]163 fault_if_from_uspace(istate, "%s.", __func__);
[7008097]164 panic_badtrap(istate, n, "%s.", __func__);
[e2bf639]165}
166
[34d9469e]167/** Handle LDDF_mem_address_not_aligned. (0x35) */
168void LDDF_mem_address_not_aligned(int n, istate_t *istate)
169{
[f651e80]170 fault_if_from_uspace(istate, "%s.", __func__);
[7008097]171 panic_badtrap(istate, n, "%s.", __func__);
[34d9469e]172}
173
174/** Handle STDF_mem_address_not_aligned. (0x36) */
175void STDF_mem_address_not_aligned(int n, istate_t *istate)
176{
[f651e80]177 fault_if_from_uspace(istate, "%s.", __func__);
[7008097]178 panic_badtrap(istate, n, "%s.", __func__);
[34d9469e]179}
180
[e2bf639]181/** Handle privileged_action. (0x37) */
182void privileged_action(int n, istate_t *istate)
183{
[f651e80]184 fault_if_from_uspace(istate, "%s.", __func__);
[7008097]185 panic_badtrap(istate, n, "%s.", __func__);
[7cb53f62]186}
[b45c443]187
[34d9469e]188/** Handle LDQF_mem_address_not_aligned. (0x38) */
189void LDQF_mem_address_not_aligned(int n, istate_t *istate)
190{
[f651e80]191 fault_if_from_uspace(istate, "%s.", __func__);
[7008097]192 panic_badtrap(istate, n, "%s.", __func__);
[34d9469e]193}
194
195/** Handle STQF_mem_address_not_aligned. (0x39) */
196void STQF_mem_address_not_aligned(int n, istate_t *istate)
197{
[f651e80]198 fault_if_from_uspace(istate, "%s.", __func__);
[7008097]199 panic_badtrap(istate, n, "%s.", __func__);
[34d9469e]200}
201
[3222efd]202/** @}
[b45c443]203 */
Note: See TracBrowser for help on using the repository browser.