Subversion Repositories HelenOS

Rev

Rev 3790 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3790 Rev 4132
1
/*
1
/*
2
 * Copyright (c) 2005 Jakub Jermar
2
 * Copyright (c) 2005 Jakub Jermar
3
 * All rights reserved.
3
 * All rights reserved.
4
 *
4
 *
5
 * Redistribution and use in source and binary forms, with or without
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
6
 * modification, are permitted provided that the following conditions
7
 * are met:
7
 * are met:
8
 *
8
 *
9
 * - Redistributions of source code must retain the above copyright
9
 * - Redistributions of source code must retain the above copyright
10
 *   notice, this list of conditions and the following disclaimer.
10
 *   notice, this list of conditions and the following disclaimer.
11
 * - Redistributions in binary form must reproduce the above copyright
11
 * - Redistributions in binary form must reproduce the above copyright
12
 *   notice, this list of conditions and the following disclaimer in the
12
 *   notice, this list of conditions and the following disclaimer in the
13
 *   documentation and/or other materials provided with the distribution.
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
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.
15
 *   derived from this software without specific prior written permission.
16
 *
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
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
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
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
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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
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.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
 
28
 
29
/** @addtogroup sparc64interrupt
29
/** @addtogroup sparc64interrupt
30
 * @{
30
 * @{
31
 */
31
 */
32
/** @file
32
/** @file
33
 *
33
 *
34
 */
34
 */
35
 
35
 
36
#include <arch/trap/exception.h>
36
#include <arch/trap/exception.h>
37
#include <arch/mm/tlb.h>
37
#include <arch/mm/tlb.h>
38
#include <arch/interrupt.h>
38
#include <arch/interrupt.h>
39
#include <interrupt.h>
39
#include <interrupt.h>
40
#include <arch/asm.h>
40
#include <arch/asm.h>
41
#include <arch/register.h>
41
#include <arch/register.h>
42
#include <debug.h>
42
#include <debug.h>
43
#include <symtab.h>
-
 
44
#include <print.h>
43
#include <print.h>
45
 
44
 
-
 
45
#ifdef CONFIG_SYMTAB
-
 
46
#include <symtab.h>
-
 
47
#endif
-
 
48
 
46
void dump_istate(istate_t *istate)
49
void dump_istate(istate_t *istate)
47
{
50
{
-
 
51
    char *tpcs, *tnpcs;
-
 
52
 
-
 
53
#ifdef CONFIG_SYMTAB
-
 
54
    tpcs = get_symtab_entry(istate->tpc);
-
 
55
    tnpcs = get_symtab_entry(istate->tnpc);
-
 
56
#else
-
 
57
    tpcs = tnpcs = "n/a";
-
 
58
#endif
48
    printf("TSTATE=%#" PRIx64 "\n", istate->tstate);
59
    printf("TSTATE=%#" PRIx64 "\n", istate->tstate);
49
    printf("TPC=%#" PRIx64 " (%s)\n", istate->tpc, get_symtab_entry(istate->tpc));
60
    printf("TPC=%#" PRIx64 " (%s)\n", istate->tpc, tpcs);
50
    printf("TNPC=%#" PRIx64 " (%s)\n", istate->tnpc, get_symtab_entry(istate->tnpc));
61
    printf("TNPC=%#" PRIx64 " (%s)\n", istate->tnpc, tnpcs);
51
}
62
}
52
 
63
 
53
/** Handle instruction_access_exception. (0x8) */
64
/** Handle instruction_access_exception. (0x8) */
54
void instruction_access_exception(int n, istate_t *istate)
65
void instruction_access_exception(int n, istate_t *istate)
55
{
66
{
56
    fault_if_from_uspace(istate, "%s.", __func__);
67
    fault_if_from_uspace(istate, "%s.", __func__);
57
    dump_istate(istate);
68
    dump_istate(istate);
58
    panic("%s.", __func__);
69
    panic("%s.", __func__);
59
}
70
}
60
 
71
 
61
/** Handle instruction_access_error. (0xa) */
72
/** Handle instruction_access_error. (0xa) */
62
void instruction_access_error(int n, istate_t *istate)
73
void instruction_access_error(int n, istate_t *istate)
63
{
74
{
64
    fault_if_from_uspace(istate, "%s.", __func__);
75
    fault_if_from_uspace(istate, "%s.", __func__);
65
    dump_istate(istate);
76
    dump_istate(istate);
66
    panic("%s.", __func__);
77
    panic("%s.", __func__);
67
}
78
}
68
 
79
 
69
/** Handle illegal_instruction. (0x10) */
80
/** Handle illegal_instruction. (0x10) */
70
void illegal_instruction(int n, istate_t *istate)
81
void illegal_instruction(int n, istate_t *istate)
71
{
82
{
72
    fault_if_from_uspace(istate, "%s.", __func__);
83
    fault_if_from_uspace(istate, "%s.", __func__);
73
    dump_istate(istate);
84
    dump_istate(istate);
74
    panic("%s.", __func__);
85
    panic("%s.", __func__);
75
}
86
}
76
 
87
 
77
/** Handle privileged_opcode. (0x11) */
88
/** Handle privileged_opcode. (0x11) */
78
void privileged_opcode(int n, istate_t *istate)
89
void privileged_opcode(int n, istate_t *istate)
79
{
90
{
80
    fault_if_from_uspace(istate, "%s.", __func__);
91
    fault_if_from_uspace(istate, "%s.", __func__);
81
    dump_istate(istate);
92
    dump_istate(istate);
82
    panic("%s.", __func__);
93
    panic("%s.", __func__);
83
}
94
}
84
 
95
 
85
/** Handle unimplemented_LDD. (0x12) */
96
/** Handle unimplemented_LDD. (0x12) */
86
void unimplemented_LDD(int n, istate_t *istate)
97
void unimplemented_LDD(int n, istate_t *istate)
87
{
98
{
88
    fault_if_from_uspace(istate, "%s.", __func__);
99
    fault_if_from_uspace(istate, "%s.", __func__);
89
    dump_istate(istate);
100
    dump_istate(istate);
90
    panic("%s.", __func__);
101
    panic("%s.", __func__);
91
}
102
}
92
 
103
 
93
/** Handle unimplemented_STD. (0x13) */
104
/** Handle unimplemented_STD. (0x13) */
94
void unimplemented_STD(int n, istate_t *istate)
105
void unimplemented_STD(int n, istate_t *istate)
95
{
106
{
96
    fault_if_from_uspace(istate, "%s.", __func__);
107
    fault_if_from_uspace(istate, "%s.", __func__);
97
    dump_istate(istate);
108
    dump_istate(istate);
98
    panic("%s.", __func__);
109
    panic("%s.", __func__);
99
}
110
}
100
 
111
 
101
/** Handle fp_disabled. (0x20) */
112
/** Handle fp_disabled. (0x20) */
102
void fp_disabled(int n, istate_t *istate)
113
void fp_disabled(int n, istate_t *istate)
103
{
114
{
104
    fprs_reg_t fprs;
115
    fprs_reg_t fprs;
105
   
116
   
106
    fprs.value = fprs_read();
117
    fprs.value = fprs_read();
107
    if (!fprs.fef) {
118
    if (!fprs.fef) {
108
        fprs.fef = true;
119
        fprs.fef = true;
109
        fprs_write(fprs.value);
120
        fprs_write(fprs.value);
110
        return;
121
        return;
111
    }
122
    }
112
 
123
 
113
#ifdef CONFIG_FPU_LAZY
124
#ifdef CONFIG_FPU_LAZY
114
    scheduler_fpu_lazy_request();
125
    scheduler_fpu_lazy_request();
115
#else
126
#else
116
    fault_if_from_uspace(istate, "%s.", __func__);
127
    fault_if_from_uspace(istate, "%s.", __func__);
117
    dump_istate(istate);
128
    dump_istate(istate);
118
    panic("%s.", __func__);
129
    panic("%s.", __func__);
119
#endif
130
#endif
120
}
131
}
121
 
132
 
122
/** Handle fp_exception_ieee_754. (0x21) */
133
/** Handle fp_exception_ieee_754. (0x21) */
123
void fp_exception_ieee_754(int n, istate_t *istate)
134
void fp_exception_ieee_754(int n, istate_t *istate)
124
{
135
{
125
    fault_if_from_uspace(istate, "%s.", __func__);
136
    fault_if_from_uspace(istate, "%s.", __func__);
126
    dump_istate(istate);
137
    dump_istate(istate);
127
    panic("%s.", __func__);
138
    panic("%s.", __func__);
128
}
139
}
129
 
140
 
130
/** Handle fp_exception_other. (0x22) */
141
/** Handle fp_exception_other. (0x22) */
131
void fp_exception_other(int n, istate_t *istate)
142
void fp_exception_other(int n, istate_t *istate)
132
{
143
{
133
    fault_if_from_uspace(istate, "%s.", __func__);
144
    fault_if_from_uspace(istate, "%s.", __func__);
134
    dump_istate(istate);
145
    dump_istate(istate);
135
    panic("%s.", __func__);
146
    panic("%s.", __func__);
136
}
147
}
137
 
148
 
138
/** Handle tag_overflow. (0x23) */
149
/** Handle tag_overflow. (0x23) */
139
void tag_overflow(int n, istate_t *istate)
150
void tag_overflow(int n, istate_t *istate)
140
{
151
{
141
    fault_if_from_uspace(istate, "%s.", __func__);
152
    fault_if_from_uspace(istate, "%s.", __func__);
142
    dump_istate(istate);
153
    dump_istate(istate);
143
    panic("%s.", __func__);
154
    panic("%s.", __func__);
144
}
155
}
145
 
156
 
146
/** Handle division_by_zero. (0x28) */
157
/** Handle division_by_zero. (0x28) */
147
void division_by_zero(int n, istate_t *istate)
158
void division_by_zero(int n, istate_t *istate)
148
{
159
{
149
    fault_if_from_uspace(istate, "%s.", __func__);
160
    fault_if_from_uspace(istate, "%s.", __func__);
150
    dump_istate(istate);
161
    dump_istate(istate);
151
    panic("%s.", __func__);
162
    panic("%s.", __func__);
152
}
163
}
153
 
164
 
154
/** Handle data_access_exception. (0x30) */
165
/** Handle data_access_exception. (0x30) */
155
void data_access_exception(int n, istate_t *istate)
166
void data_access_exception(int n, istate_t *istate)
156
{
167
{
157
    fault_if_from_uspace(istate, "%s.", __func__);
168
    fault_if_from_uspace(istate, "%s.", __func__);
158
    dump_istate(istate);
169
    dump_istate(istate);
159
    dump_sfsr_and_sfar();
170
    dump_sfsr_and_sfar();
160
    panic("%s.", __func__);
171
    panic("%s.", __func__);
161
}
172
}
162
 
173
 
163
/** Handle data_access_error. (0x32) */
174
/** Handle data_access_error. (0x32) */
164
void data_access_error(int n, istate_t *istate)
175
void data_access_error(int n, istate_t *istate)
165
{
176
{
166
    fault_if_from_uspace(istate, "%s.", __func__);
177
    fault_if_from_uspace(istate, "%s.", __func__);
167
    dump_istate(istate);
178
    dump_istate(istate);
168
    panic("%s.", __func__);
179
    panic("%s.", __func__);
169
}
180
}
170
 
181
 
171
/** Handle mem_address_not_aligned. (0x34) */
182
/** Handle mem_address_not_aligned. (0x34) */
172
void mem_address_not_aligned(int n, istate_t *istate)
183
void mem_address_not_aligned(int n, istate_t *istate)
173
{
184
{
174
    fault_if_from_uspace(istate, "%s.", __func__);
185
    fault_if_from_uspace(istate, "%s.", __func__);
175
    dump_istate(istate);
186
    dump_istate(istate);
176
    panic("%s.", __func__);
187
    panic("%s.", __func__);
177
}
188
}
178
 
189
 
179
/** Handle LDDF_mem_address_not_aligned. (0x35) */
190
/** Handle LDDF_mem_address_not_aligned. (0x35) */
180
void LDDF_mem_address_not_aligned(int n, istate_t *istate)
191
void LDDF_mem_address_not_aligned(int n, istate_t *istate)
181
{
192
{
182
    fault_if_from_uspace(istate, "%s.", __func__);
193
    fault_if_from_uspace(istate, "%s.", __func__);
183
    dump_istate(istate);
194
    dump_istate(istate);
184
    panic("%s.", __func__);
195
    panic("%s.", __func__);
185
}
196
}
186
 
197
 
187
/** Handle STDF_mem_address_not_aligned. (0x36) */
198
/** Handle STDF_mem_address_not_aligned. (0x36) */
188
void STDF_mem_address_not_aligned(int n, istate_t *istate)
199
void STDF_mem_address_not_aligned(int n, istate_t *istate)
189
{
200
{
190
    fault_if_from_uspace(istate, "%s.", __func__);
201
    fault_if_from_uspace(istate, "%s.", __func__);
191
    dump_istate(istate);
202
    dump_istate(istate);
192
    panic("%s.", __func__);
203
    panic("%s.", __func__);
193
}
204
}
194
 
205
 
195
/** Handle privileged_action. (0x37) */
206
/** Handle privileged_action. (0x37) */
196
void privileged_action(int n, istate_t *istate)
207
void privileged_action(int n, istate_t *istate)
197
{
208
{
198
    fault_if_from_uspace(istate, "%s.", __func__);
209
    fault_if_from_uspace(istate, "%s.", __func__);
199
    dump_istate(istate);
210
    dump_istate(istate);
200
    panic("%s.", __func__);
211
    panic("%s.", __func__);
201
}
212
}
202
 
213
 
203
/** Handle LDQF_mem_address_not_aligned. (0x38) */
214
/** Handle LDQF_mem_address_not_aligned. (0x38) */
204
void LDQF_mem_address_not_aligned(int n, istate_t *istate)
215
void LDQF_mem_address_not_aligned(int n, istate_t *istate)
205
{
216
{
206
    fault_if_from_uspace(istate, "%s.", __func__);
217
    fault_if_from_uspace(istate, "%s.", __func__);
207
    dump_istate(istate);
218
    dump_istate(istate);
208
    panic("%s.", __func__);
219
    panic("%s.", __func__);
209
}
220
}
210
 
221
 
211
/** Handle STQF_mem_address_not_aligned. (0x39) */
222
/** Handle STQF_mem_address_not_aligned. (0x39) */
212
void STQF_mem_address_not_aligned(int n, istate_t *istate)
223
void STQF_mem_address_not_aligned(int n, istate_t *istate)
213
{
224
{
214
    fault_if_from_uspace(istate, "%s.", __func__);
225
    fault_if_from_uspace(istate, "%s.", __func__);
215
    dump_istate(istate);
226
    dump_istate(istate);
216
    panic("%s.", __func__);
227
    panic("%s.", __func__);
217
}
228
}
218
 
229
 
219
/** @}
230
/** @}
220
 */
231
 */
221
 
232