diff options
author | Alex Auvolat <alex.auvolat@ens.fr> | 2014-12-07 20:30:38 +0100 |
---|---|---|
committer | Alex Auvolat <alex.auvolat@ens.fr> | 2014-12-07 20:30:38 +0100 |
commit | 64a71038a21f42874175ab210a64bf6bbc6dd6f5 (patch) | |
tree | 67728a5370c74dc4cb4245db2ed2f930a7907c40 /kernel | |
parent | 42e92e7e9ab971acd6a1a55e38c0f4e999c1293c (diff) | |
download | macroscope-64a71038a21f42874175ab210a64bf6bbc6dd6f5.tar.gz macroscope-64a71038a21f42874175ab210a64bf6bbc6dd6f5.zip |
Tweaks in code presentation.
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/include/task.h | 3 | ||||
-rw-r--r-- | kernel/l0/task.c | 12 |
2 files changed, 12 insertions, 3 deletions
diff --git a/kernel/include/task.h b/kernel/include/task.h index 2c3f6ef..b7dc02f 100644 --- a/kernel/include/task.h +++ b/kernel/include/task.h @@ -36,11 +36,12 @@ typedef void (*entry_t)(void*); void tasking_setup(entry_t cont, void* data); // never returns task_t *new_task(entry_t entry); // task is PAUSED, and must be resume_with_result'ed -extern task_t *current_task; +extern task_t *current_task; void yield(); void* wait_for_result(); + void resume_with_result(task_t *task, void* data, bool run_at_once); /* vim: set ts=4 sw=4 tw=0 noet :*/ diff --git a/kernel/l0/task.c b/kernel/l0/task.c index e31a85c..80066d8 100644 --- a/kernel/l0/task.c +++ b/kernel/l0/task.c @@ -148,12 +148,16 @@ task_t *new_task(entry_t entry) { t->current_pd_d = get_kernel_pagedir(); - t->more_data = 0; + t->more_data = 0; // free for use by L1 functions return t; } -void irq0_handler(registers_t *regs) { +// ========== // +// SETUP CODE // +// ========== // + +static void irq0_handler(registers_t *regs) { if (current_task != 0) irq0_save_context_and_enter_scheduler(¤t_task->ctx); } @@ -170,6 +174,10 @@ void tasking_setup(entry_t cont, void* arg) { ASSERT(false); } +// ======================= // +// TASK STATE MANIPULATION // +// ======================= // + void yield() { if (current_task == 0) { // might happen before tasking is initialized |