13#include <sys/select.h>
38 pr_dinfo2(syscall,
"vfs_openat(dirfd=%d, file_path='%s', flags=%x)", (
fd_t) arg1, (
const char *) arg2, (
open_flags) arg3);
44 pr_dinfo2(syscall,
"vfs_fstatat(dirfd=%d, file_path='%s', stat_buf=%p, flags=%x)", (
fd_t) arg1, (
const char *) arg2, (
void *) arg3, (
fstatat_flags) arg4);
50 pr_dinfo2(syscall,
"io_read(fd=%d, buffer=%p, size=%zu)", (
fd_t) arg1, (
void *) arg2, (
size_t) arg3);
56 pr_dinfo2(syscall,
"io_write(fd=%d, buffer=%p, size=%zu)", (
fd_t) arg1, (
void *) arg2, (
size_t) arg3);
69 impl_syscall_exit((
u32) arg1);
98 pr_dinfo2(syscall,
"spawn(file_path='%s', argv=%p, envp=%p)", (
const char *) arg1, (
void *) arg2, (
void *) arg3);
104 pr_dinfo2(syscall,
"create_thread(name='%s', entry=%p, arg=%p, stack_size=%zu, stack=%p)", (
const char *) arg1, (
void *) arg2, (
void *) arg3, (
size_t) arg4, (
void *) arg5);
117 impl_syscall_thread_exit();
128 pr_dinfo2(syscall,
"futex_wait(futex=%p, val=%u)", (
void *) arg1, (
u32) arg2);
134 pr_dinfo2(syscall,
"futex_wake(futex=%p, count=%zu)", (
void *) arg1, (
size_t) arg2);
140 pr_dinfo2(syscall,
"ipc_create(name='%s', max_pending_connections=%zu)", (
const char *) arg1, (
size_t) arg2);
152 pr_dinfo2(syscall,
"ipc_connect(name='%s', buffer_size=%zu)", (
const char *) arg1, (
size_t) arg2);
158 pr_dinfo2(syscall,
"arch_syscall(nr=%llu, arg1=%llu, arg2=%llu, arg3=%llu, arg4=%llu)", (
u64) arg1, (
u64) arg2, (
u64) arg3, (
u64) arg4, (
u64) arg5);
164 pr_dinfo2(syscall,
"vfs_mount(device='%s', mount_point='%s', fs_type='%s', options='%s')", (
const char *) arg1, (
const char *) arg2, (
const char *) arg3, (
const char *) arg4);
170 pr_dinfo2(syscall,
"vfs_readlinkat(dirfd=%d, path='%s', buf=%p, buf_size=%zu)", (
fd_t) arg1, (
const char *) arg2, (
void *) arg3, (
size_t) arg4);
176 pr_dinfo2(syscall,
"vfs_unlinkat(dirfd=%d, path='%s')", (
fd_t) arg1, (
const char *) arg2);
182 pr_dinfo2(syscall,
"vfs_symlink(link_path='%s', target='%s')", (
const char *) arg1, (
const char *) arg2);
188 pr_dinfo2(syscall,
"vfs_mkdir(path='%s')", (
const char *) arg1);
194 pr_dinfo2(syscall,
"vfs_list_dir(fd=%d, buffer=%p, buffer_size=%zu)", (
fd_t) arg1, (
void *) arg2, (
size_t) arg3);
200 pr_dinfo2(syscall,
"fd_manipulate(fd=%d, cmd=%llu, arg=%p)", (
fd_t) arg1, (
u64) arg2, (
void *) arg3);
212 pr_dinfo2(syscall,
"mmap_file(hint_addr=" PTR_FMT ", size=%zu, perm=%d, flags=%d, fd=%d, offset=%zd)", (
ptr_t) arg1, (
size_t) arg2, (
mem_perm_t) arg3, (
mmap_flags_t) arg4, (
fd_t) arg5, (
off_t) arg6);
218 pr_dinfo2(syscall,
"wait_for_process(pid=%d, exit_code=%p, flags=%u)", (
pid_t) arg1, (
void *) arg2, (
u32) arg3);
224 pr_dinfo2(syscall,
"munmap(addr=%p, size=%zu)", (
void *) arg1, (
size_t) arg2);
230 pr_dinfo2(syscall,
"vfs_chdirat(dirfd=%d, path='%s')", (
fd_t) arg1, (
const char *) arg2);
236 pr_dinfo2(syscall,
"vfs_getcwd(buf=%p, buf_size=%zu)", (
void *) arg1, (
size_t) arg2);
254 pr_dinfo2(syscall,
"signal_register(signum=%d, action=%p)", (
signal_t) arg1, (
void *) arg2);
272 pr_dinfo2(syscall,
"poweroff(reboot=%d, magic=%u)", (
bool) arg1, (
u32) arg2);
278 pr_dinfo2(syscall,
"signal_return(sp=%p)", (
void *) arg1);
279 impl_syscall_signal_return((
void *) arg1);
284 pr_dinfo2(syscall,
"vm_protect(addr=%p, size=%zu, perm=%d)", (
void *) arg1, (
size_t) arg2, (
mem_perm_t) arg3);
290 pr_dinfo2(syscall,
"io_poll(fds=%p, nfds=%ld, timeout=%d)", (
void *) arg1, (nfds_t) arg2, (
int) arg3);
296 pr_dinfo2(syscall,
"io_pselect(nfds=%d, readfds=%p, writefds=%p, exceptfds=%p, timeout=%p, sigmask=%p)", (
int) arg1, (
void *) arg2, (
void *) arg3, (
void *) arg4, (
void *) arg5, (
void *) arg6);
297 ret = (
reg_t)
impl_syscall_io_pselect((
int) arg1, (fd_set *) arg2, (fd_set *) arg3, (fd_set *) arg4, (
const struct timespec *) arg5, (
const sigset_t *) arg6);
302 pr_dinfo2(syscall,
"execveat(dirfd=%d, file_path='%s', argv=%p, envp=%p, flags=%u)", (
fd_t) arg1, (
const char *) arg2, (
void *) arg3, (
void *) arg4, (
u32) arg5);
308 pr_dinfo2(syscall,
"clock_msleep(ms=%llu)", (
u64) arg1);
326 pr_dinfo2(syscall,
"dmabuf_alloc(n_pages=%zu, out_paddr=%p, out_vaddr=%p)", (
size_t) arg1, (
void *) arg2, (
void *) arg3);
338 pr_dinfo2(syscall,
"dmabuf_share(buf=%p, bufsize=%zu, out_paddr=%p)", (
void *) arg1, (
size_t) arg2, (
void *) arg3);
344 pr_dinfo2(syscall,
"dmabuf_unshare(paddr=" PTR_FMT ", size=%zu, vaddr=%p)", (
ptr_t) arg1, (
size_t) arg2, (
void *) arg3);
350 pr_dinfo2(syscall,
"pipe(out_read_fd=%p, out_write_fd=%p, flags=%d)", (
void *) arg1, (
void *) arg2, (
fd_flags_t) arg3);
356 pr_dinfo2(syscall,
"io_readv(fd=%d, iov=%p, iov_count=%d)", (
fd_t) arg1, (
void *) arg2, (
int) arg3);
362 pr_dinfo2(syscall,
"vfs_unmount(mount_point='%s')", (
const char *) arg1);
368 pr_dinfo2(syscall,
"clock_gettimeofday(tv=%p)", (
void *) arg1);
374 pr_dinfo2(syscall,
"thread_setname(tid=%d, name='%s')", (
tid_t) arg1, (
const char *) arg2);
380 pr_dinfo2(syscall,
"thread_getname(tid=%d, buf=%p, buf_size=%zu)", (
tid_t) arg1, (
void *) arg2, (
size_t) arg3);
386 pr_dinfo2(syscall,
"vfs_fchmodat(dirfd=%d, path='%s', mode=%d, flags=%d)", (
fd_t) arg1, (
const char *) arg2, (
int) arg3, (
int) arg4);
392 pr_dinfo2(syscall,
"io_pread(fd=%d, buf=%p, count=%zu, offset=%zd)", (
fd_t) arg1, (
void *) arg2, (
size_t) arg3, (
off_t) arg4);
398 pr_dinfo2(syscall,
"memfd_create(name='%s', flags=%u)", (
const char *) arg1, (
u32) arg2);
404 pr_dinfo2(syscall,
"signal_mask_op(how=%d, set=%p, oldset=%p)", (
int) arg1, (
void *) arg2, (
void *) arg3);
410 pr_dinfo2(syscall,
"vfs_fsync(fd=%d, data_only=%d)", (
fd_t) arg1, (
bool) arg2);
fd_t impl_syscall_ipc_connect(const char *name, size_t buffer_size)
bool impl_syscall_wait_for_thread(tid_t tid)
long impl_syscall_io_pread(fd_t fd, void *buf, size_t count, off_t offset)
size_t impl_syscall_io_read(fd_t fd, void *buffer, size_t size)
void * impl_syscall_mmap_anonymous(ptr_t hint_addr, size_t size, mem_perm_t perm, mmap_flags_t flags)
long impl_syscall_clock_gettimeofday(struct timespec *tv)
pid_t impl_syscall_get_parent_pid(void)
off_t impl_syscall_io_seek(fd_t fd, off_t offset, io_seek_whence_t whence)
bool impl_syscall_munmap(void *addr, size_t size)
void * impl_syscall_mmap_file(ptr_t hint_addr, size_t size, mem_perm_t perm, mmap_flags_t flags, fd_t fd, off_t offset)
fd_t impl_syscall_memfd_create(const char *name, u32 flags)
long impl_syscall_vfs_fsync(fd_t fd, bool data_only)
bool impl_syscall_dmabuf_free(ptr_t vaddr, ptr_t paddr)
size_t impl_syscall_vfs_list_dir(fd_t fd, char *buffer, size_t buffer_size)
bool impl_syscall_dmabuf_unshare(ptr_t paddr, size_t size, void *vaddr)
bool impl_syscall_signal_register(signal_t signum, const sigaction_t *action)
pid_t impl_syscall_fork(void)
pid_t impl_syscall_wait_for_process(pid_t pid, u32 *exit_code, u32 flags)
off_t impl_syscall_io_tell(fd_t fd)
long impl_syscall_vfs_chdirat(fd_t dirfd, const char *path)
fd_t impl_syscall_io_dup(fd_t fd)
int impl_syscall_io_poll(struct pollfd *fds, nfds_t nfds, int timeout)
pid_t impl_syscall_get_pid(void)
long impl_syscall_clock_msleep(u64 ms)
u64 impl_syscall_arch_syscall(u64 nr, u64 arg1, u64 arg2, u64 arg3, u64 arg4)
bool impl_syscall_vm_protect(void *addr, size_t size, mem_perm_t perm)
tid_t impl_syscall_get_tid(void)
long impl_syscall_vfs_mount(const char *device, const char *mount_point, const char *fs_type, const char *options)
long impl_syscall_vfs_mkdir(const char *path)
long impl_syscall_vfs_unmount(const char *mount_point)
long impl_syscall_vfs_fchmodat(fd_t dirfd, const char *path, int mode, int flags)
long impl_syscall_thread_setname(tid_t tid, const char *name)
size_t impl_syscall_io_write(fd_t fd, const void *buffer, size_t size)
pid_t impl_syscall_spawn(const char *file_path, const char *const *argv, const char *const *envp)
fd_t impl_syscall_io_dup2(fd_t old_fd, fd_t new_fd)
long impl_syscall_signal_mask_op(int how, const sigset_t *set, sigset_t *oldset)
ssize_t impl_syscall_thread_getname(tid_t tid, char *buf, size_t buf_size)
long impl_syscall_execveat(fd_t dirfd, const char *file_path, const char *const *argv, const char *const *envp, u32 flags)
fd_t impl_syscall_vfs_openat(fd_t dirfd, const char *file_path, open_flags flags)
long impl_syscall_fd_manipulate(fd_t fd, u64 cmd, void *arg)
bool impl_syscall_io_close(fd_t fd)
long impl_syscall_vfs_symlink(const char *link_path, const char *target)
void impl_syscall_poweroff(bool reboot, u32 magic)
int impl_syscall_io_pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timespec *timeout, const sigset_t *sigmask)
bool impl_syscall_futex_wait(futex_word_t *futex, u32 val)
long impl_syscall_vfs_fstatat(fd_t dirfd, const char *file_path, file_stat_t *stat_buf, fstatat_flags flags)
long impl_syscall_vfs_unlinkat(fd_t dirfd, const char *path)
bool impl_syscall_futex_wake(futex_word_t *futex, size_t count)
bool impl_syscall_dmabuf_alloc(size_t n_pages, ptr_t *out_paddr, ptr_t *out_vaddr)
long impl_syscall_pipe(fd_t *out_read_fd, fd_t *out_write_fd, fd_flags_t flags)
void impl_syscall_yield_cpu(void)
long impl_syscall_signal_process(pid_t pid, signal_t signum)
fd_t impl_syscall_ipc_accept(fd_t fd)
ssize_t impl_syscall_io_readv(fd_t fd, const struct iovec *iov, int iov_count)
ssize_t impl_syscall_vfs_readlinkat(fd_t dirfd, const char *path, char *buf, size_t buf_size)
tid_t impl_syscall_create_thread(const char *name, thread_entry_t entry, void *arg, size_t stack_size, void *stack)
long impl_syscall_signal_thread(tid_t tid, signal_t signum)
bool impl_syscall_dmabuf_share(void *buf, size_t bufsize, ptr_t *out_paddr)
fd_t impl_syscall_ipc_create(const char *name, size_t max_pending_connections)
ssize_t impl_syscall_vfs_getcwd(char *buf, size_t buf_size)
should_inline reg_t dispatch_syscall(const reg_t number, reg_t arg1, reg_t arg2, reg_t arg3, reg_t arg4, reg_t arg5, reg_t arg6)
#define SYSCALL_dmabuf_alloc
#define SYSCALL_vfs_mount
#define SYSCALL_mmap_file
#define SYSCALL_dmabuf_share
#define SYSCALL_vfs_fsync
#define SYSCALL_fd_manipulate
#define SYSCALL_yield_cpu
#define SYSCALL_vm_protect
#define SYSCALL_signal_register
#define SYSCALL_vfs_unlinkat
#define SYSCALL_ipc_accept
#define SYSCALL_wait_for_thread
#define SYSCALL_wait_for_process
#define SYSCALL_vfs_readlinkat
#define SYSCALL_thread_getname
#define SYSCALL_memfd_create
#define SYSCALL_futex_wake
#define SYSCALL_arch_syscall
#define SYSCALL_signal_thread
#define SYSCALL_clock_msleep
#define SYSCALL_dmabuf_unshare
#define SYSCALL_vfs_unmount
#define SYSCALL_ipc_connect
#define SYSCALL_vfs_fstatat
#define SYSCALL_thread_exit
#define SYSCALL_thread_setname
#define SYSCALL_mmap_anonymous
#define SYSCALL_signal_mask_op
#define SYSCALL_signal_process
#define SYSCALL_vfs_list_dir
#define SYSCALL_futex_wait
#define SYSCALL_clock_gettimeofday
#define SYSCALL_vfs_fchmodat
#define SYSCALL_io_pselect
#define SYSCALL_dmabuf_free
#define SYSCALL_create_thread
#define SYSCALL_vfs_openat
#define SYSCALL_vfs_mkdir
#define SYSCALL_ipc_create
#define SYSCALL_vfs_getcwd
#define SYSCALL_vfs_chdirat
#define SYSCALL_get_parent_pid
#define SYSCALL_signal_return
#define SYSCALL_vfs_symlink
#define pr_dcont(feat, fmt,...)
#define pr_dinfo2(feat, fmt,...)
void(* thread_entry_t)(void *arg)