mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 08:24:32 -08:00
[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:
@@ -101,11 +101,16 @@ main(int argc, const char **argv)
|
||||
_syscall_system_log(message);
|
||||
|
||||
_syscall_system_log("main thread waiting on child");
|
||||
|
||||
result = _syscall_object_wait(child, -1ull, &out);
|
||||
if (result != j6_status_ok)
|
||||
return result;
|
||||
|
||||
_syscall_system_log("main thread creating a new process");
|
||||
j6_handle_t child_proc = j6_handle_invalid;
|
||||
result = _syscall_process_create(&child_proc);
|
||||
if (result != j6_status_ok)
|
||||
return result;
|
||||
|
||||
_syscall_system_log("main testing irqs");
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,9 @@ SYSCALL(0x09, object_wait, j6_handle_t, j6_signal_t, j6_signal_t *)
|
||||
SYSCALL(0x0a, object_signal, j6_handle_t, j6_signal_t)
|
||||
SYSCALL(0x0b, object_close, j6_handle_t)
|
||||
|
||||
SYSCALL(0x10, process_exit, int64_t)
|
||||
SYSCALL(0x10, process_create, j6_handle_t *)
|
||||
SYSCALL(0x11, process_start, j6_handle_t *, uintptr_t)
|
||||
SYSCALL(0x17, process_exit, int64_t)
|
||||
|
||||
SYSCALL(0x18, thread_create, void *, j6_handle_t *)
|
||||
SYSCALL(0x19, thread_exit, int64_t)
|
||||
@@ -26,6 +28,6 @@ SYSCALL(0x2b, endpoint_sendrecv, j6_handle_t, j6_tag_t *, size_t *, void *)
|
||||
|
||||
SYSCALL(0x30, vma_create, j6_handle_t *, size_t, uint32_t)
|
||||
SYSCALL(0x31, vma_create_map, j6_handle_t *, size_t, uintptr_t, uint32_t)
|
||||
SYSCALL(0x32, vma_map, j6_handle_t, uintptr_t)
|
||||
SYSCALL(0x33, vma_unmap, j6_handle_t)
|
||||
SYSCALL(0x32, vma_map, j6_handle_t, j6_handle_t, uintptr_t)
|
||||
SYSCALL(0x33, vma_unmap, j6_handle_t, j6_handle_t)
|
||||
SYSCALL(0x34, vma_resize, j6_handle_t, size_t *)
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user