diff options
Diffstat (limited to 'arch/x86_64/syscall/wrappers.h')
-rw-r--r-- | arch/x86_64/syscall/wrappers.h | 14 |
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 |