aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/include/task.h3
-rw-r--r--kernel/l0/task.c12
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(&current_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