From 7d21dabdddcc55a76f9f5633a61c8fb34b2d99d8 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sat, 23 Jul 2022 20:08:57 +0200 Subject: kernel: switch processes after execbuf_syscall --- src/kernel/execbuf.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'src/kernel/execbuf.c') diff --git a/src/kernel/execbuf.c b/src/kernel/execbuf.c index b96188d..1e4d8ed 100644 --- a/src/kernel/execbuf.c +++ b/src/kernel/execbuf.c @@ -20,23 +20,24 @@ static void try_fetch(struct process *proc, uint64_t *buf, size_t amt) { _Noreturn void execbuf_run(struct process *proc) { uint64_t buf[5]; + assert(proc == process_current); // idiotic, but needed because of _syscall. assert(proc->state == PS_RUNNING); assert(proc->execbuf.buf); - for (;;) { - 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]); - break; - case EXECBUF_JMP: - try_fetch(proc, buf, 1); - proc->regs.rcx = buf[0]; - break; - default: - halt(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]); + process_switch_any(); + + case EXECBUF_JMP: + try_fetch(proc, buf, 1); + proc->regs.rcx = buf[0]; + execbuf_run(proc); + + default: + halt(proc); } } -- cgit v1.2.3