summaryrefslogtreecommitdiffstats
path: root/lib/untyped.c
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2025-09-10 13:28:28 -0400
committerJon Santmyer <jon@jonsantmyer.com>2025-09-10 13:28:28 -0400
commit7f350e7ee1c2c38e5ac0b6c22c17388f6c78f0b5 (patch)
treeaef9904e2495ce840319f2815cd859c47294c88a /lib/untyped.c
parent032a7bc4d79efea100a00cf3464bea3249a07ff6 (diff)
downloadjove-kernel-7f350e7ee1c2c38e5ac0b6c22c17388f6c78f0b5.tar.gz
jove-kernel-7f350e7ee1c2c38e5ac0b6c22c17388f6c78f0b5.tar.bz2
jove-kernel-7f350e7ee1c2c38e5ac0b6c22c17388f6c78f0b5.zip
refactor paging code. regression on loading init program
Diffstat (limited to 'lib/untyped.c')
-rw-r--r--lib/untyped.c16
1 files changed, 16 insertions, 0 deletions
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;
+}