From 7f350e7ee1c2c38e5ac0b6c22c17388f6c78f0b5 Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Wed, 10 Sep 2025 13:28:28 -0400 Subject: refactor paging code. regression on loading init program --- lib/untyped.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 lib/untyped.c (limited to 'lib/untyped.c') diff --git a/lib/untyped.c b/lib/untyped.c new file mode 100644 index 0000000..8a20f63 --- /dev/null +++ b/lib/untyped.c @@ -0,0 +1,16 @@ +#include "include/object.h" +#include "error.h" + +int +ko_untyped_split(objdir_entry_t *target, objdir_entry_t *dest, size_t bytes) +{ + size_t *untyped = ko_entry_data(target); + if(*untyped <= bytes) return KE_TOOSMALL; + + *untyped -= bytes; + dest->data = target->data + *untyped; + *(size_t*)ko_entry_data(dest) = bytes; + dest->type = KO_MEMORY_UNTYPED; + + return 0; +} -- cgit v1.2.1