diff options
Diffstat (limited to 'src/user/lib/syscall.c')
-rw-r--r-- | src/user/lib/syscall.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/user/lib/syscall.c b/src/user/lib/syscall.c new file mode 100644 index 0000000..d86df19 --- /dev/null +++ b/src/user/lib/syscall.c @@ -0,0 +1,64 @@ +/* generated by syscall.c.awk + * don't modify manually, instead run: + * make src/user/lib/syscall.c + */ +#include <shared/syscalls.h> + + +_Noreturn void _syscall_exit(int ret) { + _syscall(_SYSCALL_EXIT, ret, 0, 0, 0); + __builtin_unreachable(); +} + +int _syscall_await(void) { + return _syscall(_SYSCALL_AWAIT, 0, 0, 0, 0); +} + +int _syscall_fork(int flags, handle_t __user *fs_front) { + return _syscall(_SYSCALL_FORK, flags, (int)fs_front, 0, 0); +} + +handle_t _syscall_open(const char __user *path, int len, int flags) { + return (handle_t)_syscall(_SYSCALL_OPEN, (int)path, len, flags, 0); +} + +int _syscall_mount(handle_t h, const char __user *path, int len) { + return _syscall(_SYSCALL_MOUNT, (int)h, (int)path, len, 0); +} + +handle_t _syscall_dup(handle_t from, handle_t to, int flags) { + return (handle_t)_syscall(_SYSCALL_DUP, (int)from, (int)to, flags, 0); +} + +int _syscall_read(handle_t h, void __user *buf, size_t len, int offset) { + return _syscall(_SYSCALL_READ, (int)h, (int)buf, (int)len, offset); +} + +int _syscall_write(handle_t h, const void __user *buf, size_t len, int offset) { + return _syscall(_SYSCALL_WRITE, (int)h, (int)buf, (int)len, offset); +} + +int _syscall_close(handle_t h) { + return _syscall(_SYSCALL_CLOSE, (int)h, 0, 0, 0); +} + +int _syscall_fs_wait(char __user *buf, int max_len, struct fs_wait_response __user *res) { + return _syscall(_SYSCALL_FS_WAIT, (int)buf, max_len, (int)res, 0); +} + +int _syscall_fs_respond(void __user *buf, int ret, int flags) { + return _syscall(_SYSCALL_FS_RESPOND, (int)buf, ret, flags, 0); +} + +void __user *_syscall_memflag(void __user *addr, size_t len, int flags) { + return (void __user *)_syscall(_SYSCALL_MEMFLAG, (int)addr, (int)len, flags, 0); +} + +int _syscall_pipe(handle_t __user user_ends[2], int flags) { + return _syscall(_SYSCALL_PIPE, (int)user_ends, flags, 0, 0); +} + +void _syscall_debug_klog(const void __user *buf, size_t len) { + return (void)_syscall(_SYSCALL_DEBUG_KLOG, (int)buf, (int)len, 0, 0); +} + |