diff options
Diffstat (limited to 'src/user')
-rw-r--r-- | src/user/app/main.c | 7 | ||||
-rw-r--r-- | src/user/lib/syscall.c | 46 | ||||
-rw-r--r-- | src/user/lib/syscall.c.awk | 4 |
3 files changed, 27 insertions, 30 deletions
diff --git a/src/user/app/main.c b/src/user/app/main.c index 527d29f..eff953a 100644 --- a/src/user/app/main.c +++ b/src/user/app/main.c @@ -16,15 +16,12 @@ void read_file(const char *path, size_t len); __attribute__((section(".text.startup"))) int main(void) { - _syscall(1, 2, 3, 4, 5); // allocate bss _syscall_memflag(&_bss_start, &_bss_end - &_bss_start, MEMFLAG_PRESENT); file_reopen(stdout, "/com1", 0); printf("preinit\n"); - _syscall_exit(0); // temporary - /* move everything provided by the kernel to /kdev */ MOUNT("/kdev/", fs_passthru(NULL)); if (!fork2_n_mount("/")) { @@ -66,7 +63,7 @@ int main(void) { printf("couldn't open /kdev/com1\n"); _syscall_exit(1); } - termcook(); + //termcook(); shell_loop(); _syscall_exit(1); @@ -82,7 +79,7 @@ int main(void) { printf("couldn't open /keyboard\n"); _syscall_exit(1); } - termcook(); + //termcook(); shell_loop(); _syscall_exit(1); diff --git a/src/user/lib/syscall.c b/src/user/lib/syscall.c index d86df19..23b82f7 100644 --- a/src/user/lib/syscall.c +++ b/src/user/lib/syscall.c @@ -5,60 +5,60 @@ #include <shared/syscalls.h> -_Noreturn void _syscall_exit(int ret) { +_Noreturn void _syscall_exit(long ret) { _syscall(_SYSCALL_EXIT, ret, 0, 0, 0); __builtin_unreachable(); } -int _syscall_await(void) { +long _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); +long _syscall_fork(int flags, handle_t __user *fs_front) { + return _syscall(_SYSCALL_FORK, (long)flags, (long)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); +handle_t _syscall_open(const char __user *path, long len, int flags) { + return (handle_t)_syscall(_SYSCALL_OPEN, (long)path, len, (long)flags, 0); } -int _syscall_mount(handle_t h, const char __user *path, int len) { - return _syscall(_SYSCALL_MOUNT, (int)h, (int)path, len, 0); +long _syscall_mount(handle_t h, const char __user *path, long len) { + return _syscall(_SYSCALL_MOUNT, (long)h, (long)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); + return (handle_t)_syscall(_SYSCALL_DUP, (long)from, (long)to, (long)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); +long _syscall_read(handle_t h, void __user *buf, size_t len, long offset) { + return _syscall(_SYSCALL_READ, (long)h, (long)buf, (long)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); +long _syscall_write(handle_t h, const void __user *buf, size_t len, long offset) { + return _syscall(_SYSCALL_WRITE, (long)h, (long)buf, (long)len, offset); } -int _syscall_close(handle_t h) { - return _syscall(_SYSCALL_CLOSE, (int)h, 0, 0, 0); +long _syscall_close(handle_t h) { + return _syscall(_SYSCALL_CLOSE, (long)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); +long _syscall_fs_wait(char __user *buf, long max_len, struct fs_wait_response __user *res) { + return _syscall(_SYSCALL_FS_WAIT, (long)buf, max_len, (long)res, 0); } -int _syscall_fs_respond(void __user *buf, int ret, int flags) { - return _syscall(_SYSCALL_FS_RESPOND, (int)buf, ret, flags, 0); +long _syscall_fs_respond(void __user *buf, long ret, int flags) { + return _syscall(_SYSCALL_FS_RESPOND, (long)buf, ret, (long)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); + return (void __user *)_syscall(_SYSCALL_MEMFLAG, (long)addr, (long)len, (long)flags, 0); } -int _syscall_pipe(handle_t __user user_ends[2], int flags) { - return _syscall(_SYSCALL_PIPE, (int)user_ends, flags, 0, 0); +long _syscall_pipe(handle_t __user user_ends[2], int flags) { + return _syscall(_SYSCALL_PIPE, (long)user_ends, (long)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); + return (void)_syscall(_SYSCALL_DEBUG_KLOG, (long)buf, (long)len, 0, 0); } diff --git a/src/user/lib/syscall.c.awk b/src/user/lib/syscall.c.awk index a8dd22b..91e4665 100644 --- a/src/user/lib/syscall.c.awk +++ b/src/user/lib/syscall.c.awk @@ -31,7 +31,7 @@ BEGIN { if (length(words) != 1) { var = words[length(words)]; sub(/\*/, "", var); - if (words[1] != "int") var = "(int)" var; + if (words[1] != "long") var = "(long)" var; } p[i] = var; } else { @@ -42,7 +42,7 @@ BEGIN { printf "\t"; if (!index($0, "_Noreturn")) { printf "return "; - if (rets != "int") printf "(%s)", rets; + if (rets != "long") printf "(%s)", rets; } printf "_syscall(%s, %s, %s, %s, %s);\n", toupper(name), p[1], p[2], p[3], p[4]; if (index($0, "_Noreturn")) print "\t__builtin_unreachable();"; |