Subversion Repositories HelenOS

Rev

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

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