summaryrefslogtreecommitdiffstats
path: root/abi/syscall.h
blob: 95cd4a50303858d583c496d3b004b25381785cf1 (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
#ifndef JOVE_ABI_SYSCALL_H
#define JOVE_ABI_SYSCALL_H 1

typedef struct syscall {
    int id;
} syscall_t;

struct syscall_log {
    syscall_t syscall;
    const char *message;
};

enum
{
    SYSCALL_LOG = 0,
    SYSCALL_COUNT
};

#define _SYSCALL(data) __asm__ volatile("movq %0, %%rdi\nsyscall":: "r"(data))

void _syscall_log(const char *message) {
    struct syscall_log syscall_data = {
        .syscall = (syscall_t){ .id = SYSCALL_LOG },
        .message = message
    };
    _SYSCALL(&syscall_data);
}

#endif