12#define _SYSCALL0(retType, num) \
14 register retType ret asm("rax"); \
15 asm volatile("syscall\n" : "=a"(ret) : "a"(num) : "rcx", "r11", "memory"); \
19#define _SYSCALL1(retType, num, type1, arg1) \
21 register retType ret asm("rax"); \
22 register type1 _a1 asm("rdi") = (arg1); \
23 asm volatile("syscall\n" : "=a"(ret) : "a"(num), "r"(_a1) : "rcx", "r11", "memory"); \
27#define _SYSCALL2(retType, num, type1, arg1, type2, arg2) \
29 register retType ret asm("rax"); \
30 register type1 _a1 asm("rdi") = (arg1); \
31 register type2 _a2 asm("rsi") = (arg2); \
32 asm volatile("syscall\n" : "=a"(ret) : "a"(num), "r"(_a1), "r"(_a2) : "rcx", "r11", "memory"); \
36#define _SYSCALL3(retType, num, type1, arg1, type2, arg2, type3, arg3) \
38 register retType ret asm("rax"); \
39 register type1 _a1 asm("rdi") = (arg1); \
40 register type2 _a2 asm("rsi") = (arg2); \
41 register type3 _a3 asm("rdx") = (arg3); \
42 asm volatile("syscall\n" : "=a"(ret) : "a"(num), "r"(_a1), "r"(_a2), "r"(_a3) : "rcx", "r11", "memory"); \
46#define _SYSCALL4(retType, num, type1, arg1, type2, arg2, type3, arg3, type4, arg4) \
48 register retType ret asm("rax"); \
49 register type1 _a1 asm("rdi") = (arg1); \
50 register type2 _a2 asm("rsi") = (arg2); \
51 register type3 _a3 asm("rdx") = (arg3); \
52 register type4 _a4 asm("r10") = (arg4); \
53 asm volatile("syscall\n" \
55 : "a"(num), "r"(_a1), "r"(_a2), "r"(_a3), "r"(_a4) \
56 : "rcx", "r11", "memory"); \
60#define _SYSCALL5(retType, num, type1, arg1, type2, arg2, type3, arg3, type4, arg4, type5, arg5) \
62 register retType ret asm("rax"); \
63 register type1 _a1 asm("rdi") = (arg1); \
64 register type2 _a2 asm("rsi") = (arg2); \
65 register type3 _a3 asm("rdx") = (arg3); \
66 register type4 _a4 asm("r10") = (arg4); \
67 register type5 _a5 asm("r8") = (arg5); \
68 asm volatile("syscall\n" \
70 : "a"(num), "r"(_a1), "r"(_a2), "r"(_a3), "r"(_a4), "r"(_a5) \
71 : "rcx", "r11", "memory"); \
75#define _SYSCALL6(retType, num, type1, arg1, type2, arg2, type3, arg3, type4, arg4, type5, arg5, type6, arg6) \
77 register retType ret asm("rax"); \
78 register type1 _a1 asm("rdi") = (arg1); \
79 register type2 _a2 asm("rsi") = (arg2); \
80 register type3 _a3 asm("rdx") = (arg3); \
81 register type4 _a4 asm("r10") = (arg4); \
82 register type5 _a5 asm("r8") = (arg5); \
83 register type6 _a6 asm("r9") = (arg6); \
84 asm volatile("syscall\n" \
86 : "a"(num), "r"(_a1), "r"(_a2), "r"(_a3), "r"(_a4), "r"(_a5), "r"(_a6) \
87 : "rcx", "r11", "memory"); \
#define SYS_THREAD_CREATE
uint8_t seek_origin_t
Type for the seek() origin argument.
futex_op_t
Futex operation enum.
prot_t
Memory protection flags.
__UINT64_TYPE__ tid_t
Thread Identifier.
__UINT64_TYPE__ fd_t
A file descriptor.
__UINT64_TYPE__ pid_t
Process Identifier.
__UINT64_TYPE__ clock_t
A nanosecond time.
EFI_PHYSICAL_ADDRESS buffer
static fd_t _syscall_dup2(fd_t oldFd, fd_t newFd)
static uint64_t _syscall_share(key_t *key, fd_t fd, clock_t timeout)
#define _SYSCALL4(retType, num, type1, arg1, type2, arg2, type3, arg3, type4, arg4)
static pid_t _syscall_getpid(void)
#define _SYSCALL3(retType, num, type1, arg1, type2, arg2, type3, arg3)
#define _SYSCALL1(retType, num, type1, arg1)
static uint64_t _syscall_mprotect(void *address, uint64_t length, prot_t prot)
static uint64_t _syscall_remove(const char *path)
#define _SYSCALL0(retType, num)
static uint64_t _syscall_getdents(fd_t fd, dirent_t *buffer, uint64_t count)
static _NORETURN void _syscall_process_exit(uint64_t status)
static uint64_t _syscall_link(const char *oldPath, const char *newPath)
static _NORETURN void _syscall_thread_exit(void)
static tid_t _syscall_thread_create(void *entry, void *arg)
static fd_t _syscall_open(const char *path)
static clock_t _syscall_uptime(void)
static uint64_t _syscall_chdir(const char *path)
static uint64_t _syscall_seek(fd_t fd, int64_t offset, seek_origin_t origin)
static uint64_t _syscall_munmap(void *address, uint64_t length)
static uint64_t _syscall_nanosleep(clock_t nanoseconds)
static uint64_t _syscall_bind(fd_t source, const char *mountpoint)
static tid_t _syscall_gettid(void)
#define _SYSCALL2(retType, num, type1, arg1, type2, arg2)
static uint64_t _syscall_open2(const char *path, fd_t fds[2])
static fd_t _syscall_dup(fd_t oldFd)
static void * _syscall_mmap(fd_t fd, void *address, uint64_t length, prot_t prot)
static uint64_t _syscall_close(fd_t fd)
static uint64_t _syscall_ioctl(fd_t fd, uint64_t request, void *argp, uint64_t size)
static fd_t _syscall_claim(key_t *key)
static uint64_t _syscall_stat(const char *path, stat_t *info)
static void _syscall_yield(void)
static uint64_t _syscall_write(fd_t fd, const void *buffer, uint64_t count)
static errno_t _syscall_errno(void)
static uint64_t _syscall_poll(pollfd_t *fds, uint64_t amount, clock_t timeout)
static uint64_t _syscall_read(fd_t fd, void *buffer, uint64_t count)
static time_t _syscall_unix_epoch(void)
static pid_t _syscall_spawn(const char **argv, const spawn_fd_t *fds, const char *cwd, spawn_attr_t *attr)
static uint64_t _syscall_futex(atomic_uint64_t *addr, uint64_t val, futex_op_t op, clock_t timeout)
Poll file descriptor structure.
Stucture used to duplicate fds in spawn().
long long unsigned time_t