summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2026-09-19 20:32:34 -0400
committerJon Santmyer <jon@jonsantmyer.com>2026-09-19 20:32:34 -0400
commitb6765812f7da9feccc271e8e0b06f166e8054386 (patch)
treeb4d4b437d6371d103328893acfdf7199efdb850f /sys
parent50a05d7e173f1d610297219925b146f7ef50eef5 (diff)
downloadjove-kernel-b6765812f7da9feccc271e8e0b06f166e8054386.tar.gz
jove-kernel-b6765812f7da9feccc271e8e0b06f166e8054386.tar.bz2
jove-kernel-b6765812f7da9feccc271e8e0b06f166e8054386.zip
fix bugs with map using untyped obj
Diffstat (limited to 'sys')
-rw-r--r--sys/syscall.c2
-rw-r--r--sys/syscall_pagedir.c13
-rw-r--r--sys/syscall_untyped.c5
3 files changed, 17 insertions, 3 deletions
diff --git a/sys/syscall.c b/sys/syscall.c
index f41f3f6..457b820 100644
--- a/sys/syscall.c
+++ b/sys/syscall.c
@@ -42,7 +42,7 @@ static const syscall_handle_t s_syscall_handles[128] = {
[JOVE_OBJ_NONE] = NULL,
[JOVE_OBJ_UNTYPED] = _syscall_handle_untyped,
[JOVE_OBJ_OBJDIR] = _syscall_handle_objdir,
- [JOVE_OBJ_PAGEDIR] = _syscall_handle_generic,
+ [JOVE_OBJ_PAGEDIR] = _syscall_handle_pagedir,
[JOVE_OBJ_PROCESSOR] = _syscall_handle_generic,
[JOVE_OBJ_HWMEMORY] = _syscall_handle_generic,
[JOVE_OBJ_PROCESS] = _syscall_handle_generic,
diff --git a/sys/syscall_pagedir.c b/sys/syscall_pagedir.c
index f80da76..33acc87 100644
--- a/sys/syscall_pagedir.c
+++ b/sys/syscall_pagedir.c
@@ -44,7 +44,8 @@ s_syscall_pagedir_map(
return EALIGN;
}
if(untyped_data->limit != 0x1000) {
- kprintf("%s: Untyped object is not page sized.\n", __func__);
+ kprintf("%s: Untyped object is not page sized. (expected 0x1000 got 0x%X)\n", __func__,
+ untyped_data->limit);
obj_release(untyped_obj);
return EBADSIZE;
}
@@ -104,6 +105,10 @@ s_syscall_pagedir_map_frame(
struct syscall_pagedir_map *payload = payload_data;
sysret = pagedir_map_untyped_frame(target_obj, untyped_obj, payload->virtual_address, payload->flags);
+
+ if(sysret == 0)
+ obj_settype(untyped_obj, JOVE_OBJ_NONE);
+
obj_release(untyped_obj);
return sysret;
}
@@ -122,7 +127,11 @@ s_syscall_pagedir_map_table(
}
struct syscall_pagedir_map *payload = payload_data;
- sysret = pagedir_map_untyped_frame(target_obj, untyped_obj, payload->virtual_address, payload->flags);
+ sysret = pagedir_map_untyped_table(target_obj, untyped_obj, payload->virtual_address);
+
+ if(sysret == 0)
+ obj_settype(untyped_obj, JOVE_OBJ_NONE);
+
obj_release(untyped_obj);
return sysret;
}
diff --git a/sys/syscall_untyped.c b/sys/syscall_untyped.c
index 975faaa..a5659a6 100644
--- a/sys/syscall_untyped.c
+++ b/sys/syscall_untyped.c
@@ -21,6 +21,11 @@ s_syscall_untyped_split(
jove_owned_obj_t *dst_obj = objdir_getobj(objdir, payload->dest_path, payload->dest_pathlen);
CHECK_OBJTYPE(dst_obj, JOVE_OBJ_NONE, "Destination path is occupied!");
+ if(payload->bytes < JOVE_UNTYPED_MINSIZE) {
+ klogf("Destination untyped would be too small. (%X < %X)\n",
+ payload->bytes, JOVE_UNTYPED_MINSIZE);
+ return EBADARG;
+ }
return untyped_split(target_obj, dst_obj, payload->bytes);
}