aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/interrupts/isr.c
diff options
context:
space:
mode:
authorMarvin Borner2020-05-07 18:10:22 +0200
committerMarvin Borner2020-05-07 18:10:22 +0200
commit4286b14839c0c4ec016d816e426660f6685ae349 (patch)
treeccfefa4313d012fb78d8252cff98d27dfd187dc8 /src/kernel/interrupts/isr.c
parent130121dd61a9adf70d1800ceb03007275bfb589d (diff)
Fixed many bugs with wait() and fork()
This also adds many race conditions which really need to be fixed..
Diffstat (limited to 'src/kernel/interrupts/isr.c')
-rw-r--r--src/kernel/interrupts/isr.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/kernel/interrupts/isr.c b/src/kernel/interrupts/isr.c
index 54584b4..d5866f5 100644
--- a/src/kernel/interrupts/isr.c
+++ b/src/kernel/interrupts/isr.c
@@ -106,11 +106,12 @@ const char *exception_messages[32] = { "Division By Zero",
// Master exception/interrupt/fault handler - halt via panic
void fault_handler(struct regs *r)
{
+ cli();
irq_handler_t handler = isr_routines[r->int_no];
if (handler) {
handler(r);
+ sti();
} else {
- cli();
u32 faulting_address;
asm("mov %%cr2, %0" : "=r"(faulting_address));
@@ -118,20 +119,19 @@ void fault_handler(struct regs *r)
r->eip, r->eax, r->ebx, r->ecx, r->edx, r->esp, faulting_address, r->eflags,
r->err_code, r->int_no, exception_messages[r->int_no]);
- char *message;
+ char message[128];
if (r->int_no <= 32) {
- message = (char *)exception_messages[r->int_no];
+ strcpy(message, (char *)exception_messages[r->int_no]);
strcat(message, " Exception");
} else {
- message = "Unknown Exception";
+ strcpy(message, "Unknown Exception");
}
if (current_proc != NULL) {
+ warn("%s: Halting process %d", message, current_proc->pid);
memcpy(&current_proc->registers, r, sizeof(struct regs));
process_suspend(current_proc->pid);
- warn("%s: Halting process %d", message, current_proc->pid);
scheduler(r);
- sti();
} else {
if (faulting_address != (u32)fb) {
panic("Page fault before multitasking started!");