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.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/kernel/task.c b/src/kernel/task.c
index 077eea6..b301217 100644
--- a/src/kernel/task.c
+++ b/src/kernel/task.c
@@ -46,18 +46,17 @@ struct tss {
struct task_state tasks[MAX_TASKS];
struct task_state *active_task;
-//puts the handle into ecx
-uint32_t new_task(struct task_state state) {
+struct task_state *new_task() {
for (uint8_t n = 0; n < MAX_TASKS; ++n)
if (!tasks[n].page_directory) {
- tasks[n] = state;
tasks[n].ecx = n + 1;
tasks[n].waiting = false;
for (uint8_t i = 0; i < MAX_WAITS; ++i)
tasks[n].waits[i].mode = NONE;
- return n + 1;
+ return tasks + n;
}
- PANIC("Maximum number of tasks reached.");
+ logf(LOG_ERROR, "Reached %d tasks, refusing to create any more.", MAX_TASKS);
+ return 0;
}
static void tmp_halt() {