aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/core/idt.c
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ens.fr>2015-03-04 11:51:30 +0100
committerAlex Auvolat <alex.auvolat@ens.fr>2015-03-04 11:51:30 +0100
commit503f176e001ddf15e6e32bc912cf10b5764bc23b (patch)
tree2595bc45e582df3ede9241c00656b65866301e38 /src/kernel/core/idt.c
parent0934f9943ef7bdec8c2eee3ea31b5e0f1e8a3faf (diff)
downloadkogata-503f176e001ddf15e6e32bc912cf10b5764bc23b.tar.gz
kogata-503f176e001ddf15e6e32bc912cf10b5764bc23b.zip
Process exiting & thread termination. IMPORTANT NOTE FOLLOWS.
Threads may now communicate via wait_on(void* ressource) and resume_on (void* ressource). Previous pause() is replaced by wait_on(current_thread) and resume(thread) by resume_on(thread). wait_on(x) may return false, indicating that the reason for returning is NOT that resume_on(x) was called but something else happenned. Typically false indicates that the curent thread is being killed and must terminate its kernel-land processing as soon as possible.
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. */