diff options
author | dzwdz | 2022-07-23 20:08:57 +0200 |
---|---|---|
committer | dzwdz | 2022-07-23 20:08:57 +0200 |
commit | 7d21dabdddcc55a76f9f5633a61c8fb34b2d99d8 (patch) | |
tree | 1cddcb693b29a2a813a1b2758bd518f5b8951ef9 /src/kernel/execbuf.c | |
parent | 20c7b5be3bbb5f56a31536c018e20706100f57ae (diff) |
kernel: switch processes after execbuf_syscall
Diffstat (limited to 'src/kernel/execbuf.c')
-rw-r--r-- | src/kernel/execbuf.c | 29 |
1 files changed, 15 insertions, 14 deletions
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); } } |