Subversion Repositories HelenOS-historic

Rev

Rev 921 | Rev 962 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 921 Rev 958
Line 106... Line 106...
106
    "Reserved",
106
    "Reserved",
107
    "Reserved"
107
    "Reserved"
108
};
108
};
109
 
109
 
110
static char *vector_to_string(__u16 vector);
110
static char *vector_to_string(__u16 vector);
111
static void dump_interrupted_context(struct exception_regdump *pstate);
111
static void dump_interrupted_context(istate_t *istate);
112
 
112
 
113
char *vector_to_string(__u16 vector)
113
char *vector_to_string(__u16 vector)
114
{
114
{
115
    ASSERT(vector <= VECTOR_MAX);
115
    ASSERT(vector <= VECTOR_MAX);
116
   
116
   
Line 118... Line 118...
118
        return vector_names_16_bundle[(vector-VECTORS_16_BUNDLE_START)/(16*BUNDLE_SIZE)];
118
        return vector_names_16_bundle[(vector-VECTORS_16_BUNDLE_START)/(16*BUNDLE_SIZE)];
119
    else
119
    else
120
        return vector_names_64_bundle[vector/(64*BUNDLE_SIZE)];
120
        return vector_names_64_bundle[vector/(64*BUNDLE_SIZE)];
121
}
121
}
122
 
122
 
123
void dump_interrupted_context(struct exception_regdump *pstate)
123
void dump_interrupted_context(istate_t *istate)
124
{
124
{
125
    char *ifa, *iipa, *iip;
125
    char *ifa, *iipa, *iip;
126
 
126
 
127
    ifa = get_symtab_entry(pstate->cr_ifa);
127
    ifa = get_symtab_entry(istate->cr_ifa);
128
    iipa = get_symtab_entry(pstate->cr_iipa);
128
    iipa = get_symtab_entry(istate->cr_iipa);
129
    iip = get_symtab_entry(pstate->cr_iip);
129
    iip = get_symtab_entry(istate->cr_iip);
130
 
130
 
131
    putchar('\n');
131
    putchar('\n');
132
    printf("Interrupted context dump:\n");
132
    printf("Interrupted context dump:\n");
133
    printf("ar.bsp=%P\tar.bspstore=%P\n", pstate->ar_bsp, pstate->ar_bspstore);
133
    printf("ar.bsp=%P\tar.bspstore=%P\n", istate->ar_bsp, istate->ar_bspstore);
134
    printf("ar.rnat=%Q\tar.rsc=%Q\n", pstate->ar_rnat, pstate->ar_rsc);
134
    printf("ar.rnat=%Q\tar.rsc=%Q\n", istate->ar_rnat, istate->ar_rsc);
135
    printf("ar.ifs=%Q\tar.pfs=%Q\n", pstate->ar_ifs, pstate->ar_pfs);
135
    printf("ar.ifs=%Q\tar.pfs=%Q\n", istate->ar_ifs, istate->ar_pfs);
136
    printf("cr.isr=%Q\tcr.ipsr=%Q\t\n", pstate->cr_isr.value, pstate->cr_ipsr);
136
    printf("cr.isr=%Q\tcr.ipsr=%Q\t\n", istate->cr_isr.value, istate->cr_ipsr);
137
   
137
   
138
    printf("cr.iip=%Q, #%d\t(%s)\n", pstate->cr_iip, pstate->cr_isr.ei ,iip ? iip : "?");
138
    printf("cr.iip=%Q, #%d\t(%s)\n", istate->cr_iip, istate->cr_isr.ei ,iip ? iip : "?");
139
    printf("cr.iipa=%Q\t(%s)\n", pstate->cr_iipa, iipa ? iipa : "?");
139
    printf("cr.iipa=%Q\t(%s)\n", istate->cr_iipa, iipa ? iipa : "?");
140
    printf("cr.ifa=%Q\t(%s)\n", pstate->cr_ifa, ifa ? ifa : "?");
140
    printf("cr.ifa=%Q\t(%s)\n", istate->cr_ifa, ifa ? ifa : "?");
141
}
141
}
142
 
142
 
143
void general_exception(__u64 vector, struct exception_regdump *pstate)
143
void general_exception(__u64 vector, istate_t *istate)
144
{
144
{
145
    char *desc = "";
145
    char *desc = "";
146
 
146
 
147
    dump_interrupted_context(pstate);
147
    dump_interrupted_context(istate);
148
 
148
 
149
    switch (pstate->cr_isr.ge_code) {
149
    switch (istate->cr_isr.ge_code) {
150
        case GE_ILLEGALOP:
150
        case GE_ILLEGALOP:
151
        desc = "Illegal Operation fault";
151
        desc = "Illegal Operation fault";
152
        break;
152
        break;
153
        case GE_PRIVOP:
153
        case GE_PRIVOP:
154
        desc = "Privileged Operation fault";
154
        desc = "Privileged Operation fault";
Line 172... Line 172...
172
 
172
 
173
    panic("General Exception (%s)\n", desc);
173
    panic("General Exception (%s)\n", desc);
174
}
174
}
175
 
175
 
176
/** Handle syscall. */
176
/** Handle syscall. */
177
int break_instruction(__u64 vector, struct exception_regdump *pstate)
177
int break_instruction(__u64 vector, istate_t *istate)
178
{
178
{
179
    /*
179
    /*
180
     * Move to next instruction after BREAK.
180
     * Move to next instruction after BREAK.
181
     */
181
     */
182
    if (pstate->cr_ipsr.ri == 2) {
182
    if (istate->cr_ipsr.ri == 2) {
183
        pstate->cr_ipsr.ri = 0;
183
        istate->cr_ipsr.ri = 0;
184
        pstate->cr_iip += 16;
184
        istate->cr_iip += 16;
185
    } else {
185
    } else {
186
        pstate->cr_ipsr.ri++;
186
        istate->cr_ipsr.ri++;
187
    }
187
    }
188
 
188
 
189
    if (pstate->in0 < SYSCALL_END)
189
    if (istate->in3 < SYSCALL_END)
190
        return syscall_table[pstate->in0](pstate->in1, pstate->in2, pstate->in3);
190
        return syscall_table[istate->in3](istate->in0, istate->in1, istate->in2);
191
    else
191
    else
192
        panic("Undefined syscall %d", pstate->in0);
192
        panic("Undefined syscall %d", istate->in3);
193
       
193
       
194
    return -1;
194
    return -1;
195
}
195
}
196
 
196
 
197
void universal_handler(__u64 vector, struct exception_regdump *pstate)
197
void universal_handler(__u64 vector, istate_t *istate)
198
{
198
{
199
    dump_interrupted_context(pstate);
199
    dump_interrupted_context(istate);
200
    panic("Interruption: %W (%s)\n", (__u16) vector, vector_to_string(vector));
200
    panic("Interruption: %W (%s)\n", (__u16) vector, vector_to_string(vector));
201
}
201
}
202
 
202
 
203
void external_interrupt(__u64 vector, struct exception_regdump *pstate)
203
void external_interrupt(__u64 vector, istate_t *istate)
204
{
204
{
205
    cr_ivr_t ivr;
205
    cr_ivr_t ivr;
206
   
206
   
207
    ivr.value = ivr_read();
207
    ivr.value = ivr_read();
208
    srlz_d();
208
    srlz_d();