summaryrefslogtreecommitdiffstats
path: root/lib/libjove/arch/x86_64/invoke-pagemap.c
blob: e3f3dffda16fb5ac69dbff84708985f2b3f49dc0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "arch/x86_64/syscall.h"
#include <arch/x86_64/object-pagemap.h>
#include <kernel/syscall.h>
#include <kernel/arch/x86_64/syscall.h>
#include <object.h>
#include <path-fromobj.h>
#include <syscall.h>
#include <jove/jove.h>

int
_syscall_invoke_mapping_exists(KernelObjectPageMap *map, uint8_t depth, uint16_t *path)
{
    uint8_t *syscallData = _syscall_message_ptr;
    int syscall_at = 0;

    SYSCALL_PAYLOAD_PUTOBJ(syscallData, syscall_at, map);
    SYSCALL_PAYLOAD_PUTL(syscallData, syscall_at, INVOKE_MAPPING_EXISTS, uint8_t);
    SYSCALL_PAYLOAD_PUTPML(syscallData, syscall_at, depth, path);

    return _syscall_invoke();
}

int
_syscall_invoke_mapping_map(KernelObjectPageMap *map, uint8_t depth, uint16_t *path, KernelObjectUntyped *untyped)
{
    uint8_t *syscallData = _syscall_message_ptr;
    int syscall_at = 0;

    SYSCALL_PAYLOAD_PUTOBJ(syscallData, syscall_at, map);
    SYSCALL_PAYLOAD_PUTL(syscallData, syscall_at, INVOKE_MAPPING_MAP, uint8_t);
    SYSCALL_PAYLOAD_PUTPML(syscallData, syscall_at, depth, path);
    SYSCALL_PAYLOAD_PUTOBJ(syscallData, syscall_at, untyped);

    return _syscall_invoke();
}

int
_syscall_invoke_mapping_unmap(KernelObjectPageMap *map, uint8_t depth, uint16_t *path, KernelObjectUntyped *dest)
{
    uint8_t *syscallData = _syscall_message_ptr;
    int syscall_at = 0;

    SYSCALL_PAYLOAD_PUTOBJ(syscallData, syscall_at, map);
    SYSCALL_PAYLOAD_PUTL(syscallData, syscall_at, INVOKE_MAPPING_UNMAP, uint8_t);
    SYSCALL_PAYLOAD_PUTPML(syscallData, syscall_at, depth, path);
    SYSCALL_PAYLOAD_PUTOBJ(syscallData, syscall_at, dest);

    return _syscall_invoke();
}