summaryrefslogtreecommitdiffstats
path: root/arch/x86_64/syscall/wrappers.h
blob: a6fdf88040848f7abf673520c825414be0ab767e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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