From 8d48bbd9746228b63bafa5f92b621998d7d8f3d3 Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Sun, 4 Oct 2026 10:49:41 -0400 Subject: move init fully to proc. remove init pages prealloc. prepare for scheduling --- sys/syscall.c | 8 ++++---- sys/syscall.h | 1 + sys/syscall_pcb.c | 26 ++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 sys/syscall_pcb.c (limited to 'sys') diff --git a/sys/syscall.c b/sys/syscall.c index 7207708..54d5468 100644 --- a/sys/syscall.c +++ b/sys/syscall.c @@ -38,7 +38,7 @@ static const syscall_handle_t s_syscall_handles[128] = { [JOVE_OBJ_PAGEDIR] = _syscall_handle_pagedir, [JOVE_OBJ_PROCESSOR] = _syscall_handle_generic, [JOVE_OBJ_SHMEMORY] = _syscall_handle_generic, - [JOVE_OBJ_PCB] = _syscall_handle_generic, + [JOVE_OBJ_PCB] = _syscall_handle_pcb, [JOVE_OBJ_INT_HANDLE] = _syscall_handle_generic, [JOVE_OBJ_INITRD_FILE] = _syscall_handle_initrd_file, [JOVE_OBJ_FRAMEBUFFER] = _syscall_handle_generic, @@ -86,7 +86,7 @@ syscall_handler(uintmax_t message_path_raw, uint16_t message_pathlen) ctx.pcb = process_current(); pcb_t *pcb = obj_deref(ctx.pcb); - ctx.objdir = lockstack_push(&ctx.lockstack, obj_take(pcb_rootdir(pcb))); + ctx.objdir = lockstack_push(&ctx.lockstack, obj_take(pcb_getrootdir(pcb))); ctx.message = link_try_traverse_objdir( ctx.objdir, &ctx.lockstack, message_pathlen, message_path); @@ -113,7 +113,7 @@ syscall_handler(uintmax_t message_path_raw, uint16_t message_pathlen) } uintptr_t message_vptr = message_unmap(ctx.message.obj, - (jove_owned_obj_t*)pcb_pagedir(pcb)); + (jove_owned_obj_t*)pcb_getpagedir(pcb)); size_t messagelen = 0x1000; void *messagedata = (void*)message_getdata(ctx.message.obj); @@ -154,7 +154,7 @@ syscall_handler(uintmax_t message_path_raw, uint16_t message_pathlen) } remap_return: - message_remap(ctx.message.obj, (jove_owned_obj_t*)pcb_pagedir(pcb), message_vptr); + message_remap(ctx.message.obj, (jove_owned_obj_t*)pcb_getpagedir(pcb), message_vptr); release_return: lockstack_popall(&ctx.lockstack); diff --git a/sys/syscall.h b/sys/syscall.h index 461b104..082fe29 100644 --- a/sys/syscall.h +++ b/sys/syscall.h @@ -57,6 +57,7 @@ int _syscall_handle_vtt(syscall_context_t *ctx); int _syscall_handle_objdir(syscall_context_t *ctx); int _syscall_handle_untyped(syscall_context_t *ctx); int _syscall_handle_pagedir(syscall_context_t *ctx); +int _syscall_handle_pcb(syscall_context_t *ctx); int _syscall_handle_initrd_file(syscall_context_t *ctx); int _syscall_handle_message(syscall_context_t *ctx); diff --git a/sys/syscall_pcb.c b/sys/syscall_pcb.c new file mode 100644 index 0000000..b77be95 --- /dev/null +++ b/sys/syscall_pcb.c @@ -0,0 +1,26 @@ +#include "api/error.h" +#include "lib/printf.h" +#include "syscall.h" + +int +s_syscall_pcb_yield(jove_owned_obj_t *pcb_obj, + size_t bytes_left, + void *payload_data) +{ + kprintf("%s: Stub!\n", __func__); + return 0; +} + +int +_syscall_handle_pcb(syscall_context_t *ctx) +{ + switch(ctx->header->callid) { + case SYSCALL_PCB_YIELD: + if(ctx->target.permissions & SYSCALL_PERM_PCB_YIELD) + return s_syscall_pcb_yield(ctx->target.obj, ctx->bytes_left, ctx->payload); + return -EPERM; + + default: + return -EBADCALL; + } +} -- cgit v1.2.3