i'm so close
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user