summaryrefslogblamecommitdiffstats
path: root/include/api/syscall.h
blob: eb4235d23bda703c214f29dbb1dfadbfa966d0e8 (plain) (tree)






































                                
#ifndef _JOVE_API_SYSCALL_H
#define _JOVE_API_SYSCALL_H 1

#include <stdint.h>
#include <stddef.h>

typedef intmax_t syscall_id_t;

static int __syscall(void *data)
{
    intmax_t r;
    __asm__ volatile(" \
            movq %1, %%rdi; \
            syscall; \
            movq %%rax, %0"
            : "=r"(r)
            : "r"(data));
    return r;
}

enum {
    SC_DBG_LOGF = 0,
    SC_EXIT
};

struct sc_dbg_log
{
    syscall_id_t id;
    size_t w;
    const char *s;
};

struct sc_exit
{
    syscall_id_t id;
    int exit_code;
};

#endif