summaryrefslogtreecommitdiffstats
path: root/arch/x86_64/syscall/wrappers.h
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2025-08-19 15:03:42 -0400
committerJon Santmyer <jon@jonsantmyer.com>2025-08-19 15:03:42 -0400
commit772717dc22e04b4d168d0f77bee6b6357118768c (patch)
tree9da95703c3376091904e295930104b51c280008d /arch/x86_64/syscall/wrappers.h
parent7ee9347560768641096df68c545ac085a20233e4 (diff)
downloadjove-kernel-772717dc22e04b4d168d0f77bee6b6357118768c.tar.gz
jove-kernel-772717dc22e04b4d168d0f77bee6b6357118768c.tar.bz2
jove-kernel-772717dc22e04b4d168d0f77bee6b6357118768c.zip
refactor KO_MEMORY_MAPPING invokemain
Diffstat (limited to 'arch/x86_64/syscall/wrappers.h')
-rw-r--r--arch/x86_64/syscall/wrappers.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/x86_64/syscall/wrappers.h b/arch/x86_64/syscall/wrappers.h
new file mode 100644
index 0000000..a6fdf88
--- /dev/null
+++ b/arch/x86_64/syscall/wrappers.h
@@ -0,0 +1,14 @@
+#ifndef _JOVE_ARCH_x86_64_SYSCALL_WRAPPERS_H
+#define _JOVE_ARCH_x86_64_SYSCALL_WRAPPERS_H 1
+
+#include "arch/x86_64/page-mapping.h"
+#include "syscall/handles.h"
+
+#define SYSCALL_PAYLOAD_TAKEPML(payload, at, pml4, depth, pml) \
+ SYSCALL_PAYLOAD_TAKEL(payload, at, depth, uint8_t); \
+ if(((depth + 1) * sizeof(uint16_t)) + at >= KO_MESSAGE_BYTES) return KE_BADMSG; \
+ if(depth == 0 && *(uint16_t*)&payload[at] > 255) return KE_OOB; \
+ pml = page_mapping_traverse(pml4, depth, (uint16_t*)&payload[at]); \
+ at += (depth + 1) * sizeof(uint16_t)
+
+#endif