source: mainline/kernel/arch/sparc32/src/exception.c@ 3d1956b

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 3d1956b was 13c94f7, checked in by Jakub Klama <jakub.klama@…>, 12 years ago
  • Further work on preemptible trap handlers
  • Implemented page fault handling
  • Initial syscall and userspace support
  • Property mode set to 100644
File size: 4.4 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 <syscall/syscall.h>
42#include <interrupt.h>
43#include <arch/asm.h>
44#include <debug.h>
45#include <print.h>
46#include <symtab.h>
47
48/** Handle instruction_access_exception. (0x1) */
49void instruction_access_exception(int n, istate_t *istate)
50{
51 page_fault(n, istate);
52// fault_if_from_uspace(istate, "%s.", __func__);
53// panic_badtrap(istate, n, "%s.", __func__);
54}
55
56/** Handle instruction_access_error. (0x21) */
57void instruction_access_error(int n, istate_t *istate)
58{
59 fault_if_from_uspace(istate, "%s.", __func__);
60 panic_badtrap(istate, n, "%s.", __func__);
61}
62
63/** Handle illegal_instruction. (0x2) */
64void illegal_instruction(int n, istate_t *istate)
65{
66 fault_if_from_uspace(istate, "%s.", __func__);
67 panic_badtrap(istate, n, "%s.", __func__);
68}
69
70/** Handle privileged_instruction. (0x3) */
71void privileged_instruction(int n, istate_t *istate)
72{
73 fault_if_from_uspace(istate, "%s.", __func__);
74 panic_badtrap(istate, n, "%s.", __func__);
75}
76
77/** Handle fp_disabled. (0x3) */
78void fp_disabled(int n, istate_t *istate)
79{
80 fault_if_from_uspace(istate, "%s.", __func__);
81 panic_badtrap(istate, n, "%s.", __func__);
82}
83
84/** Handle fp_exception. (0x08) */
85void fp_exception(int n, istate_t *istate)
86{
87 fault_if_from_uspace(istate, "%s.", __func__);
88 panic_badtrap(istate, n, "%s.", __func__);
89}
90
91/** Handle tag_overflow. (0x0a) */
92void tag_overflow(int n, istate_t *istate)
93{
94 fault_if_from_uspace(istate, "%s.", __func__);
95 panic_badtrap(istate, n, "%s.", __func__);
96}
97
98/** Handle division_by_zero. (0x2a) */
99void division_by_zero(int n, istate_t *istate)
100{
101 fault_if_from_uspace(istate, "%s.", __func__);
102 panic_badtrap(istate, n, "%s.", __func__);
103}
104
105/** Handle data_access_exception. (0x9) */
106void data_access_exception(int n, istate_t *istate)
107{
108 page_fault(n, istate);
109// fault_if_from_uspace(istate, "%s.", __func__);
110// panic_badtrap(istate, n, "%s.", __func__);
111}
112
113/** Handle data_access_error. (0x29) */
114void data_access_error(int n, istate_t *istate)
115{
116 page_fault(n, istate);
117// fault_if_from_uspace(istate, "%s.", __func__);
118// panic_badtrap(istate, n, "%s.", __func__);
119}
120
121/** Handle data_store_error. (0x29) */
122void data_store_error(int n, istate_t *istate)
123{
124 page_fault(n, istate);
125// fault_if_from_uspace(istate, "%s.", __func__);
126// panic_badtrap(istate, n, "%s.", __func__);
127}
128/** Handle data_access_error. (0x2c) */
129void data_access_mmu_miss(int n, istate_t *istate)
130{
131 fault_if_from_uspace(istate, "%s.", __func__);
132 panic_badtrap(istate, n, "%s.", __func__);
133}
134
135/** Handle mem_address_not_aligned. (0x7) */
136void mem_address_not_aligned(int n, istate_t *istate)
137{
138 fault_if_from_uspace(istate, "%s.", __func__);
139 panic_badtrap(istate, n, "%s.", __func__);
140}
141
142void syscall(sysarg_t a1, sysarg_t a2, sysarg_t a3, sysarg_t a4, sysarg_t a5, sysarg_t a6, sysarg_t id)
143{
144 printf("syscall %d\n", id);
145 syscall_handler(a1, a2, a3, a4, a5, a6, id);
146}
147
148/** @}
149 */
Note: See TracBrowser for help on using the repository browser.