wip: multitasking: add status forked
This commit is contained in:
@ -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();
|
||||
|
||||
Reference in New Issue
Block a user