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

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since a73ebf0 was 1f12fab, checked in by Jakub Klama <jakub.klama@…>, 12 years ago

First attempt to implement preemptive trap handlers
and switch to userspace. Preemptive traps are needed
for at least page faults, as page fault handling code
can trigger window underflow/overflow exceptions.

This commit also introduces userspace window buffer
for saving userspace register windows (just as in
sparc64).

These changes are unfinished and far from working
correctly.

  • Property mode set to 100644
File size: 4.2 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 <interrupt.h>
42#include <arch/asm.h>
43#include <debug.h>
44#include <print.h>
45#include <symtab.h>
46
47/** Handle instruction_access_exception. (0x1) */
48void instruction_access_exception(int n, istate_t *istate)
49{
50 page_fault(n, istate);
51// fault_if_from_uspace(istate, "%s.", __func__);
52// panic_badtrap(istate, n, "%s.", __func__);
53}
54
55/** Handle instruction_access_error. (0x21) */
56void instruction_access_error(int n, istate_t *istate)
57{
58 fault_if_from_uspace(istate, "%s.", __func__);
59 panic_badtrap(istate, n, "%s.", __func__);
60}
61
62/** Handle illegal_instruction. (0x2) */
63void illegal_instruction(int n, istate_t *istate)
64{
65 fault_if_from_uspace(istate, "%s.", __func__);
66 panic_badtrap(istate, n, "%s.", __func__);
67}
68
69/** Handle privileged_instruction. (0x3) */
70void privileged_instruction(int n, istate_t *istate)
71{
72 fault_if_from_uspace(istate, "%s.", __func__);
73 panic_badtrap(istate, n, "%s.", __func__);
74}
75
76/** Handle fp_disabled. (0x3) */
77void fp_disabled(int n, istate_t *istate)
78{
79 fault_if_from_uspace(istate, "%s.", __func__);
80 panic_badtrap(istate, n, "%s.", __func__);
81}
82
83/** Handle fp_exception. (0x08) */
84void fp_exception(int n, istate_t *istate)
85{
86 fault_if_from_uspace(istate, "%s.", __func__);
87 panic_badtrap(istate, n, "%s.", __func__);
88}
89
90/** Handle tag_overflow. (0x0a) */
91void tag_overflow(int n, istate_t *istate)
92{
93 fault_if_from_uspace(istate, "%s.", __func__);
94 panic_badtrap(istate, n, "%s.", __func__);
95}
96
97/** Handle division_by_zero. (0x2a) */
98void division_by_zero(int n, istate_t *istate)
99{
100 fault_if_from_uspace(istate, "%s.", __func__);
101 panic_badtrap(istate, n, "%s.", __func__);
102}
103
104/** Handle data_access_exception. (0x9) */
105void data_access_exception(int n, istate_t *istate)
106{
107 page_fault(n, istate);
108// fault_if_from_uspace(istate, "%s.", __func__);
109// panic_badtrap(istate, n, "%s.", __func__);
110}
111
112/** Handle data_access_error. (0x29) */
113void data_access_error(int n, istate_t *istate)
114{
115 page_fault(n, istate);
116// fault_if_from_uspace(istate, "%s.", __func__);
117// panic_badtrap(istate, n, "%s.", __func__);
118}
119
120/** Handle data_store_error. (0x29) */
121void data_store_error(int n, istate_t *istate)
122{
123 page_fault(n, istate);
124// fault_if_from_uspace(istate, "%s.", __func__);
125// panic_badtrap(istate, n, "%s.", __func__);
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
141/** @}
142 */
Note: See TracBrowser for help on using the repository browser.