Subversion Repositories HelenOS

Rev

Rev 1946 | Rev 2089 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
667 jermar 1
/*
2071 jermar 2
 * Copyright (c) 2005 Jakub Jermar
667 jermar 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
 
1703 jermar 29
/** @addtogroup sparc64interrupt
1702 cejka 30
 * @{
31
 */
32
/** @file
1703 jermar 33
 *
1702 cejka 34
 */
35
 
667 jermar 36
#include <arch/trap/exception.h>
1946 jermar 37
#include <arch/mm/tlb.h>
1861 jermar 38
#include <arch/interrupt.h>
1870 jermar 39
#include <interrupt.h>
883 jermar 40
#include <arch/asm.h>
1882 jermar 41
#include <arch/register.h>
667 jermar 42
#include <debug.h>
1861 jermar 43
#include <typedefs.h>
1880 jermar 44
#include <symtab.h>
45
#include <print.h>
667 jermar 46
 
1880 jermar 47
void dump_istate(istate_t *istate)
48
{
49
    printf("TSTATE=%#llx\n", istate->tstate);
50
    printf("TPC=%#llx (%s)\n", istate->tpc, get_symtab_entry(istate->tpc));
51
    printf("TNPC=%#llx (%s)\n", istate->tnpc, get_symtab_entry(istate->tnpc));
52
}
53
 
1870 jermar 54
/** Handle instruction_access_exception. (0x8) */
55
void instruction_access_exception(int n, istate_t *istate)
667 jermar 56
{
1870 jermar 57
    fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
1880 jermar 58
    dump_istate(istate);
59
    panic("%s\n", __FUNCTION__);
667 jermar 60
}
61
 
1870 jermar 62
/** Handle instruction_access_error. (0xa) */
63
void instruction_access_error(int n, istate_t *istate)
667 jermar 64
{
1870 jermar 65
    fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
1880 jermar 66
    dump_istate(istate);
67
    panic("%s\n", __FUNCTION__);
667 jermar 68
}
883 jermar 69
 
1870 jermar 70
/** Handle illegal_instruction. (0x10) */
71
void illegal_instruction(int n, istate_t *istate)
897 jermar 72
{
1870 jermar 73
    fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
1880 jermar 74
    dump_istate(istate);
75
    panic("%s\n", __FUNCTION__);
897 jermar 76
}
77
 
1870 jermar 78
/** Handle privileged_opcode. (0x11) */
79
void privileged_opcode(int n, istate_t *istate)
883 jermar 80
{
1870 jermar 81
    fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
1880 jermar 82
    dump_istate(istate);
83
    panic("%s\n", __FUNCTION__);
883 jermar 84
}
1702 cejka 85
 
1883 jermar 86
/** Handle unimplemented_LDD. (0x12) */
87
void unimplemented_LDD(int n, istate_t *istate)
88
{
89
    fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
90
    dump_istate(istate);
91
    panic("%s\n", __FUNCTION__);
92
}
93
 
94
/** Handle unimplemented_STD. (0x13) */
95
void unimplemented_STD(int n, istate_t *istate)
96
{
97
    fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
98
    dump_istate(istate);
99
    panic("%s\n", __FUNCTION__);
100
}
101
 
1882 jermar 102
/** Handle fp_disabled. (0x20) */
103
void fp_disabled(int n, istate_t *istate)
104
{
105
    fprs_reg_t fprs;
106
 
107
    fprs.value = fprs_read();
108
    if (!fprs.fef) {
109
        fprs.fef = true;
110
        fprs_write(fprs.value);
111
        return;
112
    }
113
 
114
#ifdef CONFIG_FPU_LAZY
115
    scheduler_fpu_lazy_request();
116
#else
117
    fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
118
    dump_istate(istate);
119
    panic("%s\n", __FUNCTION__);
120
#endif
121
}
122
 
1883 jermar 123
/** Handle fp_exception_ieee_754. (0x21) */
124
void fp_exception_ieee_754(int n, istate_t *istate)
125
{
126
    fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
127
    dump_istate(istate);
128
    panic("%s\n", __FUNCTION__);
129
}
130
 
131
/** Handle fp_exception_other. (0x22) */
132
void fp_exception_other(int n, istate_t *istate)
133
{
134
    fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
135
    dump_istate(istate);
136
    panic("%s\n", __FUNCTION__);
137
}
138
 
139
/** Handle tag_overflow. (0x23) */
140
void tag_overflow(int n, istate_t *istate)
141
{
142
    fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
143
    dump_istate(istate);
144
    panic("%s\n", __FUNCTION__);
145
}
146
 
1870 jermar 147
/** Handle division_by_zero. (0x28) */
148
void division_by_zero(int n, istate_t *istate)
149
{
150
    fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
1880 jermar 151
    dump_istate(istate);
152
    panic("%s\n", __FUNCTION__);
1870 jermar 153
}
154
 
155
/** Handle data_access_exception. (0x30) */
156
void data_access_exception(int n, istate_t *istate)
157
{
158
    fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
1880 jermar 159
    dump_istate(istate);
1946 jermar 160
    dump_sfsr_and_sfar();
1880 jermar 161
    panic("%s\n", __FUNCTION__);
1870 jermar 162
}
163
 
164
/** Handle data_access_error. (0x32) */
165
void data_access_error(int n, istate_t *istate)
166
{
167
    fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
1880 jermar 168
    dump_istate(istate);
169
    panic("%s\n", __FUNCTION__);
1870 jermar 170
}
171
 
172
/** Handle mem_address_not_aligned. (0x34) */
173
void mem_address_not_aligned(int n, istate_t *istate)
174
{
175
    fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
1880 jermar 176
    dump_istate(istate);
177
    panic("%s\n", __FUNCTION__);
1870 jermar 178
}
179
 
1883 jermar 180
/** Handle LDDF_mem_address_not_aligned. (0x35) */
181
void LDDF_mem_address_not_aligned(int n, istate_t *istate)
182
{
183
    fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
184
    dump_istate(istate);
185
    panic("%s\n", __FUNCTION__);
186
}
187
 
188
/** Handle STDF_mem_address_not_aligned. (0x36) */
189
void STDF_mem_address_not_aligned(int n, istate_t *istate)
190
{
191
    fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
192
    dump_istate(istate);
193
    panic("%s\n", __FUNCTION__);
194
}
195
 
1870 jermar 196
/** Handle privileged_action. (0x37) */
197
void privileged_action(int n, istate_t *istate)
198
{
199
    fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
1880 jermar 200
    dump_istate(istate);
201
    panic("%s\n", __FUNCTION__);
1870 jermar 202
}
203
 
1883 jermar 204
/** Handle LDQF_mem_address_not_aligned. (0x38) */
205
void LDQF_mem_address_not_aligned(int n, istate_t *istate)
206
{
207
    fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
208
    dump_istate(istate);
209
    panic("%s\n", __FUNCTION__);
210
}
211
 
212
/** Handle STQF_mem_address_not_aligned. (0x39) */
213
void STQF_mem_address_not_aligned(int n, istate_t *istate)
214
{
215
    fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
216
    dump_istate(istate);
217
    panic("%s\n", __FUNCTION__);
218
}
219
 
1703 jermar 220
/** @}
1702 cejka 221
 */