diff options
Diffstat (limited to 'src/init')
-rw-r--r-- | src/init/main.c | 1 | ||||
-rw-r--r-- | src/init/syscalls.c | 13 | ||||
-rw-r--r-- | src/init/types.h | 2 |
3 files changed, 10 insertions, 6 deletions
diff --git a/src/init/main.c b/src/init/main.c index d24dda0..4f99c8b 100644 --- a/src/init/main.c +++ b/src/init/main.c @@ -1,3 +1,4 @@ +#include <init/types.h> #include <shared/magic.h> #include <shared/syscalls.h> #include <stdint.h> diff --git a/src/init/syscalls.c b/src/init/syscalls.c index 01dda51..8c747e4 100644 --- a/src/init/syscalls.c +++ b/src/init/syscalls.c @@ -1,9 +1,10 @@ // this file could probably just get generated by a script +#include <init/types.h> #include <shared/syscalls.h> int _syscall(int, int, int, int); -_Noreturn void _syscall_exit(const char *msg, size_t len) { +_Noreturn void _syscall_exit(const user_ptr msg, size_t len) { _syscall(_SYSCALL_EXIT, (int)msg, len, 0); __builtin_unreachable(); } @@ -12,23 +13,23 @@ int _syscall_fork(void) { return _syscall(_SYSCALL_FORK, 0, 0, 0); } -int _syscall_await(char *buf, int len) { +int _syscall_await(user_ptr buf, int len) { return _syscall(_SYSCALL_AWAIT, (int)buf, (int)len, 0); } -fd_t _syscall_fs_open(const char *path, int len) { +fd_t _syscall_fs_open(const user_ptr path, int len) { return _syscall(_SYSCALL_FS_OPEN, (int)path, len, 0); } -int _syscall_mount(const char *path, int len, fd_t fd) { +int _syscall_mount(const user_ptr path, int len, fd_t fd) { return _syscall(_SYSCALL_MOUNT, (int)path, len, fd); } -int _syscall_fd_read(fd_t fd, char *buf, int len) { +int _syscall_fd_read(fd_t fd, user_ptr buf, int len) { return _syscall(_SYSCALL_FD_READ, fd, (int)buf, len); } -int _syscall_fd_write(fd_t fd, char *buf, int len) { +int _syscall_fd_write(fd_t fd, user_ptr buf, int len) { return _syscall(_SYSCALL_FD_WRITE, fd, (int)buf, len); } diff --git a/src/init/types.h b/src/init/types.h new file mode 100644 index 0000000..d06d171 --- /dev/null +++ b/src/init/types.h @@ -0,0 +1,2 @@ +#pragma once +typedef char* user_ptr; |