fix: a bunch of stuff related to multitasking
This commit is contained in:
@ -15,6 +15,9 @@ static struct task *create_task(uint8_t owner_id)
|
||||
struct task *new_task = vmalloc(sizeof(struct task));
|
||||
if (!new_task)
|
||||
return NULL;
|
||||
new_task->next = current_task->next;
|
||||
new_task->prev = current_task;
|
||||
current_task->next = new_task;
|
||||
new_task->owner_id = owner_id;
|
||||
new_task->pid = pid++;
|
||||
new_task->heap = alloc_pages(4096, (void **)&new_task->cr3);
|
||||
@ -29,7 +32,7 @@ int create_kernel_task(void)
|
||||
{
|
||||
struct task *new_task = vmalloc(sizeof(struct task));
|
||||
if (!new_task)
|
||||
return 1;
|
||||
return -1;
|
||||
new_task->owner_id = 0;
|
||||
new_task->pid = 0;
|
||||
new_task->heap = page_directory;
|
||||
@ -46,9 +49,6 @@ void exec_fn(void (*fn)(void))
|
||||
kpanic("failed to create new task");
|
||||
new_task->status = RUN;
|
||||
new_task->eip = (uint32_t *)fn;
|
||||
new_task->prev = current_task;
|
||||
new_task->next = current_task->next;
|
||||
current_task->next = new_task;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user