source: mainline/kernel/arch/sparc32/src/exception.c@ 208b5f5

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 208b5f5 was 32e8cd1, checked in by Martin Decky <martin@…>, 12 years ago

code revision
coding style fixes
removal of debugging printouts and other temporary stuff

  • Property mode set to 100644
File size: 4.5 KB
Line 
1/*
2 * Copyright (c) 2005 Jakub Jermar
3 * Copyright (c) 2013 Jakub Klama
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * - Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * - The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30/** @addtogroup sparc64interrupt
31 * @{
32 */
33/** @file
34 *
35 */
36
37#include <arch.h>
38#include <typedefs.h>
39#include <arch/istate.h>
40#include <arch/exception.h>
41#include <arch/regwin.h>
42#include <arch/machine_func.h>
43#include <syscall/syscall.h>
44#include <interrupt.h>
45#include <arch/asm.h>
46#include <mm/frame.h>
47#include <mm/page.h>
48#include <mm/as.h>
49#include <memstr.h>
50#include <debug.h>
51#include <print.h>
52#include <symtab.h>
53
54/** Handle instruction_access_exception. (0x1) */
55void instruction_access_exception(int n, istate_t *istate)
56{
57 page_fault(n, istate);
58}
59
60/** Handle instruction_access_error. (0x21) */
61void instruction_access_error(int n, istate_t *istate)
62{
63 fault_if_from_uspace(istate, "%s.", __func__);
64 panic_badtrap(istate, n, "%s.", __func__);
65}
66
67/** Handle illegal_instruction. (0x2) */
68void illegal_instruction(int n, istate_t *istate)
69{
70 fault_if_from_uspace(istate, "%s.", __func__);
71 panic_badtrap(istate, n, "%s.", __func__);
72}
73
74/** Handle privileged_instruction. (0x3) */
75void privileged_instruction(int n, istate_t *istate)
76{
77 fault_if_from_uspace(istate, "%s.", __func__);
78 panic_badtrap(istate, n, "%s.", __func__);
79}
80
81/** Handle fp_disabled. (0x3) */
82void fp_disabled(int n, istate_t *istate)
83{
84 fault_if_from_uspace(istate, "%s.", __func__);
85 panic_badtrap(istate, n, "%s.", __func__);
86}
87
88/** Handle fp_exception. (0x08) */
89void fp_exception(int n, istate_t *istate)
90{
91 fault_if_from_uspace(istate, "%s.", __func__);
92 panic_badtrap(istate, n, "%s.", __func__);
93}
94
95/** Handle tag_overflow. (0x0a) */
96void tag_overflow(int n, istate_t *istate)
97{
98 fault_if_from_uspace(istate, "%s.", __func__);
99 panic_badtrap(istate, n, "%s.", __func__);
100}
101
102/** Handle division_by_zero. (0x2a) */
103void division_by_zero(int n, istate_t *istate)
104{
105 fault_if_from_uspace(istate, "%s.", __func__);
106 panic_badtrap(istate, n, "%s.", __func__);
107}
108
109/** Handle data_access_exception. (0x9) */
110void data_access_exception(int n, istate_t *istate)
111{
112 page_fault(n, istate);
113}
114
115/** Handle data_access_error. (0x29) */
116void data_access_error(int n, istate_t *istate)
117{
118 page_fault(n, istate);
119}
120
121/** Handle data_store_error. (0x29) */
122void data_store_error(int n, istate_t *istate)
123{
124 page_fault(n, istate);
125}
126
127/** Handle data_access_error. (0x2c) */
128void data_access_mmu_miss(int n, istate_t *istate)
129{
130 fault_if_from_uspace(istate, "%s.", __func__);
131 panic_badtrap(istate, n, "%s.", __func__);
132}
133
134/** Handle mem_address_not_aligned. (0x7) */
135void mem_address_not_aligned(int n, istate_t *istate)
136{
137 fault_if_from_uspace(istate, "%s.", __func__);
138 panic_badtrap(istate, n, "%s.", __func__);
139}
140
141sysarg_t syscall(sysarg_t a1, sysarg_t a2, sysarg_t a3, sysarg_t a4,
142 sysarg_t a5, sysarg_t a6, sysarg_t id)
143{
144 return syscall_handler(a1, a2, a3, a4, a5, a6, id);
145}
146
147void irq_exception(unsigned int nr, istate_t *istate)
148{
149 machine_irq_exception(nr, istate);
150}
151
152void preemptible_save_uspace(uintptr_t sp, istate_t *istate)
153{
154 as_page_fault(sp, PF_ACCESS_WRITE, istate);
155}
156
157void preemptible_restore_uspace(uintptr_t sp, istate_t *istate)
158{
159 as_page_fault(sp, PF_ACCESS_WRITE, istate);
160}
161
162/** @}
163 */
Note: See TracBrowser for help on using the repository browser.