Subversion Repositories HelenOS

Rev

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