wip: handle new task creation

This commit is contained in:
0x35c
2025-11-04 12:40:42 +01:00
parent 86ce44deff
commit 56cfe9f2be
3 changed files with 9 additions and 4 deletions

View File

@ -34,12 +34,14 @@ struct task *create_task(uint8_t uid)
return NULL;
}
new_task->heap[768] = ((uint32_t)boot_page_table1 - HEAP_END) | 0x03;
memcpy(new_task->heap, current_task->heap, 4096);
switch_pd(new_task->heap, new_task->cr3);
// memcpy(new_task->heap, current_task->heap, 4096);
current_pd = new_task->heap;
// switch_pd(new_task->heap, new_task->cr3);
// Allocate new stack on the newly allocated pd
new_task->esp0 = alloc_pages(STACK_SIZE, NULL);
switch_pd(current_task->heap, current_task->cr3);
current_pd = kernel_pd;
// switch_pd(current_task->heap, current_task->cr3);
if (!new_task->esp0) {
vfree(new_task);
free_pages(new_task->heap, 4096);
@ -49,6 +51,8 @@ struct task *create_task(uint8_t uid)
new_task->next = current_task->next;
new_task->prev = current_task;
current_task->next = new_task;
if (current_task->prev == current_task)
current_task->prev = new_task;
new_task->signals.pending = SIG_IGN;