wip: multitasking: add status forked

This commit is contained in:
2025-02-03 13:11:38 +01:00
parent 18486a6705
commit 7b7cc86999
5 changed files with 49 additions and 21 deletions

View File

@ -5,6 +5,7 @@
#include "kpanic.h"
#include "kprintf.h"
#include "memory.h"
#include "string.h"
#include <stdbool.h>
#include <stdint.h>
@ -81,6 +82,17 @@ void remove_task(struct task *task)
}
}
struct task *copy_task(const struct task *task)
{
struct task *new_task = create_task(task->uid);
if (!new_task)
return NULL;
memcpy(new_task->esp0, task->esp0, STACK_SIZE);
new_task->esp = new_task->esp0 + (task->esp - task->esp0);
new_task->status = task->status;
return new_task;
}
void exit_task(void)
{
cli();