Subversion Repositories HelenOS

Rev

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

Rev 3022 Rev 4055
Line 75... Line 75...
75
       
75
       
76
    printf("%%eip: %#lx (%s)\n", istate->eip, symbol);
76
    printf("%%eip: %#lx (%s)\n", istate->eip, symbol);
77
    printf("ERROR_WORD=%#lx\n", istate->error_word);
77
    printf("ERROR_WORD=%#lx\n", istate->error_word);
78
    printf("%%cs=%#lx,flags=%#lx\n", istate->cs, istate->eflags);
78
    printf("%%cs=%#lx,flags=%#lx\n", istate->cs, istate->eflags);
79
    printf("%%eax=%#lx, %%ecx=%#lx, %%edx=%#lx, %%esp=%p\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
-
 
81
    printf("%%esi=%#lx, %%edi=%#lx, %%ebp=%#lx, %%ebx=%#lx\n", istate->esi, istate->edi, istate->ebp, istate->ebx);
-
 
82
#endif
-
 
83
    printf("stack: %#lx, %#lx, %#lx, %#lx\n", istate->stack[0], istate->stack[1], istate->stack[2], istate->stack[3]);
80
    printf("stack: %#lx, %#lx, %#lx, %#lx\n", istate->stack[0], istate->stack[1], istate->stack[2], istate->stack[3]);
84
    printf("       %#lx, %#lx, %#lx, %#lx\n", istate->stack[4], istate->stack[5], istate->stack[6], istate->stack[7]);
81
    printf("       %#lx, %#lx, %#lx, %#lx\n", istate->stack[4], istate->stack[5], istate->stack[6], istate->stack[7]);
85
}
82
}
86
 
83
 
87
static void trap_virtual_eoi(void)
84
static void trap_virtual_eoi(void)
88
{
85
{
89
    if (eoi_function)
86
    if (eoi_function)
90
        eoi_function();
87
        eoi_function();
91
    else
88
    else
92
        panic("no eoi_function\n");
89
        panic("No eoi_function.");
93
 
90
 
94
}
91
}
95
 
92
 
96
static void null_interrupt(int n, istate_t *istate)
93
static void null_interrupt(int n, istate_t *istate)
97
{
94
{
98
    fault_if_from_uspace(istate, "unserviced interrupt: %d", n);
95
    fault_if_from_uspace(istate, "Unserviced interrupt: %d.", n);
99
 
96
 
100
    decode_istate(istate);
97
    decode_istate(istate);
101
    panic("unserviced interrupt: %d\n", n);
98
    panic("Unserviced interrupt: %d.", n);
102
}
99
}
103
 
100
 
104
/** General Protection Fault. */
101
/** General Protection Fault. */
105
static void gp_fault(int n __attribute__((unused)), istate_t *istate)
102
static void gp_fault(int n __attribute__((unused)), istate_t *istate)
106
{
103
{
Line 120... Line 117...
120
             * the instruction.
117
             * the instruction.
121
             */
118
             */
122
            io_perm_bitmap_install();
119
            io_perm_bitmap_install();
123
            return;
120
            return;
124
        }
121
        }
125
        fault_if_from_uspace(istate, "general protection fault");
122
        fault_if_from_uspace(istate, "General protection fault.");
126
    }
123
    }
127
 
124
 
128
    decode_istate(istate);
125
    decode_istate(istate);
129
    panic("general protection fault\n");
126
    panic("General protection fault.");
130
}
127
}
131
 
128
 
132
static void ss_fault(int n __attribute__((unused)), istate_t *istate)
129
static void ss_fault(int n __attribute__((unused)), istate_t *istate)
133
{
130
{
134
    fault_if_from_uspace(istate, "stack fault");
131
    fault_if_from_uspace(istate, "Stack fault.");
135
 
132
 
136
    decode_istate(istate);
133
    decode_istate(istate);
137
    panic("stack fault\n");
134
    panic("Stack fault.");
138
}
135
}
139
 
136
 
140
static void simd_fp_exception(int n __attribute__((unused)), istate_t *istate)
137
static void simd_fp_exception(int n __attribute__((unused)), istate_t *istate)
141
{
138
{
142
    uint32_t mxcsr;
139
    uint32_t mxcsr;
143
    asm (
140
    asm (
144
        "stmxcsr %0;\n"
141
        "stmxcsr %[mxcsr]\n"
145
        : "=m" (mxcsr)
142
        : [mxcsr] "=m" (mxcsr)
146
    );
143
    );
147
    fault_if_from_uspace(istate, "SIMD FP exception(19), MXCSR: %#zx",
144
    fault_if_from_uspace(istate, "SIMD FP exception(19), MXCSR: %#zx.",
148
        (unative_t) mxcsr);
145
        (unative_t) mxcsr);
149
 
146
   
150
    decode_istate(istate);
147
    decode_istate(istate);
151
    printf("MXCSR: %#lx\n", mxcsr);
148
    printf("MXCSR: %#lx\n", mxcsr);
152
    panic("SIMD FP exception(19)\n");
149
    panic("SIMD FP exception(19).");
153
}
150
}
154
 
151
 
155
static void nm_fault(int n __attribute__((unused)), istate_t *istate __attribute__((unused)))
152
static void nm_fault(int n __attribute__((unused)), istate_t *istate __attribute__((unused)))
156
{
153
{
157
#ifdef CONFIG_FPU_LAZY     
154
#ifdef CONFIG_FPU_LAZY     
158
    scheduler_fpu_lazy_request();
155
    scheduler_fpu_lazy_request();
159
#else
156
#else
160
    fault_if_from_uspace(istate, "fpu fault");
157
    fault_if_from_uspace(istate, "FPU fault.");
161
    panic("fpu fault");
158
    panic("FPU fault.");
162
#endif
159
#endif
163
}
160
}
164
 
161
 
165
#ifdef CONFIG_SMP
162
#ifdef CONFIG_SMP
166
static void tlb_shootdown_ipi(int n __attribute__((unused)), istate_t *istate __attribute__((unused)))
163
static void tlb_shootdown_ipi(int n __attribute__((unused)), istate_t *istate __attribute__((unused)))
Line 189... Line 186...
189
        if (irq->preack) {
186
        if (irq->preack) {
190
            /* Send EOI before processing the interrupt */
187
            /* Send EOI before processing the interrupt */
191
            trap_virtual_eoi();
188
            trap_virtual_eoi();
192
            ack = true;
189
            ack = true;
193
        }
190
        }
194
        irq->handler(irq, irq->arg);
191
        irq->handler(irq);
195
        spinlock_unlock(&irq->lock);
192
        spinlock_unlock(&irq->lock);
196
    } else {
193
    } else {
197
        /*
194
        /*
198
         * Spurious interrupt.
195
         * Spurious interrupt.
199
         */
196
         */
Line 231... Line 228...
231
void trap_virtual_enable_irqs(uint16_t irqmask)
228
void trap_virtual_enable_irqs(uint16_t irqmask)
232
{
229
{
233
    if (enable_irqs_function)
230
    if (enable_irqs_function)
234
        enable_irqs_function(irqmask);
231
        enable_irqs_function(irqmask);
235
    else
232
    else
236
        panic("no enable_irqs_function\n");
233
        panic("No enable_irqs_function.");
237
}
234
}
238
 
235
 
239
void trap_virtual_disable_irqs(uint16_t irqmask)
236
void trap_virtual_disable_irqs(uint16_t irqmask)
240
{
237
{
241
    if (disable_irqs_function)
238
    if (disable_irqs_function)
242
        disable_irqs_function(irqmask);
239
        disable_irqs_function(irqmask);
243
    else
240
    else
244
        panic("no disable_irqs_function\n");
241
        panic("No disable_irqs_function.");
245
}
242
}
246
 
243
 
247
/** @}
244
/** @}
248
 */
245
 */