diff options
Diffstat (limited to 'src/user')
-rw-r--r-- | src/user/lib/syscall.c | 4 | ||||
-rw-r--r-- | src/user/tests/main.c | 15 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/user/lib/syscall.c b/src/user/lib/syscall.c index 23b82f7..e105638 100644 --- a/src/user/lib/syscall.c +++ b/src/user/lib/syscall.c @@ -58,6 +58,10 @@ long _syscall_pipe(handle_t __user user_ends[2], int flags) { return _syscall(_SYSCALL_PIPE, (long)user_ends, (long)flags, 0, 0); } +long _syscall_execbuf(void __user *buf, size_t len) { + return _syscall(_SYSCALL_EXECBUF, (long)buf, (long)len, 0, 0); +} + void _syscall_debug_klog(const void __user *buf, size_t len) { return (void)_syscall(_SYSCALL_DEBUG_KLOG, (long)buf, (long)len, 0, 0); } diff --git a/src/user/tests/main.c b/src/user/tests/main.c index ab6b4a8..97714e7 100644 --- a/src/user/tests/main.c +++ b/src/user/tests/main.c @@ -1,5 +1,6 @@ #define TEST_MACROS #include <shared/errno.h> +#include <shared/execbuf.h> #include <shared/flags.h> #include <shared/syscalls.h> #include <user/lib/stdlib.h> @@ -221,6 +222,19 @@ static void test_efault(void) { close(h); } +static void test_execbuf(void) { + // not really a test, TODO + const char str1[] = "test_execbuf: string 1\n"; + const char str2[] = "test_execbuf: and 2\n"; + uint64_t buf[] = { + EXECBUF_SYSCALL, _SYSCALL_WRITE, 1, (uintptr_t)str1, sizeof(str1) - 1, -1, + EXECBUF_SYSCALL, _SYSCALL_WRITE, 1, (uintptr_t)str2, sizeof(str2) - 1, -1, + EXECBUF_SYSCALL, _SYSCALL_EXIT, 0, 0, 0, 0, + }; + _syscall_execbuf(buf, sizeof buf); + test_fail(); +} + static void test_misc(void) { assert(_syscall(~0, 0, 0, 0, 0) < 0); /* try making an invalid syscall */ } @@ -237,5 +251,6 @@ void test_all(void) { run_forked(test_pipe); run_forked(test_semaphore); run_forked(test_efault); + run_forked(test_execbuf); run_forked(test_misc); } |