fork: properly set up child process
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
ec4e9fc27d
commit
b926d50365
6 changed files with 73 additions and 25 deletions
|
|
@ -121,6 +121,7 @@ _syscall_enter:
|
|||
swapgs
|
||||
sysretq
|
||||
|
||||
/* called from the scheduler to switch processes */
|
||||
.global switch_to
|
||||
switch_to:
|
||||
push_all
|
||||
|
|
@ -129,6 +130,7 @@ switch_to:
|
|||
pop_all
|
||||
ret
|
||||
|
||||
/* return path after a process was execed */
|
||||
.global _enter_userspace_init
|
||||
_enter_userspace_init:
|
||||
mov rcx, rdi
|
||||
|
|
@ -153,6 +155,14 @@ _enter_userspace_init:
|
|||
|
||||
sysretq
|
||||
|
||||
/* set as entrypoint for a new process that was just forked */
|
||||
.global fork_trampoline
|
||||
fork_trampoline:
|
||||
mov rsp, rdx
|
||||
swapgs
|
||||
sysretq
|
||||
|
||||
|
||||
/* exceptions */
|
||||
exception 0x00
|
||||
exception 0x01
|
||||
|
|
|
|||
Loading…
Reference in a new issue