summaryrefslogtreecommitdiff
path: root/src/kernel/task.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/task.c')
-rw-r--r--src/kernel/task.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/kernel/task.c b/src/kernel/task.c
index 2a1f4c4..e2c19ca 100644
--- a/src/kernel/task.c
+++ b/src/kernel/task.c
@@ -70,24 +70,26 @@ void new_task(struct task_state state) {
tasks[n] = state;
return;
}
- panic("Maximum number of tasks reached.");
+ PANIC("Maximum number of tasks reached.");
}
void advance_active_task() {
- struct task_state *prev_task = active_task;
- do {
+ do
if (++active_task == tasks + MAX_TASKS)
active_task = tasks;
- if (active_task == prev_task) {
- set_log_mode(LOG_SYSTEM);
- logsz("No active tasks, halting.");
- while (1)
- asm ("hlt");
- }
- }
while (!active_task->page_directory);
}
+void make_sure_tasks() {
+ for (uint8_t n = 0; n < MAX_TASKS; ++n)
+ if (tasks[n].page_directory)
+ return;
+ set_log_mode(LOG_SYSTEM);
+ logsz("No active tasks, halting.");
+ while (1)
+ asm ("hlt");
+}
+
void delete_task(struct task_state *state) {
free_task_pd(state->page_directory);
state->page_directory = 0;