diff options
Diffstat (limited to 'src/kernel/core/thread.c')
-rw-r--r-- | src/kernel/core/thread.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/kernel/core/thread.c b/src/kernel/core/thread.c index 3f25add..9d11da2 100644 --- a/src/kernel/core/thread.c +++ b/src/kernel/core/thread.c @@ -107,10 +107,7 @@ static void run_thread(void (*entry)(void*), void* data) { asm volatile("sti"); entry(data); - current_thread->state = T_STATE_FINISHED; - // TODO : add job for deleting the thread, or whatever - yield(); // expected never to return! - ASSERT(false); + exit(); } thread_t *new_thread(entry_t entry, void* data) { thread_t *t = (thread_t*)malloc(sizeof(thread_t)); @@ -147,7 +144,10 @@ thread_t *new_thread(entry_t entry, void* data) { t->current_pd_d = get_kernel_pagedir(); - t->proc = 0; // used by L1 functions + // used by user processes + t->proc = 0; + t->usermem_pf_handler = 0; + t->kmem_violation_handler = 0; return t; } @@ -196,6 +196,13 @@ void pause() { resume_interrupts(st); } +void exit() { + current_thread->state = T_STATE_FINISHED; + // TODO : add job for deleting the thread, or whatever + yield(); // expected never to return! + ASSERT(false); +} + void resume_thread(thread_t *thread, bool run_at_once) { bool st = disable_interrupts(); |