From 772717dc22e04b4d168d0f77bee6b6357118768c Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Tue, 19 Aug 2025 15:03:42 -0400 Subject: refactor KO_MEMORY_MAPPING invoke --- arch/x86_64/syscall/wrappers.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 arch/x86_64/syscall/wrappers.h (limited to 'arch/x86_64/syscall/wrappers.h') 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 -- cgit v1.2.1