diff options
Diffstat (limited to 'src/kernel')
-rw-r--r-- | src/kernel/arch/amd64/sysenter.c | 2 | ||||
-rw-r--r-- | src/kernel/execbuf.c | 6 | ||||
-rw-r--r-- | src/kernel/syscalls.c | 10 |
3 files changed, 11 insertions, 7 deletions
diff --git a/src/kernel/arch/amd64/sysenter.c b/src/kernel/arch/amd64/sysenter.c index b5cec73..459247f 100644 --- a/src/kernel/arch/amd64/sysenter.c +++ b/src/kernel/arch/amd64/sysenter.c @@ -13,6 +13,6 @@ _Noreturn void sysexit(struct registers regs) { _Noreturn void sysenter_stage2(void) { struct registers *regs = &process_current->regs; *regs = _sysexit_regs; - _syscall(regs->rdi, regs->rsi, regs->rdx, regs->r10, regs->r8); + _syscall(regs->rdi, regs->rsi, regs->rdx, regs->r10, regs->r8, regs->r9); process_switch_any(); } diff --git a/src/kernel/execbuf.c b/src/kernel/execbuf.c index 682566e..8ab0268 100644 --- a/src/kernel/execbuf.c +++ b/src/kernel/execbuf.c @@ -19,7 +19,7 @@ static void try_fetch(struct process *proc, uint64_t *buf, size_t amt) { } _Noreturn void execbuf_run(struct process *proc) { - uint64_t buf[5]; + uint64_t buf[6]; assert(proc == process_current); // idiotic, but needed because of _syscall. assert(proc->state == PS_RUNNING); @@ -28,8 +28,8 @@ _Noreturn void execbuf_run(struct process *proc) { try_fetch(proc, buf, 1); switch (buf[0]) { case EXECBUF_SYSCALL: - try_fetch(proc, buf, 5); - _syscall(buf[0], buf[1], buf[2], buf[3], buf[4]); + try_fetch(proc, buf, 6); + _syscall(buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]); process_switch_any(); case EXECBUF_JMP: diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index 9c4e2fa..0dec4c5 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -1,3 +1,4 @@ +#include <camellia/errno.h> #include <camellia/flags.h> #include <camellia/syscalls.h> #include <kernel/arch/generic.h> @@ -229,9 +230,11 @@ long _syscall_read(handle_t handle_num, void __user *buf, size_t len, long offse return -1; // dummy } -long _syscall_write(handle_t handle_num, const void __user *buf, size_t len, long offset) { +long _syscall_write(handle_t handle_num, const void __user *buf, size_t len, long offset, int flags) { struct handle *h = process_handle_get(process_current, handle_num); if (!h) SYSCALL_RETURN(-1); + if (flags != 0) + SYSCALL_RETURN(-ENOSYS); switch (h->type) { case HANDLE_FILE: vfsreq_create((struct vfs_request) { @@ -244,6 +247,7 @@ long _syscall_write(handle_t handle_num, const void __user *buf, size_t len, lon .offset = offset, .caller = process_current, .backend = h->backend, + .flags = flags }); break; case HANDLE_PIPE: @@ -387,7 +391,7 @@ void _syscall_debug_klog(const void __user *buf, size_t len) { // kprintf("[klog] %x\t%s\n", process_current->id, kbuf); } -long _syscall(long num, long a, long b, long c, long d) { +long _syscall(long num, long a, long b, long c, long d, long e) { /* note: this isn't the only place where syscalls get called from! * see execbuf */ switch (num) { @@ -413,7 +417,7 @@ long _syscall(long num, long a, long b, long c, long d) { _syscall_read(a, (userptr_t)b, c, d); break; case _SYSCALL_WRITE: - _syscall_write(a, (userptr_t)b, c, d); + _syscall_write(a, (userptr_t)b, c, d, e); break; case _SYSCALL_CLOSE: _syscall_close(a); |