Subversion Repositories HelenOS

Rev

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

Rev 2218 Rev 2439
Line 67... Line 67...
67
 
67
 
68
    if (!symbol)
68
    if (!symbol)
69
        symbol = "";
69
        symbol = "";
70
 
70
 
71
    if (CPU)
71
    if (CPU)
72
        printf("----------------EXCEPTION OCCURED (cpu%d)----------------\n", CPU->id);
72
        printf("----------------EXCEPTION OCCURED (cpu%u)----------------\n", CPU->id);
73
    else
73
    else
74
        printf("----------------EXCEPTION OCCURED----------------\n");
74
        printf("----------------EXCEPTION OCCURED----------------\n");
75
       
75
       
76
    printf("%%eip: %#x (%s)\n",istate->eip,symbol);
76
    printf("%%eip: %#lx (%s)\n", istate->eip, symbol);
77
    printf("ERROR_WORD=%#x\n", istate->error_word);
77
    printf("ERROR_WORD=%#lx\n", istate->error_word);
78
    printf("%%cs=%#x,flags=%#x\n", istate->cs, istate->eflags);
78
    printf("%%cs=%#lx,flags=%#lx\n", istate->cs, istate->eflags);
79
    printf("%%eax=%#x, %%ecx=%#x, %%edx=%#x, %%esp=%#x\n",  istate->eax,istate->ecx,istate->edx,&istate->stack[0]);
79
    printf("%%eax=%#lx, %%ecx=%#lx, %%edx=%#lx, %%esp=%p\n", istate->eax, istate->ecx, istate->edx, &istate->stack[0]);
80
#ifdef CONFIG_DEBUG_ALLREGS
80
#ifdef CONFIG_DEBUG_ALLREGS
81
    printf("%%esi=%#x, %%edi=%#x, %%ebp=%#x, %%ebx=%#x\n",  istate->esi,istate->edi,istate->ebp,istate->ebx);
81
    printf("%%esi=%#lx, %%edi=%#lx, %%ebp=%#lx, %%ebx=%#lx\n", istate->esi, istate->edi, istate->ebp, istate->ebx);
82
#endif
82
#endif
83
    printf("stack: %#x, %#x, %#x, %#x\n", istate->stack[0], istate->stack[1], istate->stack[2], istate->stack[3]);
83
    printf("stack: %#lx, %#lx, %#lx, %#lx\n", istate->stack[0], istate->stack[1], istate->stack[2], istate->stack[3]);
84
    printf("       %#x, %#x, %#x, %#x\n", istate->stack[4], istate->stack[5], istate->stack[6], istate->stack[7]);
84
    printf("       %#lx, %#lx, %#lx, %#lx\n", istate->stack[4], istate->stack[5], istate->stack[6], istate->stack[7]);
85
}
85
}
86
 
86
 
87
static void trap_virtual_eoi(void)
87
static void trap_virtual_eoi(void)
88
{
88
{
89
    if (eoi_function)
89
    if (eoi_function)
Line 100... Line 100...
100
    decode_istate(istate);
100
    decode_istate(istate);
101
    panic("unserviced interrupt: %d\n", n);
101
    panic("unserviced interrupt: %d\n", n);
102
}
102
}
103
 
103
 
104
/** General Protection Fault. */
104
/** General Protection Fault. */
105
static void gp_fault(int n, istate_t *istate)
105
static void gp_fault(int n __attribute__((unused)), istate_t *istate)
106
{
106
{
107
    if (TASK) {
107
    if (TASK) {
108
        count_t ver;
108
        count_t ver;
109
       
109
       
110
        spinlock_lock(&TASK->lock);
110
        spinlock_lock(&TASK->lock);
Line 127... Line 127...
127
 
127
 
128
    decode_istate(istate);
128
    decode_istate(istate);
129
    panic("general protection fault\n");
129
    panic("general protection fault\n");
130
}
130
}
131
 
131
 
132
static void ss_fault(int n, istate_t *istate)
132
static void ss_fault(int n __attribute__((unused)), istate_t *istate)
133
{
133
{
134
    fault_if_from_uspace(istate, "stack fault");
134
    fault_if_from_uspace(istate, "stack fault");
135
 
135
 
136
    decode_istate(istate);
136
    decode_istate(istate);
137
    panic("stack fault\n");
137
    panic("stack fault\n");
138
}
138
}
139
 
139
 
140
static void simd_fp_exception(int n, istate_t *istate)
140
static void simd_fp_exception(int n __attribute__((unused)), istate_t *istate)
141
{
141
{
142
    uint32_t mxcsr;
142
    uint32_t mxcsr;
143
    asm (
143
    asm (
144
        "stmxcsr %0;\n"
144
        "stmxcsr %0;\n"
145
        :"=m"(mxcsr)
145
        : "=m" (mxcsr)
146
    );
146
    );
147
    fault_if_from_uspace(istate, "SIMD FP exception(19), MXCSR: %#zx",
147
    fault_if_from_uspace(istate, "SIMD FP exception(19), MXCSR: %#zx",
148
        (unative_t)mxcsr);
148
        (unative_t) mxcsr);
149
 
149
 
150
    decode_istate(istate);
150
    decode_istate(istate);
151
    printf("MXCSR: %#zx\n",(unative_t)(mxcsr));
151
    printf("MXCSR: %#lx\n", mxcsr);
152
    panic("SIMD FP exception(19)\n");
152
    panic("SIMD FP exception(19)\n");
153
}
153
}
154
 
154
 
155
static void nm_fault(int n, istate_t *istate)
155
static void nm_fault(int n __attribute__((unused)), istate_t *istate __attribute__((unused)))
156
{
156
{
157
#ifdef CONFIG_FPU_LAZY     
157
#ifdef CONFIG_FPU_LAZY     
158
    scheduler_fpu_lazy_request();
158
    scheduler_fpu_lazy_request();
159
#else
159
#else
160
    fault_if_from_uspace(istate, "fpu fault");
160
    fault_if_from_uspace(istate, "fpu fault");
161
    panic("fpu fault");
161
    panic("fpu fault");
162
#endif
162
#endif
163
}
163
}
164
 
164
 
165
#ifdef CONFIG_SMP
165
#ifdef CONFIG_SMP
166
static void tlb_shootdown_ipi(int n, istate_t *istate)
166
static void tlb_shootdown_ipi(int n __attribute__((unused)), istate_t *istate __attribute__((unused)))
167
{
167
{
168
    trap_virtual_eoi();
168
    trap_virtual_eoi();
169
    tlb_shootdown_ipi_recv();
169
    tlb_shootdown_ipi_recv();
170
}
170
}
171
#endif
171
#endif
172
 
172
 
173
/** Handler of IRQ exceptions */
173
/** Handler of IRQ exceptions */
174
static void irq_interrupt(int n, istate_t *istate)
174
static void irq_interrupt(int n, istate_t *istate __attribute__((unused)))
175
{
175
{
176
    ASSERT(n >= IVT_IRQBASE);
176
    ASSERT(n >= IVT_IRQBASE);
177
   
177
   
178
    int inum = n - IVT_IRQBASE;
178
    int inum = n - IVT_IRQBASE;
179
    bool ack = false;
179
    bool ack = false;
Line 196... Line 196...
196
    } else {
196
    } else {
197
        /*
197
        /*
198
         * Spurious interrupt.
198
         * Spurious interrupt.
199
         */
199
         */
200
#ifdef CONFIG_DEBUG
200
#ifdef CONFIG_DEBUG
201
        printf("cpu%d: spurious interrupt (inum=%d)\n", CPU->id, inum);
201
        printf("cpu%u: spurious interrupt (inum=%d)\n", CPU->id, inum);
202
#endif
202
#endif
203
    }
203
    }
204
   
204
   
205
    if (!ack)
205
    if (!ack)
206
        trap_virtual_eoi();
206
        trap_virtual_eoi();