Subversion Repositories HelenOS-historic

Rev

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

Rev 1 Rev 15
Line 40... Line 40...
40
   
40
   
41
    pri = cpu_priority_high();
41
    pri = cpu_priority_high();
42
    epc = cp0_epc_read();
42
    epc = cp0_epc_read();
43
    cp0_status_write(cp0_status_read() & ~ cp0_status_exl_exception_bit);
43
    cp0_status_write(cp0_status_read() & ~ cp0_status_exl_exception_bit);
44
 
44
 
45
    if (the->thread) {
45
    if (THREAD) {
46
        the->thread->saved_pri = pri;
46
        THREAD->saved_pri = pri;
47
        the->thread->saved_epc = epc;
47
        THREAD->saved_epc = epc;
48
    }
48
    }
49
    /* decode exception number and process the exception */
49
    /* decode exception number and process the exception */
50
    switch(excno = (cp0_cause_read()>>2)&0x1f) {
50
    switch(excno = (cp0_cause_read()>>2)&0x1f) {
51
        case EXC_Int: interrupt(); break;
51
        case EXC_Int: interrupt(); break;
52
        case EXC_TLBL:
52
        case EXC_TLBL:
53
        case EXC_TLBS: tlb_invalid(); break;
53
        case EXC_TLBS: tlb_invalid(); break;
54
        default: panic(PANIC "unhandled exception %d\n", excno); break;
54
        default: panic(PANIC "unhandled exception %d\n", excno); break;
55
    }
55
    }
56
   
56
   
57
    if (the->thread) {
57
    if (THREAD) {
58
        pri = the->thread->saved_pri;
58
        pri = THREAD->saved_pri;
59
        epc = the->thread->saved_epc;
59
        epc = THREAD->saved_epc;
60
    }
60
    }
61
 
61
 
62
    cp0_epc_write(epc);
62
    cp0_epc_write(epc);
63
    cp0_status_write(cp0_status_read() | cp0_status_exl_exception_bit);
63
    cp0_status_write(cp0_status_read() | cp0_status_exl_exception_bit);
64
    cpu_priority_restore(pri);
64
    cpu_priority_restore(pri);