From d8aca3ff2501f9a77e22e5afb7a30380aed205af Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Fri, 16 Oct 2026 16:42:22 -0400 Subject: remove explicit framebuffer in kernel. reduce locking in syscalls --- sys/link.c | 47 ++++++++++------------ sys/link.h | 14 ++----- sys/lockstack.c | 3 +- sys/objdir.c | 89 +++++++++++++++++------------------------- sys/objdir.h | 16 ++++---- sys/syscall.c | 64 ++++++++++-------------------- sys/syscall.h | 5 +-- sys/syscall_initrd_file.c | 99 ----------------------------------------------- sys/syscall_objdir.c | 53 ++++++++++++++++--------- sys/syscall_pagedir.c | 55 +++++++++++++------------- sys/syscall_pcb.c | 84 ++++++++++++++++++++++------------------ sys/syscall_region.c | 7 ++-- sys/syscall_untyped.c | 33 +++++++++------- sys/syscall_vtt.c | 33 ---------------- 14 files changed, 224 insertions(+), 378 deletions(-) delete mode 100644 sys/syscall_initrd_file.c delete mode 100644 sys/syscall_vtt.c (limited to 'sys') diff --git a/sys/link.c b/sys/link.c index cda10c6..2588c11 100644 --- a/sys/link.c +++ b/sys/link.c @@ -7,46 +7,41 @@ jove_perm_obj_t -link_traverse(jove_owned_obj_t *link, lockstack_t *lockstack) +link_traverse(jove_owned_obj_t *link) { jove_perm_obj_t perm_obj = { .obj = link, .permissions = JOVE_PERM_ALL }; + while(obj_gettype(perm_obj.obj) == JOVE_OBJ_LINK) { jove_link_obj_t *link = obj_deref(perm_obj.obj); perm_obj.permissions &= link_getperm(link); - perm_obj.obj = lockstack_push(lockstack, link_deref(link)); + + jove_owned_obj_t *linked_obj = link_deref(link); + obj_release(perm_obj.obj); + perm_obj.obj = linked_obj; } return perm_obj; } jove_perm_obj_t -link_try_traverse(jove_owned_obj_t *link, lockstack_t *lockstack) +link_traverse_objdir( + jove_obj_t *objdir, + size_t pathlen, + objpath_part_t *path) { - jove_perm_obj_t perm_obj = { .obj = link, .permissions = JOVE_PERM_ALL }; - while(perm_obj.obj != NULL && obj_gettype(perm_obj.obj) == JOVE_OBJ_LINK) { - jove_link_obj_t *link = obj_deref(perm_obj.obj); - perm_obj.permissions &= link_getperm(link); - perm_obj.obj = lockstack_push(lockstack, link_deref(link)); - } - return perm_obj; -} + jove_owned_obj_t *objdir_obj = obj_take(objdir); + jove_perm_obj_t perm_obj = link_traverse(objdir_obj); + obj_release(objdir_obj); -jove_perm_obj_t -link_try_traverse_objdir(jove_owned_obj_t *objdir, lockstack_t *lockstack, - size_t pathlen, objpath_part_t *path) -{ - /*Do a traversal through the passed objdir to get objdir permissions.*/ - jove_perm_obj_t perm_obj = link_try_traverse(objdir, lockstack); - if(perm_obj.obj == 0) return perm_obj; if(pathlen == 0) return perm_obj; - - /*Get the object pointed to by the head of the path. */ - perm_obj.obj = lockstack_push(lockstack, objdir_trygetlocal(perm_obj.obj, path[0])); - if(pathlen > 1) lockstack_pop(lockstack); /*Don't lock the directory we're traversing. */ - - /*Recurse through the remaining path, resolving as we go. */ - jove_perm_obj_t traverse_obj = link_try_traverse_objdir(perm_obj.obj, lockstack, pathlen - 1, &path[1]); - /*Mask permissions against the head object. */ + jove_owned_obj_t *child_obj = objdir_getlocal(obj_release(perm_obj.obj), path[0]); + perm_obj.obj = child_obj; + + jove_perm_obj_t traverse_obj = link_traverse_objdir(obj_release(child_obj), pathlen - 1, &path[1]); + if(traverse_obj.obj != child_obj) { + obj_release(perm_obj.obj); + } traverse_obj.permissions &= perm_obj.permissions; + return traverse_obj; } diff --git a/sys/link.h b/sys/link.h index 5659101..38e0b7e 100644 --- a/sys/link.h +++ b/sys/link.h @@ -21,16 +21,10 @@ void link_lock(jove_link_obj_t *link); void link_unlock(jove_link_obj_t *link); jove_owned_obj_t *link_deref(jove_link_obj_t *link); -jove_owned_obj_t *link_try_deref(jove_link_obj_t *link); - -jove_perm_obj_t link_traverse(jove_owned_obj_t *link, lockstack_t *lockstack); -jove_perm_obj_t link_try_traverse(jove_owned_obj_t *link, lockstack_t *lockstack); - -/**Try to retrieve an object from the object directory, resolving each link as it's encountered. - * Permissions are preserved through traversal, meaning objects are limited by their - * objdir permissions.*/ -jove_perm_obj_t link_try_traverse_objdir(jove_owned_obj_t *objdir, - lockstack_t *lockstack, size_t pathlen, objpath_part_t *path); +jove_perm_obj_t link_traverse(jove_owned_obj_t *link); +jove_perm_obj_t link_traverse_objdir(jove_obj_t *objdir, + size_t pathlen, + objpath_part_t *path); jove_obj_t link_unlink(jove_owned_obj_t *link); int link_new(jove_owned_obj_t *target_obj, jove_owned_obj_t *untyped_obj, uint8_t permissions); diff --git a/sys/lockstack.c b/sys/lockstack.c index 7a419ac..00de774 100644 --- a/sys/lockstack.c +++ b/sys/lockstack.c @@ -23,8 +23,9 @@ lockstack_pop(lockstack_t *stack) void lockstack_popall(lockstack_t *stack) { - for(size_t i = 0; i < stack->depth; i++) + for(size_t i = 0; i < stack->depth; i++) { obj_release(stack->stack[i]); + } stack->depth = 0; } diff --git a/sys/objdir.c b/sys/objdir.c index 5b59ddc..df4b3eb 100644 --- a/sys/objdir.c +++ b/sys/objdir.c @@ -19,100 +19,83 @@ objdir_new(jove_owned_obj_t *untyped_obj) jove_obj_t objdir_peeklocal( - jove_owned_obj_t *objdir_obj, + jove_obj_t *objdir_obj, uint16_t entry) { - if(obj_gettype(objdir_obj) != JOVE_OBJ_OBJDIR) { + jove_owned_obj_t *objdir = obj_take(objdir_obj); + if(obj_gettype(objdir) != JOVE_OBJ_OBJDIR) { errno = EBADOBJ; + obj_release(objdir); return (jove_obj_t) { 0 }; } if(entry >= OBJDIR_ENTRIES) { errno = EBADPATH; + obj_release(objdir); return (jove_obj_t) { 0 }; } - jove_objdir_t *objtab = obj_deref(objdir_obj); - return objtab->entries[entry]; + jove_objdir_t *objtab = obj_deref(objdir); + jove_obj_t obj = objtab->entries[entry]; + obj_release(objdir); + return obj; } jove_owned_obj_t* objdir_getlocal( - jove_owned_obj_t *objdir_obj, + jove_obj_t *objdir_obj, uint16_t entry) { - if(obj_gettype(objdir_obj) != JOVE_OBJ_OBJDIR) { - reterr(EBADOBJ); - } - if(entry >= OBJDIR_ENTRIES) { - reterr(EBADPATH); - } - - jove_objdir_t *objtab = obj_deref(objdir_obj); - return obj_take(&objtab->entries[entry]); + jove_owned_obj_t *objdir = obj_take(objdir_obj); + jove_owned_obj_t *obj = objdir_getlocal_locked(objdir, entry); + obj_release(objdir); + return obj; } -jove_owned_obj_t* -objdir_trygetlocal( - jove_owned_obj_t *objdir_obj, - uint16_t entry) +jove_owned_obj_t *objdir_getlocal_locked(jove_owned_obj_t *objdir, objpath_part_t entry) { - if(obj_gettype(objdir_obj) != JOVE_OBJ_OBJDIR) { + if(obj_gettype(objdir) != JOVE_OBJ_OBJDIR) { + obj_release(objdir); reterr(EBADOBJ); } if(entry >= OBJDIR_ENTRIES) { + obj_release(objdir); reterr(EBADPATH); } - jove_objdir_t *objtab = obj_deref(objdir_obj); - return obj_trytake(&objtab->entries[entry]); + jove_objdir_t *objtab = obj_deref(objdir); + jove_owned_obj_t *obj = obj_take(&objtab->entries[entry]); + return obj; } jove_owned_obj_t* objdir_getobj( - jove_owned_obj_t *objdir_obj, + jove_obj_t *objdir_obj, const uint16_t *path, size_t path_len) { - errno = 0; - if(path_len == 0) { - return objdir_obj; - } - { - jove_owned_obj_t *child_objdir = objdir_getlocal(objdir_obj, path[0]); - if(child_objdir == 0) { - reterr(EBADPATH); - } + jove_owned_obj_t *objdir = obj_take(objdir_obj); + jove_owned_obj_t *obj = objdir_getobj_locked(objdir, path, path_len); + obj_release(objdir); + return obj; - jove_owned_obj_t *target_obj = objdir_getobj(child_objdir, path + 1, path_len - 1); - obj_release(child_objdir); - return target_obj; - } } -jove_owned_obj_t* -objdir_trygetobj( - jove_owned_obj_t *objdir_obj, - const uint16_t *path, - size_t path_len) +jove_owned_obj_t *objdir_getobj_locked(jove_owned_obj_t *objdir, + const objpath_part_t *path, + size_t path_len) { errno = 0; - if(path_len == 0) { - return objdir_obj; - } - { - jove_owned_obj_t *child_objdir = objdir_trygetlocal(objdir_obj, path[0]); - if(child_objdir == 0) { - return 0; - } + if(path_len == 0) return objdir; - jove_owned_obj_t *target_obj = objdir_trygetobj(child_objdir, path + 1, path_len - 1); - obj_release(child_objdir); - return target_obj; - } + jove_owned_obj_t *child_obj = objdir_getlocal_locked(objdir, path[0]); + obj_release(objdir); + + if(child_obj == NULL) return NULL; + return objdir_getobj_locked(child_obj, &path[1], path_len - 1); } bool -objdir_compare(jove_owned_obj_t *objdir_obj, objpath_part_t entry, jove_obj_t *obj) +objdir_compare(jove_obj_t *objdir_obj, objpath_part_t entry, jove_obj_t *obj) { jove_obj_t peekobj = objdir_peeklocal(objdir_obj, entry); return obj_compare(&peekobj, obj); diff --git a/sys/objdir.h b/sys/objdir.h index e86e582..4ef6d04 100644 --- a/sys/objdir.h +++ b/sys/objdir.h @@ -8,10 +8,9 @@ int objdir_new(jove_owned_obj_t *untyped_obj); /*Returns the n'th entry of the object directory passed. * If the passed object is not an objdir, returns NULL and sets errno to EBADOBJ. * If the passed entry index is out of bounds, returns NULL and sets errno to EOOB.*/ -jove_owned_obj_t *objdir_getlocal(jove_owned_obj_t *objdir_obj, uint16_t entry); -/*Same as objdir_getlocal except does not block if entry obj is taken.*/ -jove_owned_obj_t *objdir_trygetlocal(jove_owned_obj_t *objdir_obj, uint16_t entry); -jove_obj_t objdir_peeklocal(jove_owned_obj_t *objdir_obj, uint16_t entry); +jove_owned_obj_t *objdir_getlocal(jove_obj_t *objdir_obj, uint16_t entry); +jove_owned_obj_t *objdir_getlocal_locked(jove_owned_obj_t *objdir, objpath_part_t entry); +jove_obj_t objdir_peeklocal(jove_obj_t *objdir_obj, uint16_t entry); /*Recursively seeks through an object directory for an object following the passed * path variable. @@ -20,11 +19,12 @@ jove_obj_t objdir_peeklocal(jove_owned_obj_t *objdir_obj, uint16_t entry); * If any object excluding the object at the end of the path is not an objdir, * returns NULL and sets errno to EBADOBJ. * If any entry in the path is out of bounds, returns NULL and sets errno to EBADOBJ.*/ -jove_owned_obj_t *objdir_getobj(jove_owned_obj_t *objdir_obj, const uint16_t *path, size_t path_len); -/*Same as objdir_getobj but does not block if child objects are locked.*/ -jove_owned_obj_t *objdir_trygetobj(jove_owned_obj_t *objdir_obj, const uint16_t *path, size_t path_len); +jove_owned_obj_t *objdir_getobj(jove_obj_t *objdir_obj, const uint16_t *path, size_t path_len); +jove_owned_obj_t *objdir_getobj_locked(jove_owned_obj_t *objdir, + const objpath_part_t *path, + size_t path_len); -bool objdir_compare(jove_owned_obj_t *objdir_obj, objpath_part_t entry, jove_obj_t *obj); +bool objdir_compare(jove_obj_t *objdir_obj, objpath_part_t entry, jove_obj_t *obj); void objdir_swapobj(jove_owned_obj_t *a, jove_owned_obj_t *b); #endif diff --git a/sys/syscall.c b/sys/syscall.c index 7d43d66..30bd851 100644 --- a/sys/syscall.c +++ b/sys/syscall.c @@ -8,22 +8,6 @@ #include "sys/link.h" #include "sys/message.h" -int __syscall_generic_objpath(jove_owned_obj_t *objdir, size_t payload_bytes, void *payload_data, jove_owned_obj_t **retobj) -{ - size_t bytes_needed = sizeof(struct syscall_generic_objpath); - CHECK_TOOSMALL(bytes_needed, payload_bytes, - "Message too small for payload."); - struct syscall_generic_objpath *payload = payload_data; - - bytes_needed += payload->pathlen << 1; - CHECK_TOOSMALL(bytes_needed, payload_bytes, - "Message too small for object path."); - - errno = 0; - *retobj = objdir_getobj(objdir, payload->path, payload->pathlen); - return errno; -} - int _syscall_handle_generic(syscall_context_t *ctx) { @@ -41,9 +25,6 @@ static const syscall_handle_t s_syscall_handles[128] = { [JOVE_OBJ_SHMEMORY] = _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, - [JOVE_OBJ_VIRTTERM] = _syscall_handle_vtt, [JOVE_OBJ_MESSAGE] = _syscall_handle_generic, [JOVE_OBJ_LINK] = _syscall_handle_generic, }; @@ -88,10 +69,9 @@ 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_getrootdir(pcb))); - - ctx.message = link_try_traverse_objdir( - ctx.objdir, &ctx.lockstack, message_pathlen, message_path); + ctx.objdir = pcb_getrootdir(pcb); + ctx.message = link_traverse_objdir(ctx.objdir, message_pathlen, message_path); + lockstack_push(&ctx.lockstack, ctx.message.obj); if(ctx.message.obj == NULL) { klogf("Process %i failed to get message %P : %s\n", @@ -139,28 +119,26 @@ syscall_handler(uintmax_t message_path_raw, uint16_t message_pathlen) ctx.bytes_left = messagelen - bytes_needed; ctx.payload = (void*)((uintptr_t)header + bytes_needed); - ctx.target = link_try_traverse_objdir( - ctx.objdir, &ctx.lockstack, ctx.header->pathlen, ctx.header->path); + if(ctx.header->pathlen == 1) { + if(ctx.header->path[0] == PCB_ROOTDIR_SELF_I) { + ctx.target = (jove_perm_obj_t) { .permissions = 0xFF, .obj = ctx.pcb }; + } else if(ctx.header->path[0] == PCB_ROOTDIR_PAGEDIR_I) { + ctx.target = (jove_perm_obj_t) { .permissions = 0xFF, .obj = pagedir }; + } else { + ctx.target = link_traverse(objdir_getlocal(ctx.objdir, ctx.header->path[0])); + lockstack_push(&ctx.lockstack, ctx.target.obj); + } + }else{ + ctx.target = link_traverse_objdir(ctx.objdir, ctx.header->pathlen, ctx.header->path); + lockstack_push(&ctx.lockstack, ctx.target.obj); + } if(ctx.target.obj == 0) { - //Check if we're trying to reference objects we've already locked in this function. - //If we are, we should set it as the target regardless of lock, - //since we're the ones with the lock already. - if(ctx.header->pathlen == 1) { - if(ctx.header->path[0] == PCB_ROOTDIR_SELF_I) - ctx.target = (jove_perm_obj_t) { .permissions = 0xFF, .obj = ctx.pcb }; - else if(ctx.header->path[0] == PCB_ROOTDIR_PAGEDIR_I) - ctx.target = (jove_perm_obj_t) { .permissions = 0xFF, .obj = pagedir }; - else - goto fail_target_busy; - }else{ -fail_target_busy: - //Could not find payload target in pcb rootdir. - klogf("Process %i tried to call syscall with bad target path %P : %s\n", - pcb_getpid(pcb), header->path, header->pathlen, errstr(errno)); - sysret = -errno; - goto remap_return; - } + klogf("Process %i tried to call syscall with bad target path %P : %s\n", + pcb_getpid(pcb), header->path, header->pathlen, errstr(errno)); + sysret = -errno; + goto remap_return; + } sysret = _syscall_handle_switch(&ctx); diff --git a/sys/syscall.h b/sys/syscall.h index 946417c..15f3163 100644 --- a/sys/syscall.h +++ b/sys/syscall.h @@ -37,7 +37,7 @@ typedef struct syscall_state { lockstack_t lockstack; jove_owned_obj_t *pcb; - jove_owned_obj_t *objdir; + jove_obj_t *objdir; jove_perm_obj_t message; jove_perm_obj_t target; struct syscall_header *header; @@ -47,14 +47,11 @@ typedef struct syscall_state typedef int (*syscall_handle_t)(syscall_context_t*); -int __syscall_generic_objpath(jove_owned_obj_t *objdir, size_t bytes_left, void *payload_data, jove_owned_obj_t **retobj); - int _syscall_handle_switch(syscall_context_t *ctx); int _syscall_handle_generic(syscall_context_t *ctx); int _syscall_handle_arch(syscall_context_t *ctx); -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); diff --git a/sys/syscall_initrd_file.c b/sys/syscall_initrd_file.c deleted file mode 100644 index 904039d..0000000 --- a/sys/syscall_initrd_file.c +++ /dev/null @@ -1,99 +0,0 @@ -#include "api/error.h" -#include "boot/initrd.h" -#include "lib/printf.h" -#include "sys/message.h" -#include "sys/syscall.h" -#include "lib/string.h" - -int -s_syscall_initrd_file_name( - jove_owned_obj_t *initrd_file, - jove_owned_obj_t *message, - void *message_data) -{ - const char *filename = initrd_file_name(initrd_file); - size_t filename_len = strlen(filename); - - size_t bytes_left = 0x1000; - size_t bytes_needed = filename_len + sizeof(struct syscall_initrd_file_name_ret); - - CHECK_TOOSMALL(bytes_needed, bytes_left, "Message is too small for file name."); - struct syscall_initrd_file_name_ret *payload = message_data; - - payload->len = filename_len; - memcpy(payload->c_str, filename, filename_len); - return 0; -} - -int -s_syscall_initrd_file_size(jove_owned_obj_t *initrd_file) -{ - return initrd_file_size(initrd_file); -} - -int -s_syscall_initrd_file_read( - jove_owned_obj_t *initrd_file, - jove_owned_obj_t *message, - void *message_data, - size_t bytes_left, - void *payload_data) -{ - //Ensure that the message payload could hold the required read payload. - size_t bytes_needed = sizeof(struct syscall_initrd_file_read); - CHECK_TOOSMALL(bytes_needed, bytes_left, - "Message is too small to hold read payload."); - - struct syscall_initrd_file_read *payload = payload_data; - bytes_needed = payload->read_size; - bytes_left = 0x1000; - - //Ensure that the message is big enough to hold the read file data. - CHECK_TOOSMALL(bytes_needed, bytes_left, - "Message is too small to hold read bytes."); - - size_t file_size = initrd_file_size(initrd_file); - char *file_data = initrd_file_data(initrd_file); - - //Ensure that the start index is within the file. - if(payload->start_index >= file_size) { - klogf("Start index exceeds file length! (%i > %i)\n", - payload->start_index, file_size); - return -EOOB; - } - - //Ensure that the read bounds is within the file. - if(payload->start_index + payload->read_size > file_size) { - klogf("Read bounds exceed file length! (%i+%i > %i)\n", - payload->start_index, payload->read_size, file_size); - return -ETOOBIG; - } - - memcpy(message_data, file_data + payload->start_index, payload->read_size); - return 0; -} - -int -_syscall_handle_initrd_file(syscall_context_t *ctx) -{ - switch(ctx->header->callid) { - case SYSCALL_INITRD_FILE_NAME: - if(ctx->target.permissions & SYSCALL_PERM_INITRD_FILE_NAME) - return s_syscall_initrd_file_name( - ctx->target.obj, ctx->message.obj, (void*)ctx->header); - return -EPERM; - - case SYSCALL_INITRD_FILE_SIZE: - if(ctx->target.permissions & SYSCALL_PERM_INITRD_FILE_SIZE) - return s_syscall_initrd_file_size(ctx->target.obj); - return -EPERM; - - case SYSCALL_INITRD_FILE_READ: - if(ctx->target.permissions & SYSCALL_PERM_INITRD_FILE_READ) - return s_syscall_initrd_file_read( - ctx->target.obj, ctx->message.obj, (void*)ctx->header, ctx->bytes_left, ctx->payload); - return -EPERM; - default: - return -EBADCALL; - } -} diff --git a/sys/syscall_objdir.c b/sys/syscall_objdir.c index 199cbab..8a17671 100644 --- a/sys/syscall_objdir.c +++ b/sys/syscall_objdir.c @@ -7,8 +7,8 @@ int s_syscall_objdir_objtype( - jove_owned_obj_t *objdir, - jove_owned_obj_t *target_dir, + jove_obj_t *objdir, + jove_obj_t *target_dir, size_t payload_size, void *payload_data) { @@ -27,36 +27,44 @@ s_syscall_objdir_objtype( } static int -s_syscall_objdir_swap(jove_owned_obj_t *target_obj, - lockstack_t *lockstack, - jove_owned_obj_t *rootdir, - size_t bytes_left, - void *payload_data) +s_syscall_objdir_swap(lockstack_t *lockstack, + jove_obj_t *rootdir, + size_t bytes_left, + void *payload_data) { + //Verify the message is big enough for the payload. size_t bytes_needed = sizeof(struct syscall_objdir_swap); CHECK_TOOSMALL(bytes_needed, bytes_left, "Message too small for payload."); + //Verify the message is big enough for the other path. struct syscall_objdir_swap *payload = payload_data; bytes_needed += payload->other_path_length * sizeof(objpath_part_t); CHECK_TOOSMALL(bytes_needed, bytes_left, "Message too small for other path."); - jove_owned_obj_t *obj_a = lockstack_push(lockstack, objdir_trygetlocal(target_obj, payload->index)); + //Verify the object pointed to in the entry exists. + jove_obj_t *target = lockstack_pop(lockstack); + jove_owned_obj_t *obj_a = lockstack_push(lockstack, objdir_getlocal(target, payload->index)); if(obj_a == NULL) { klogf("Getting local object %i failed : %s\n", payload->index, errstr(errno)); return -errno; } - jove_perm_obj_t objdir_b = link_try_traverse_objdir(rootdir, lockstack, - payload->other_path_length - 1, payload->other_path); + + //Verify the second object directory exists. + jove_perm_obj_t objdir_b = link_traverse_objdir(rootdir, payload->other_path_length - 1, payload->other_path); if(objdir_b.obj == NULL) { + obj_release(objdir_b.obj); klogf("Getting object %P failed : %s\n", payload->other_path, payload->other_path_length, errstr(errno)); return -errno; } - + + //Verify the second object directory has the correct permissions. CHECK_OBJPERM(objdir_b, SYSCALL_PERM_OBJDIR_SWAP_TGT, "Other object is missing permission"); + + //Verify the second object exists. jove_owned_obj_t *obj_b = lockstack_push(lockstack, - objdir_trygetlocal(objdir_b.obj, payload->other_path[payload->other_path_length-1])); + objdir_getlocal_locked(objdir_b.obj, payload->other_path[payload->other_path_length-1])); if(obj_b == NULL) { klogf("Getting object %P failed : %s\n", payload->other_path, payload->other_path_length, errstr(errno)); @@ -70,37 +78,46 @@ s_syscall_objdir_swap(jove_owned_obj_t *target_obj, static int s_syscall_objdir_link(jove_owned_obj_t *target_obj, lockstack_t *lockstack, - jove_owned_obj_t *rootdir_obj, + jove_obj_t *rootdir_obj, size_t bytes_left, void *payload_data) { + //Verify the message is big enough for the payload. size_t bytes_needed = sizeof(struct syscall_objdir_link); CHECK_TOOSMALL(bytes_needed, bytes_left, "Message too small for payload"); + //Verify the message is big enough for the second path. struct syscall_objdir_link *payload = payload_data; bytes_needed += payload->other_path_length * sizeof(objpath_part_t); CHECK_TOOSMALL(bytes_needed, bytes_left, "Message too small for other object"); - jove_owned_obj_t *link_obj = lockstack_push(lockstack, objdir_trygetlocal(target_obj, payload->index)); + //Verify the objdir index is a valid object. + jove_owned_obj_t *link_obj = lockstack_push(lockstack, objdir_getlocal_locked(target_obj, payload->index)); if(link_obj == NULL) { klogf("Getting local object %i failed : %s\n", payload->index, errstr(errno)); return -errno; } + + //Verify that the link object is infact a link object. CHECK_OBJTYPE(link_obj, JOVE_OBJ_LINK, "Local object is not a link object"); - jove_perm_obj_t dest_obj = link_try_traverse_objdir(rootdir_obj, lockstack, - payload->other_path_length, payload->other_path); + jove_perm_obj_t dest_obj = link_traverse_objdir(rootdir_obj, payload->other_path_length, payload->other_path); + lockstack_push(lockstack, dest_obj.obj); + + //Verify the destination path exists. if(dest_obj.obj == NULL) { klogf("Getting destination object %P failed : %s\n", payload->other_path, payload->other_path_length, errstr(errno)); return -errno; } + //Verify the destination path is empty. if(obj_gettype(dest_obj.obj) != JOVE_OBJ_NONE) { klogf("Destination object %P is not empty\n", payload->other_path, payload->other_path_length); return -EFULL; } + //Verify the destination path has the correct permissions. CHECK_OBJPERM(dest_obj, SYSCALL_PERM_OBJDIR_LINK_TGT, "Destination object is missing permissions"); return link_dup(link_obj, dest_obj.obj); } @@ -112,12 +129,12 @@ _syscall_handle_objdir(syscall_context_t *ctx) case SYSCALL_OBJDIR_OBJTYPE: if(ctx->target.permissions & SYSCALL_PERM_OBJDIR_OBJTYPE) return s_syscall_objdir_objtype( - ctx->objdir, ctx->target.obj, ctx->bytes_left, ctx->payload); + ctx->objdir, lockstack_pop(&ctx->lockstack), ctx->bytes_left, ctx->payload); return -EPERM; case SYSCALL_OBJDIR_SWAP: if(ctx->target.permissions & SYSCALL_PERM_OBJDIR_SWAP) - return s_syscall_objdir_swap(ctx->target.obj, + return s_syscall_objdir_swap( &ctx->lockstack, ctx->objdir, ctx->bytes_left, ctx->payload); return -EPERM; diff --git a/sys/syscall_pagedir.c b/sys/syscall_pagedir.c index 7b8f315..6e773bf 100644 --- a/sys/syscall_pagedir.c +++ b/sys/syscall_pagedir.c @@ -5,9 +5,9 @@ #include "syscall.h" static int -s_get_untyped( +s_syscall_pagedir_get_untyped( lockstack_t *lockstack, - jove_owned_obj_t *objdir, + jove_obj_t *objdir, jove_owned_obj_t *pml4, size_t payload_bytes, void *payload_data, @@ -20,7 +20,7 @@ s_get_untyped( struct syscall_pagedir_map *payload = payload_data; if(payload->virtual_address > 0xFFFF800000000000ULL) { kprintf("%s: Virtual address is above user limit.\n", __func__); - return EBADARG; + return -EBADARG; } bytes_needed += payload->untyped_pathlen << 1; @@ -28,12 +28,13 @@ s_get_untyped( "Message too small for untyped path."); errno = 0; - jove_perm_obj_t untyped = link_try_traverse_objdir( - objdir, lockstack, payload->untyped_pathlen, payload->untyped_path); + jove_perm_obj_t untyped = link_traverse_objdir(objdir, payload->untyped_pathlen, payload->untyped_path); + lockstack_push(lockstack, untyped.obj); - if(errno) { - kprintf("%s: Untyped obj failed for the reason: %s\n", __func__, errstr(errno)); - return errno; + if(untyped.obj == 0) { + klogf("Unable to get untyped object %P : %s\n", + payload->untyped_path, payload->untyped_pathlen, errstr(errno)); + return -errno; } CHECK_OBJTYPE(untyped.obj, JOVE_OBJ_UNTYPED, @@ -45,12 +46,11 @@ s_get_untyped( if((uintptr_t)untyped_data & 0xFFF) { kprintf("%s: Untyped object is not page aligned.\n", __func__); - return EALIGN; + return -EALIGN; } if(untyped_data->limit != 0x1000) { - kprintf("%s: Untyped object is not page sized. (expected 0x1000 got 0x%X)\n", __func__, - untyped_data->limit); - return EBADSIZE; + klogf("Untyped object is not page sized. (%x vs 1000)\n", untyped_data->limit); + return -EBADSIZE; } *untyped_ret = untyped; @@ -60,7 +60,7 @@ s_get_untyped( static int s_syscall_pagedir_unmap( lockstack_t *lockstack, - jove_owned_obj_t *objdir, + jove_obj_t *objdir, jove_owned_obj_t *pagedir, size_t payload_bytes, void *payload_data, @@ -80,8 +80,9 @@ s_syscall_pagedir_unmap( CHECK_TOOSMALL(bytes_needed, payload_bytes, "Message too small for none path"); - jove_perm_obj_t none = link_try_traverse_objdir( - objdir, lockstack, payload->none_pathlen, payload->none_path); + jove_perm_obj_t none = link_traverse_objdir( + objdir, payload->none_pathlen, payload->none_path); + lockstack_push(lockstack, none.obj); if(errno) { kprintf("%s: None obj retrieval failed for the reason: %s\n", @@ -98,13 +99,13 @@ s_syscall_pagedir_unmap( static int s_syscall_pagedir_map_frame( lockstack_t *lockstack, - jove_owned_obj_t *objdir, + jove_obj_t *objdir, jove_owned_obj_t *pagedir, size_t payload_bytes, void *payload_data) { jove_perm_obj_t untyped = { .obj = NULL, .permissions = 0 }; - int sysret = s_get_untyped(lockstack, objdir, pagedir, payload_bytes, payload_data, &untyped); + int sysret = s_syscall_pagedir_get_untyped(lockstack, objdir, pagedir, payload_bytes, payload_data, &untyped); if(sysret != 0) { return sysret; } @@ -121,13 +122,13 @@ s_syscall_pagedir_map_frame( static int s_syscall_pagedir_map_table( lockstack_t *lockstack, - jove_owned_obj_t *objdir, + jove_obj_t *objdir, jove_owned_obj_t *pagedir, size_t payload_bytes, void *payload_data) { jove_perm_obj_t untyped = { .obj = NULL, .permissions = 0 }; - int sysret = s_get_untyped(lockstack, objdir, pagedir, payload_bytes, payload_data, &untyped); + int sysret = s_syscall_pagedir_get_untyped(lockstack, objdir, pagedir, payload_bytes, payload_data, &untyped); if(sysret != 0) { return sysret; } @@ -144,7 +145,7 @@ s_syscall_pagedir_map_table( static int s_syscall_pagedir_map_shmem( lockstack_t *lockstack, - jove_owned_obj_t *objdir, + jove_obj_t *objdir, jove_owned_obj_t *pagedir, size_t payload_bytes, void *payload_data) @@ -163,10 +164,10 @@ s_syscall_pagedir_map_shmem( CHECK_TOOSMALL(bytes_needed, payload_bytes, "Message too small for shared memory path."); - errno = 0; - jove_perm_obj_t shmem = link_try_traverse_objdir( - objdir, lockstack, payload->shmem_pathlen, payload->shmem_path); - if(errno) { + jove_perm_obj_t shmem = link_traverse_objdir(objdir, payload->shmem_pathlen, payload->shmem_path); + lockstack_push(lockstack, shmem.obj); + + if(shmem.obj == NULL) { klogf("Unable to retrieve shared memory object %P : %s\n", payload->shmem_path, payload->shmem_pathlen, errstr(errno)); return errno; @@ -191,7 +192,7 @@ s_syscall_pagedir_map_shmem( static int s_syscall_pagedir_unmap_frame( lockstack_t *lockstack, - jove_owned_obj_t *objdir, + jove_obj_t *objdir, jove_owned_obj_t *pagedir, size_t payload_bytes, void *payload_data) @@ -208,7 +209,7 @@ s_syscall_pagedir_unmap_frame( static int s_syscall_pagedir_unmap_table( lockstack_t *lockstack, - jove_owned_obj_t *objdir, + jove_obj_t *objdir, jove_owned_obj_t *pagedir, size_t payload_bytes, void *payload_data) @@ -227,7 +228,7 @@ _syscall_handle_pagedir(syscall_context_t *ctx) { lockstack_t *lockstack = &ctx->lockstack; struct syscall_header *header = ctx->header; - jove_owned_obj_t *objdir = ctx->objdir; + jove_obj_t *objdir = ctx->objdir; jove_perm_obj_t *target = &ctx->target; size_t bytes_left = ctx->bytes_left; void *payload = ctx->payload; diff --git a/sys/syscall_pcb.c b/sys/syscall_pcb.c index 3aeb22b..7a6d4e3 100644 --- a/sys/syscall_pcb.c +++ b/sys/syscall_pcb.c @@ -12,7 +12,7 @@ s_syscall_pcb_yield(jove_owned_obj_t *pcb_obj, size_t bytes_left, void *payload_data) { - //Validate that message is big enough for payload + //Verify message is big enough for payload size_t bytes_needed = sizeof(pid_t); CHECK_TOOSMALL(bytes_needed, bytes_left, "Message too small for payload"); @@ -26,40 +26,43 @@ s_syscall_pcb_yield(jove_owned_obj_t *pcb_obj, int s_syscall_pcb_send(jove_owned_obj_t *pcb_obj, lockstack_t *lockstack, - jove_owned_obj_t *objdir_obj, + jove_obj_t *objdir_obj, size_t bytes_left, void *payload_data) { - //Validate that message is big enough for payload. + //Verify message is big enough for payload. size_t bytes_needed = sizeof(struct syscall_pcb_send); CHECK_TOOSMALL(bytes_needed, bytes_left, "Message too small for payload"); struct syscall_pcb_send *payload = payload_data; - //Validate that message is big enough for payload object path. + //Verify message is big enough for payload object path. bytes_needed += payload->send_path_length; CHECK_TOOSMALL(bytes_needed, bytes_left, "Message too small for subject path"); - //Validate that subject object path is not the root directory. + //Verify subject object path is not the root directory. if(payload->send_path_length == 0) { kprintf("%s: Unable to send root directory\n", __func__); return -EBADPATH; } - //Validate that the subject objdir path is valid. - jove_perm_obj_t subject_objdir = link_try_traverse_objdir( - objdir_obj, lockstack, payload->send_path_length - 1, payload->send_path); - if(errno) { + //Verify the subject objdir path is valid. + jove_perm_obj_t subject_objdir = link_traverse_objdir(objdir_obj, payload->send_path_length - 1, payload->send_path); + + if(subject_objdir.obj == NULL) { klogf("Unable to get subject %P objdir : %s\n", payload->send_path, payload->send_path_length, errstr(errno)); + obj_release(subject_objdir.obj); return -errno; } - //Validate that the currently running PCB has mutate permissions for this objdir. + //Verify the currently running PCB has mutate permissions for this objdir. CHECK_OBJPERM(subject_objdir, SYSCALL_PERM_PCB_SEND_OBJDIR, "Subject objdir does not permit send"); - //Validate that the subject exists in the subject objdir. - jove_owned_obj_t *subject = objdir_trygetlocal(subject_objdir.obj, - payload->send_path[payload->send_path_length-1]); + //Verify the subject exists in the subject objdir. + jove_owned_obj_t *subject = objdir_getlocal( + obj_release(subject_objdir.obj), payload->send_path[payload->send_path_length-1]); + lockstack_push(lockstack, subject); + if(subject == 0) { klogf("Unable to get subject %P object : %s\n", payload->send_path, payload->send_path_length, errstr(errno)); @@ -73,29 +76,30 @@ s_syscall_pcb_send(jove_owned_obj_t *pcb_obj, int s_syscall_pcb_recv(jove_owned_obj_t *pcb_obj, lockstack_t *lockstack, - jove_owned_obj_t *objdir_obj, + jove_obj_t *objdir_obj, size_t bytes_left, void *payload_data) { - //Validate that the message is big enough for the payload. + //Verify the message is big enough for the payload. size_t bytes_needed = sizeof(struct syscall_pcb_recv); CHECK_TOOSMALL(bytes_needed, bytes_left, "Message too small for payload"); struct syscall_pcb_recv *payload = payload_data; - //Validate that the message is big enough for the payload object. + //Verify the message is big enough for the payload object. bytes_needed += payload->recv_path_length * sizeof(objpath_part_t); CHECK_TOOSMALL(bytes_needed, bytes_left, "Message too small for destination path"); - //Validate that the destination object exists. - jove_perm_obj_t destination = link_try_traverse_objdir( - objdir_obj, lockstack, payload->recv_path_length, payload->recv_path); + //Verify the destination object exists. + jove_perm_obj_t destination = link_traverse_objdir(objdir_obj, payload->recv_path_length, payload->recv_path); + lockstack_push(lockstack, destination.obj); + if(errno) { klogf("Unable to get destination %P : %s\n", payload->recv_path, payload->recv_path_length, errstr(errno)); return -errno; } - //Validate that the destination path is JOVE_OBJ_NONE and that the object has recieve permissions. + //Verify the destination path is JOVE_OBJ_NONE and that the object has recieve permissions. CHECK_OBJTYPE(destination.obj, JOVE_OBJ_NONE, "Destination object is occupied"); CHECK_OBJPERM(destination, SYSCALL_PERM_PCB_RECV_DST, "Destination object does not permit recv."); @@ -106,52 +110,55 @@ s_syscall_pcb_recv(jove_owned_obj_t *pcb_obj, int s_syscall_pcb_swap(jove_owned_obj_t *pcb_obj, lockstack_t *lockstack, - jove_owned_obj_t *objdir_obj, + jove_obj_t *objdir_obj, size_t bytes_left, void *payload_data) { - //Validate that the message is big enough for payload. + //Verify the message is big enough for payload. size_t bytes_needed = sizeof(struct syscall_pcb_recv); CHECK_TOOSMALL(bytes_needed, bytes_left, "Message too small for payload"); struct syscall_pcb_swap *payload = payload_data; - //Validate that the message is big enough for the subject path. + //Verify the message is big enough for the subject path. bytes_needed += payload->swap_path_length * sizeof(objpath_part_t); CHECK_TOOSMALL(bytes_needed, bytes_left, "Message too small for swap path"); - //Validate that the subject is not the rootdir. + //Verify the subject is not the rootdir. if(payload->swap_path_length == 0) { kprintf("%s: Unable to swap the root directory\n", __func__); return -EBADPATH; } - //Validate that the subject objdir exists. - jove_perm_obj_t subject_objdir = link_try_traverse_objdir( - objdir_obj, lockstack, payload->swap_path_length - 1, payload->swap_path); - if(errno) { + //Verify the subject objdir exists. + jove_perm_obj_t subject_objdir = link_traverse_objdir(objdir_obj, payload->swap_path_length - 1, payload->swap_path); + + if(subject_objdir.obj == NULL) { klogf("Unable to get subject %P objdir : %s\n", payload->swap_path, payload->swap_path_length, errstr(errno)); + obj_release(subject_objdir.obj); return -errno; } - //Validate that the subject objdir has send permissions. + //Verify the subject objdir has send permissions. CHECK_OBJPERM(subject_objdir, SYSCALL_PERM_PCB_SEND_OBJDIR, "Subject objdir does not permit send"); - //Validate that the subject object exists. - jove_owned_obj_t *subject = objdir_trygetlocal(subject_objdir.obj, - payload->swap_path[payload->swap_path_length-1]); + //Verify the subject object exists. + jove_owned_obj_t *subject = objdir_getlocal( + obj_release(subject_objdir.obj), payload->swap_path[payload->swap_path_length-1]); + lockstack_push(lockstack, subject); + if(subject == 0) { klogf("Unable to get subject %P object : %s\n", payload->swap_path, payload->swap_path_length, errstr(errno)); return -errno; } - //Validate that the target PCB exists. + //Verify the target PCB exists. if(pcb_frompid(payload->swap_target) == 0) { klogf("Swap PCB target %i does not exist\n", payload->swap_target); return -EBADPROC; } - //Validate that the message was sent before timeout. + //Verify the message was sent before timeout. int send_result = pcb_send( obj_deref(pcb_obj), payload->swap_target, subject, payload->send_timeout); if(send_result < 0) { @@ -159,7 +166,7 @@ s_syscall_pcb_swap(jove_owned_obj_t *pcb_obj, return send_result; } - //Validate that a message was recieved before timeout. + //Verify a message was recieved before timeout. int recv_result = pcb_recv( obj_deref(pcb_obj), payload->swap_target, subject, payload->recv_timeout); return recv_result; @@ -168,7 +175,7 @@ s_syscall_pcb_swap(jove_owned_obj_t *pcb_obj, int s_syscall_pcb_stack(jove_owned_obj_t *pcb_obj, lockstack_t *lockstack, - jove_owned_obj_t *rootdir, + jove_obj_t *rootdir, size_t bytes_left, void *payload_data) { @@ -181,8 +188,9 @@ s_syscall_pcb_stack(jove_owned_obj_t *pcb_obj, bytes_needed += sizeof(objpath_part_t) * payload->stack_path_length; CHECK_TOOSMALL(bytes_needed, bytes_left, "Message too small for untyped path"); - jove_perm_obj_t untyped = link_try_traverse_objdir(rootdir, lockstack, - payload->stack_path_length, payload->stack_path); + jove_perm_obj_t untyped = link_traverse_objdir(rootdir, payload->stack_path_length, payload->stack_path); + lockstack_push(lockstack, untyped.obj); + //Verify the untyped object exists. if(untyped.obj == NULL) { klogf("Unable to get untyped %P : %s\n", diff --git a/sys/syscall_region.c b/sys/syscall_region.c index 959d615..dc81634 100644 --- a/sys/syscall_region.c +++ b/sys/syscall_region.c @@ -7,7 +7,7 @@ static int s_syscall_region_alloc(jove_owned_obj_t *region_obj, - jove_owned_obj_t *objdir_obj, + jove_obj_t *objdir_obj, lockstack_t *lockstack, size_t bytes_left, void *payload_data) @@ -20,8 +20,9 @@ s_syscall_region_alloc(jove_owned_obj_t *region_obj, CHECK_TOOSMALL(bytes_needed, bytes_left, "Message too small for subject path"); - jove_perm_obj_t subject = link_try_traverse_objdir( - objdir_obj, lockstack, payload->dest_pathlen, payload->dest_path); + jove_perm_obj_t subject = link_traverse_objdir(objdir_obj, payload->dest_pathlen, payload->dest_path); + lockstack_push(lockstack, subject.obj); + CHECK_OBJEXISTS(subject.obj, "Destination path is bad."); CHECK_OBJPERM(subject, SYSCALL_PERM_REGION_ALLOC_TGT, "Destination path does not have correct permissions."); CHECK_OBJTYPE(subject.obj, JOVE_OBJ_NONE, "Destination object is not JOVE_OBJ_NONE"); diff --git a/sys/syscall_untyped.c b/sys/syscall_untyped.c index c64dea1..cc6b676 100644 --- a/sys/syscall_untyped.c +++ b/sys/syscall_untyped.c @@ -12,7 +12,7 @@ static int s_syscall_untyped_split( lockstack_t *lockstack, - jove_owned_obj_t *objdir, + jove_obj_t *objdir, jove_owned_obj_t *target_obj, size_t payload_bytes, void *payload_data) @@ -24,9 +24,10 @@ s_syscall_untyped_split( bytes_needed += payload->dest_pathlen * 2; CHECK_TOOSMALL(bytes_needed, payload_bytes, "Message is too small for destination path!"); - jove_perm_obj_t dest = link_try_traverse_objdir( - objdir, lockstack, payload->dest_pathlen, payload->dest_path); - if(errno) { + jove_perm_obj_t dest = link_traverse_objdir(objdir, payload->dest_pathlen, payload->dest_path); + lockstack_push(lockstack, dest.obj); + + if(dest.obj == NULL) { klogf("Unable to get destination object %P: %s\n", payload->dest_path, payload->dest_pathlen, errstr(errno)); return errno; @@ -45,7 +46,7 @@ s_syscall_untyped_split( static int s_syscall_untyped_merge( lockstack_t *lockstack, - jove_owned_obj_t *objdir, + jove_obj_t *objdir, jove_owned_obj_t *target_obj, size_t payload_bytes, void *payload_data) @@ -57,9 +58,10 @@ s_syscall_untyped_merge( bytes_needed += payload->pathlen * 2; CHECK_TOOSMALL(bytes_needed, payload_bytes, "Message is too small for second path!"); - jove_perm_obj_t untyped = link_try_traverse_objdir( - objdir, lockstack, payload->pathlen, payload->path); - if(errno) { + jove_perm_obj_t untyped = link_traverse_objdir(objdir, payload->pathlen, payload->path); + lockstack_push(lockstack, untyped.obj); + + if(untyped.obj == NULL) { klogf("Unable to retrieve untyped object %P : %s\n", payload->path, payload->pathlen, errstr(errno)); return errno; @@ -81,21 +83,22 @@ s_syscall_untyped_merge( int s_syscall_untyped_retype_pcb(jove_owned_obj_t *untyped_obj, lockstack_t *lockstack, - jove_owned_obj_t *rootdir, + jove_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); + jove_perm_obj_t objdir_obj = link_traverse_objdir(rootdir, header->pathlen - 1, header->path); + + if(objdir_obj.obj == NULL) { + klogf("Unable to retrieve parent objdir at %P : %s\n", + header->path, header->pathlen - 1, errstr(errno)); + obj_release(objdir_obj.obj); return -errno; } CHECK_OBJPERM(objdir_obj, JOVE_PERM_ALL, "New PCB needs full access to it's root objdir!"); - if(!objdir_compare(objdir_obj.obj, PCB_ROOTDIR_SELF_I, obj_asunowned(untyped_obj))) { + if(!objdir_compare(obj_release(objdir_obj.obj), PCB_ROOTDIR_SELF_I, obj_asunowned(untyped_obj))) { klogf("Untyped is not in objdir entry %i\n", PCB_ROOTDIR_SELF_I); return -EBADPATH; } diff --git a/sys/syscall_vtt.c b/sys/syscall_vtt.c deleted file mode 100644 index dad05ba..0000000 --- a/sys/syscall_vtt.c +++ /dev/null @@ -1,33 +0,0 @@ -#include "jove.h" -#include "lib/printf.h" -#include "lib/virtterm.h" -#include "syscall.h" - -static int -s_syscall_vtt_write( - jove_owned_obj_t *vtt, - size_t payload_bytes, - void *payload_data) -{ - size_t bytes_needed = sizeof(struct syscall_generic_write); - CHECK_TOOSMALL(bytes_needed, payload_bytes, "Message is too small for this syscall!"); - - struct syscall_generic_write *payload = payload_data; - bytes_needed += payload->len * 2; - CHECK_TOOSMALL(bytes_needed, payload_bytes, "Message is too small for write buffer!"); - - return vt_write(vtt, payload->data, payload->len); -} - -int -_syscall_handle_vtt(syscall_context_t *ctx) -{ - - switch(ctx->header->callid) { - case SYSCALL_VTT_WRITE: - return s_syscall_vtt_write(ctx->target.obj, ctx->bytes_left, ctx->payload); - default: - klogf("vtt object does not support syscall %i\n", ctx->header->callid); - return -EBADCALL; - } -} -- cgit v1.2.3