From aa8a8811818331cf511681327e3ba95e456f0d33 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 2 May 2020 15:44:11 +0200 Subject: Added many syscalls to get better POSIX compliance --- src/kernel/syscall/actions/sys_fork.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/kernel/syscall/actions/sys_fork.c (limited to 'src/kernel/syscall/actions/sys_fork.c') diff --git a/src/kernel/syscall/actions/sys_fork.c b/src/kernel/syscall/actions/sys_fork.c new file mode 100644 index 0000000..af64ff9 --- /dev/null +++ b/src/kernel/syscall/actions/sys_fork.c @@ -0,0 +1,19 @@ +#include +#include +#include +#include +#include + +uint32_t sys_fork(struct regs *r) +{ + struct page_directory *dir = paging_copy_user_directory(current_proc->cr3); + struct process *proc = process_make_new(); + proc->cr3 = dir; + memcpy(&proc->registers, r, sizeof(struct regs)); + proc->registers.eax = proc->pid; + proc->pid = current_proc->pid; + + process_spawn(proc); + + return 0; +} \ No newline at end of file -- cgit v1.2.3