From cc23ea5a4b38807e79aceb23e6f43e965926618f Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Fri, 9 Oct 2026 10:24:41 -0400 Subject: add basic scheduler logic. rename init rootdir indexes --- hal/shmem.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 hal/shmem.c (limited to 'hal/shmem.c') diff --git a/hal/shmem.c b/hal/shmem.c new file mode 100644 index 0000000..3785c2e --- /dev/null +++ b/hal/shmem.c @@ -0,0 +1,20 @@ +#include "api/error.h" +#include "hal/obj.h" +#include "lib/string.h" +#include "memory.h" + +int +shmem_new(jove_owned_obj_t *untyped_obj) +{ + jove_untyped_t *untyped = obj_deref(untyped_obj); + if((uintptr_t)untyped & 0xFFF) return -EALIGN; + if(untyped->limit & 0xFFF) return -EBADSIZE; + + size_t limit_pages = untyped->limit >> 12; + if(limit_pages > JOVE_SMHEM_MAXPAGES) return -ETOOBIG; + + obj_setvalue(untyped_obj, (uintptr_t)untyped | limit_pages); + obj_settype(untyped_obj, JOVE_OBJ_SHMEMORY); + memset(untyped, 0, untyped->limit); + return 0; +} -- cgit v1.2.3