diff options
| author | Jon Santmyer <jon@jonsantmyer.com> | 2026-10-09 10:24:41 -0400 |
|---|---|---|
| committer | Jon Santmyer <jon@jonsantmyer.com> | 2026-10-09 10:24:41 -0400 |
| commit | cc23ea5a4b38807e79aceb23e6f43e965926618f (patch) | |
| tree | 90142bb44186f4dad7bbd82d3d53655b835c822b /sys/syscall_untyped.c | |
| parent | 434ddcd907832b1febc7d70e4faa52109c7eb3bd (diff) | |
| download | jove-kernel-cc23ea5a4b38807e79aceb23e6f43e965926618f.tar.gz jove-kernel-cc23ea5a4b38807e79aceb23e6f43e965926618f.tar.bz2 jove-kernel-cc23ea5a4b38807e79aceb23e6f43e965926618f.zip | |
add basic scheduler logic. rename init rootdir indexes
Diffstat (limited to 'sys/syscall_untyped.c')
| -rw-r--r-- | sys/syscall_untyped.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/sys/syscall_untyped.c b/sys/syscall_untyped.c index 8fe592d..1ec21c7 100644 --- a/sys/syscall_untyped.c +++ b/sys/syscall_untyped.c @@ -2,6 +2,7 @@ #include "hal/memory.h" #include "jove.h" #include "lib/printf.h" +#include "proc/process.h" #include "syscall.h" static int @@ -73,6 +74,27 @@ s_syscall_untyped_merge( return sysret; } +int +s_syscall_untyped_retype_pcb(jove_owned_obj_t *untyped_obj, + lockstack_t *lockstack, + jove_owned_obj_t *rootdir, + struct syscall_header *header) +{ + jove_untyped_t *untyped = obj_deref(untyped_obj); + CHECK_TOOSMALL(PCB_MINSIZE, untyped->limit, "Untyped object too small for PCB"); + + jove_perm_obj_t objdir_obj = link_try_traverse_objdir( + rootdir, lockstack, header->pathlen - 1, header->path); + if(errno) { + klogf("Unable to retrieve parent objdir at %P\n", + header->path, header->pathlen - 1); + return -errno; + } + CHECK_OBJPERM(objdir_obj, JOVE_PERM_ALL, "New PCB needs full access to it's root objdir!"); + + obj_settype(untyped_obj, JOVE_OBJ_PCB); + return pcb_new(untyped_obj, untyped->limit, objdir_obj.obj); +} int _syscall_handle_untyped(syscall_context_t *ctx) { @@ -99,6 +121,27 @@ int _syscall_handle_untyped(syscall_context_t *ctx) &ctx->lockstack, ctx->objdir, ctx->target.obj, ctx->bytes_left, ctx->payload); return -EPERM; + case SYSCALL_UNTYPED_RETYPE_OBJDIR: + if(ctx->target.permissions & SYSCALL_PERM_UNTYPED_RETYPE) + return objdir_new(ctx->target.obj); + return -EPERM; + + case SYSCALL_UNTYPED_RETYPE_PAGEDIR: + if(ctx->target.permissions & SYSCALL_PERM_UNTYPED_RETYPE) + return pagedir_new(ctx->target.obj); + return -EPERM; + + case SYSCALL_UNTYPED_RETYPE_SHMEMORY: + if(ctx->target.permissions & SYSCALL_PERM_UNTYPED_RETYPE) + return shmem_new(ctx->target.obj); + return -EPERM; + + case SYSCALL_UNTYPED_RETYPE_PCB: + if(ctx->target.permissions & SYSCALL_PERM_UNTYPED_RETYPE) + return s_syscall_untyped_retype_pcb( + ctx->target.obj, &ctx->lockstack, ctx->objdir, ctx->header); + return -EPERM; + default: return -EBADCALL; } |
