[kernel] Add process_create syscall

New syscall creates a process (and thus a new virtual address space) but
does not create any threads in it.
This commit is contained in:
Justin C. Miller
2021-01-20 18:39:14 -08:00
parent 521df1f4b7
commit 452457412b
4 changed files with 36 additions and 8 deletions

View File

@@ -3,9 +3,24 @@
#include "log.h"
#include "objects/process.h"
#include "syscalls/helpers.h"
namespace syscalls {
j6_status_t
process_create(j6_handle_t *handle)
{
process *child = construct_handle<process>(handle);
log::debug(logs::syscall, "Process %llx created", child->koid());
return j6_status_ok;
}
j6_status_t
process_start(j6_handle_t *handle, uintptr_t entrypoint)
{
return j6_err_nyi;
}
j6_status_t
process_exit(int64_t status)
{

View File

@@ -28,22 +28,28 @@ vma_create_map(j6_handle_t *handle, size_t size, uintptr_t base, uint32_t flags)
}
j6_status_t
vma_map(j6_handle_t handle, uintptr_t base)
vma_map(j6_handle_t handle, j6_handle_t proc, uintptr_t base)
{
vm_area *a = get_handle<vm_area>(handle);
if (!a) return j6_err_invalid_arg;
process::current().space().add(base, a);
process *p = get_handle<process>(proc);
if (!p) return j6_err_invalid_arg;
p->space().add(base, a);
return j6_status_ok;
}
j6_status_t
vma_unmap(j6_handle_t handle)
vma_unmap(j6_handle_t handle, j6_handle_t proc)
{
vm_area *a = get_handle<vm_area>(handle);
if (!a) return j6_err_invalid_arg;
process::current().space().remove(a);
process *p = get_handle<process>(proc);
if (!p) return j6_err_invalid_arg;
p->space().remove(a);
return j6_status_ok;
}