aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/core/idt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/core/idt.c')
-rw-r--r--src/kernel/core/idt.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/kernel/core/idt.c b/src/kernel/core/idt.c
index 5c77502..fcf8074 100644
--- a/src/kernel/core/idt.c
+++ b/src/kernel/core/idt.c
@@ -103,6 +103,11 @@ void idt_ex_handler(registers_t *regs) {
current_thread->user_ex_handler(regs);
}
}
+
+ // maybe exit
+ if (current_thread != 0 && regs->eip < K_HIGHHALF_ADDR && current_thread->must_exit) {
+ exit();
+ }
}
/* Called in interrupt.s when an IRQ fires (interrupt 32 to 47) */
@@ -120,11 +125,21 @@ void idt_irq_handler(registers_t *regs) {
}
exit_critical(st);
+
+ // maybe exit
+ if (current_thread != 0 && regs->eip < K_HIGHHALF_ADDR && current_thread->must_exit) {
+ exit();
+ }
}
/* Caled in interrupt.s when a syscall is called */
void idt_syscall_handler(registers_t *regs) {
syscall_handler(regs);
+
+ // maybe exit
+ if (current_thread != 0 && regs->eip < K_HIGHHALF_ADDR && current_thread->must_exit) {
+ exit();
+ }
}
/* For internal use only. Sets up an entry of the IDT with given parameters. */