summaryrefslogtreecommitdiffstats
path: root/lib/untyped-retype.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-retype.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-retype.c')
-rw-r--r--lib/untyped-retype.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/lib/untyped-retype.c b/lib/untyped-retype.c
index 70fb4d2..526f19e 100644
--- a/lib/untyped-retype.c
+++ b/lib/untyped-retype.c
@@ -1,11 +1,43 @@
-#include <object.h>
-#include <memory.h>
+#include "object.h"
+#include "memory.h"
#include <stddef.h>
-#include <error.h>
+#include "error.h"
+#include "string.h"
int
ko_untyped_retype_objdir(objdir_entry_t *target)
{
size_t *untyped = ko_entry_data(target);
if(*untyped != 0x1000) return -KE_BADSIZE;
+
+ objdir_t *objdir = (objdir_t*)untyped;
+ memset(objdir, 0, 0x1000);
+
+ objdir->self = (objdir_entry_t) {
+ .type = KO_OBJECT_DIRECTORY,
+ .data = target->data
+ };
+ *target = (objdir_entry_t) {
+ .type = KO_OBJECT_DIRECTORY,
+ .lock = 0,
+ .extra = 0,
+ .data = objdir->self.data
+ };
+ return 0;
+}
+
+int
+ko_untyped_retype_message(objdir_entry_t *target, uintptr_t vptr)
+{
+ size_t *untyped = ko_entry_data(target);
+ if(*untyped != 0x1000) return -KE_BADSIZE;
+
+ memset(untyped, 0, KO_MESSAGE_BYTES);
+ *target = (objdir_entry_t) {
+ .type = KO_OBJECT_DIRECTORY,
+ .lock = 0,
+ .extra = 0,
+ .data = target->data
+ };
+ return 0;
}