Subversion Repositories HelenOS-historic

Rev

Rev 1705 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1705 Rev 1780
Line 117... Line 117...
117
    "Reserved",
117
    "Reserved",
118
    "Reserved",
118
    "Reserved",
119
    "Reserved"
119
    "Reserved"
120
};
120
};
121
 
121
 
122
static char *vector_to_string(__u16 vector);
122
static char *vector_to_string(uint16_t vector);
123
static void dump_interrupted_context(istate_t *istate);
123
static void dump_interrupted_context(istate_t *istate);
124
 
124
 
125
char *vector_to_string(__u16 vector)
125
char *vector_to_string(uint16_t vector)
126
{
126
{
127
    ASSERT(vector <= VECTOR_MAX);
127
    ASSERT(vector <= VECTOR_MAX);
128
   
128
   
129
    if (vector >= VECTORS_16_BUNDLE_START)
129
    if (vector >= VECTORS_16_BUNDLE_START)
130
        return vector_names_16_bundle[(vector-VECTORS_16_BUNDLE_START)/(16*BUNDLE_SIZE)];
130
        return vector_names_16_bundle[(vector-VECTORS_16_BUNDLE_START)/(16*BUNDLE_SIZE)];
Line 150... Line 150...
150
    printf("cr.iip=%#018llx, #%d\t(%s)\n", istate->cr_iip, istate->cr_isr.ei, iip);
150
    printf("cr.iip=%#018llx, #%d\t(%s)\n", istate->cr_iip, istate->cr_isr.ei, iip);
151
    printf("cr.iipa=%#018llx\t(%s)\n", istate->cr_iipa, iipa);
151
    printf("cr.iipa=%#018llx\t(%s)\n", istate->cr_iipa, iipa);
152
    printf("cr.ifa=%#018llx\t(%s)\n", istate->cr_ifa, ifa);
152
    printf("cr.ifa=%#018llx\t(%s)\n", istate->cr_ifa, ifa);
153
}
153
}
154
 
154
 
155
void general_exception(__u64 vector, istate_t *istate)
155
void general_exception(uint64_t vector, istate_t *istate)
156
{
156
{
157
    char *desc = "";
157
    char *desc = "";
158
 
158
 
159
    switch (istate->cr_isr.ge_code) {
159
    switch (istate->cr_isr.ge_code) {
160
        case GE_ILLEGALOP:
160
        case GE_ILLEGALOP:
Line 186... Line 186...
186
    panic("General Exception (%s)\n", desc);
186
    panic("General Exception (%s)\n", desc);
187
}
187
}
188
 
188
 
189
void fpu_enable(void);
189
void fpu_enable(void);
190
 
190
 
191
void disabled_fp_register(__u64 vector, istate_t *istate)
191
void disabled_fp_register(uint64_t vector, istate_t *istate)
192
{
192
{
193
#ifdef CONFIG_FPU_LAZY 
193
#ifdef CONFIG_FPU_LAZY 
194
    scheduler_fpu_lazy_request();  
194
    scheduler_fpu_lazy_request();  
195
#else
195
#else
196
    fault_if_from_uspace(istate, "Interruption: %#hx (%s)", (__u16) vector, vector_to_string(vector));
196
    fault_if_from_uspace(istate, "Interruption: %#hx (%s)", (uint16_t) vector, vector_to_string(vector));
197
    dump_interrupted_context(istate);
197
    dump_interrupted_context(istate);
198
    panic("Interruption: %#hx (%s)\n", (__u16) vector, vector_to_string(vector));
198
    panic("Interruption: %#hx (%s)\n", (uint16_t) vector, vector_to_string(vector));
199
#endif
199
#endif
200
}
200
}
201
 
201
 
202
 
202
 
203
void nop_handler(__u64 vector, istate_t *istate)
203
void nop_handler(uint64_t vector, istate_t *istate)
204
{
204
{
205
}
205
}
206
 
206
 
207
 
207
 
208
 
208
 
209
/** Handle syscall. */
209
/** Handle syscall. */
210
int break_instruction(__u64 vector, istate_t *istate)
210
int break_instruction(uint64_t vector, istate_t *istate)
211
{
211
{
212
    /*
212
    /*
213
     * Move to next instruction after BREAK.
213
     * Move to next instruction after BREAK.
214
     */
214
     */
215
    if (istate->cr_ipsr.ri == 2) {
215
    if (istate->cr_ipsr.ri == 2) {
Line 225... Line 225...
225
        panic("Undefined syscall %d", istate->in4);
225
        panic("Undefined syscall %d", istate->in4);
226
       
226
       
227
    return -1;
227
    return -1;
228
}
228
}
229
 
229
 
230
void universal_handler(__u64 vector, istate_t *istate)
230
void universal_handler(uint64_t vector, istate_t *istate)
231
{
231
{
232
    fault_if_from_uspace(istate,"Interruption: %#hx (%s)\n",(__u16) vector, vector_to_string(vector));
232
    fault_if_from_uspace(istate,"Interruption: %#hx (%s)\n",(uint16_t) vector, vector_to_string(vector));
233
    dump_interrupted_context(istate);
233
    dump_interrupted_context(istate);
234
    panic("Interruption: %#hx (%s)\n", (__u16) vector, vector_to_string(vector));
234
    panic("Interruption: %#hx (%s)\n", (uint16_t) vector, vector_to_string(vector));
235
}
235
}
236
 
236
 
237
void external_interrupt(__u64 vector, istate_t *istate)
237
void external_interrupt(uint64_t vector, istate_t *istate)
238
{
238
{
239
    cr_ivr_t ivr;
239
    cr_ivr_t ivr;
240
   
240
   
241
    ivr.value = ivr_read();
241
    ivr.value = ivr_read();
242
    srlz_d();
242
    srlz_d();
Line 252... Line 252...
252
        panic("\nUnhandled External Interrupt Vector %d\n", ivr.vector);
252
        panic("\nUnhandled External Interrupt Vector %d\n", ivr.vector);
253
        break;
253
        break;
254
    }
254
    }
255
}
255
}
256
 
256
 
257
void virtual_interrupt(__u64 irq,void *param)
257
void virtual_interrupt(uint64_t irq,void *param)
258
{
258
{
259
    switch(irq) {
259
    switch(irq) {
260
        case IRQ_KBD:
260
        case IRQ_KBD:
261
            if(kbd_uspace) ipc_irq_send_notif(irq);
261
            if(kbd_uspace) ipc_irq_send_notif(irq);
262
            break;
262
            break;
Line 265... Line 265...
265
        break;
265
        break;
266
    }
266
    }
267
}
267
}
268
 
268
 
269
/* Reregister irq to be IPC-ready */
269
/* Reregister irq to be IPC-ready */
270
void irq_ipc_bind_arch(__native irq)
270
void irq_ipc_bind_arch(unative_t irq)
271
{
271
{
272
    if(irq==IRQ_KBD) {
272
    if(irq==IRQ_KBD) {
273
        kbd_uspace=1;
273
        kbd_uspace=1;
274
        return;
274
        return;
275
    }
275
    }