Subversion Repositories HelenOS-historic

Rev

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

Rev 470 Rev 472
Line 103... Line 103...
103
    "Reserved",
103
    "Reserved",
104
    "Reserved"
104
    "Reserved"
105
};
105
};
106
 
106
 
107
static char *vector_to_string(__u16 vector);
107
static char *vector_to_string(__u16 vector);
108
static void dump_stack(struct exception_regdump *pstate);
108
static void dump_interrupted_context(struct exception_regdump *pstate);
109
 
109
 
110
char *vector_to_string(__u16 vector)
110
char *vector_to_string(__u16 vector)
111
{
111
{
112
    ASSERT(vector <= VECTOR_MAX);
112
    ASSERT(vector <= VECTOR_MAX);
113
   
113
   
Line 115... Line 115...
115
        return vector_names_16_bundle[(vector-VECTORS_16_BUNDLE_START)/(16*BUNDLE_SIZE)];
115
        return vector_names_16_bundle[(vector-VECTORS_16_BUNDLE_START)/(16*BUNDLE_SIZE)];
116
    else
116
    else
117
        return vector_names_64_bundle[vector/(64*BUNDLE_SIZE)];
117
        return vector_names_64_bundle[vector/(64*BUNDLE_SIZE)];
118
}
118
}
119
 
119
 
120
void dump_stack(struct exception_regdump *pstate)
120
void dump_interrupted_context(struct exception_regdump *pstate)
121
{
121
{
122
    char *ifa, *iipa, *iip;
122
    char *ifa, *iipa, *iip;
123
 
123
 
124
    ifa = get_symtab_entry(pstate->cr_ifa);
124
    ifa = get_symtab_entry(pstate->cr_ifa);
125
    iipa = get_symtab_entry(pstate->cr_iipa);
125
    iipa = get_symtab_entry(pstate->cr_iipa);
126
    iip = get_symtab_entry(pstate->cr_iip);
126
    iip = get_symtab_entry(pstate->cr_iip);
127
 
127
 
128
    putchar('\n');
128
    putchar('\n');
-
 
129
    printf("Interrupted context dump:\n");
129
    printf("ar.bsp=%P\tar.bspstore=%P\n", pstate->ar_bsp, pstate->ar_bspstore);
130
    printf("ar.bsp=%P\tar.bspstore=%P\n", pstate->ar_bsp, pstate->ar_bspstore);
130
    printf("ar.rnat=%Q\tar.rsc=%Q\n", pstate->ar_rnat, pstate->ar_rsc);
131
    printf("ar.rnat=%Q\tar.rsc=%Q\n", pstate->ar_rnat, pstate->ar_rsc);
131
    printf("ar.ifs=%Q\tar.pfs=%Q\n", pstate->ar_ifs, pstate->ar_pfs);
132
    printf("ar.ifs=%Q\tar.pfs=%Q\n", pstate->ar_ifs, pstate->ar_pfs);
132
    printf("cr.isr=%Q\tcr.ips=%Q\t\n", pstate->cr_isr, pstate->cr_ips);
133
    printf("cr.isr=%Q\tcr.ips=%Q\t\n", pstate->cr_isr.value, pstate->cr_ips);
133
   
134
   
134
    printf("cr.iip=%Q (%s)\n", pstate->cr_iip, iip ? iip : "?");
135
    printf("cr.iip=%Q, #%d\t(%s)\n", pstate->cr_iip, pstate->cr_isr.ei ,iip ? iip : "?");
135
    printf("cr.iipa=%Q (%s)\n", pstate->cr_iipa, iipa ? iipa : "?");
136
    printf("cr.iipa=%Q\t(%s)\n", pstate->cr_iipa, iipa ? iipa : "?");
136
    printf("cr.ifa=%Q (%s)\n", pstate->cr_ifa, ifa ? ifa : "?");
137
    printf("cr.ifa=%Q\t(%s)\n", pstate->cr_ifa, ifa ? ifa : "?");
137
}
138
}
138
 
139
 
139
void general_exception(__u64 vector, struct exception_regdump *pstate)
140
void general_exception(__u64 vector, struct exception_regdump *pstate)
140
{
141
{
-
 
142
    char *desc = "";
-
 
143
 
141
    dump_stack(pstate);
144
    dump_interrupted_context(pstate);
-
 
145
 
-
 
146
    switch (pstate->cr_isr.ge_code) {
-
 
147
        case GE_ILLEGALOP:
-
 
148
        desc = "Illegal Operation fault";
-
 
149
        break;
-
 
150
        case GE_PRIVOP:
-
 
151
        desc = "Privileged Operation fault";
-
 
152
        break;
-
 
153
        case GE_PRIVREG:
-
 
154
        desc = "Privileged Register fault";
-
 
155
        break;
-
 
156
        case GE_RESREGFLD:
-
 
157
        desc = "Reserved Register/Field fault";
-
 
158
        break;
-
 
159
        case GE_DISBLDISTRAN:
-
 
160
        desc = "Disabled Instruction Set Transition fault";
-
 
161
        break;
-
 
162
        case GE_ILLEGALDEP:
-
 
163
        desc = "Illegal Dependency fault";
-
 
164
        break;
-
 
165
        default:
-
 
166
            desc = "unknown";
-
 
167
        break;
-
 
168
    }
-
 
169
 
142
    panic("General Exception\n");
170
    panic("General Exception (%s)\n", desc);
143
}
171
}
144
 
172
 
145
void break_instruction(__u64 vector, struct exception_regdump *pstate)
173
void break_instruction(__u64 vector, struct exception_regdump *pstate)
146
{
174
{
147
    dump_stack(pstate);
175
    dump_interrupted_context(pstate);
148
    panic("Break Instruction\n");
176
    panic("Break Instruction\n");
149
}
177
}
150
 
178
 
151
void universal_handler(__u64 vector, struct exception_regdump *pstate)
179
void universal_handler(__u64 vector, struct exception_regdump *pstate)
152
{
180
{
153
    dump_stack(pstate);
181
    dump_interrupted_context(pstate);
154
    panic("Interruption: %W (%s)\n", (__u16) vector, vector_to_string(vector));
182
    panic("Interruption: %W (%s)\n", (__u16) vector, vector_to_string(vector));
155
}
183
}
156
 
184
 
157
void external_interrupt(__u64 vector, struct exception_regdump *pstate)
185
void external_interrupt(__u64 vector, struct exception_regdump *pstate)
158
{
186
{