i'm so close

This commit is contained in:
2025-07-08 18:53:06 +03:00
parent a9f8e96ac9
commit 5b5de55919
2 changed files with 9 additions and 2 deletions
+1 -1
View File
@@ -180,7 +180,7 @@ void destroy_page_dir(uint32_t* page_dir_virt) {
// If the page table entry is present, free the physical page (frame) it points to
if (pte & PAGE_PRESENT) {
debug_log("freeing page %X\n", pte);
//debug_log("freeing page %X\n", pte);
free_page((void*)(pte & ~0xFFF));
}
}
+8 -1
View File
@@ -103,7 +103,14 @@ int sys_fork(TrapFrame *tf)
sp -= sizeof(TrapFrame);
child->tf = (TrapFrame*)sp;
*child->tf = *tf;
memcpy(&child->tf->gs, &tf->gs, 12 * sizeof(uint32_t));
uint32_t* parent_cpu_state_ptr = (uint32_t*)&tf->interrupt;
child->tf->eip = parent_cpu_state_ptr[0];
child->tf->cs = parent_cpu_state_ptr[1];
child->tf->eflags = parent_cpu_state_ptr[2];
child->tf->usermode_esp = parent_cpu_state_ptr[3];
child->tf->usermode_ss = parent_cpu_state_ptr[4];
child->tf->eax = 0; // Child returns 0
debug_log("Parent returns PID: %X, Child returns 0\n", child->pid);