diff options
Diffstat (limited to 'arch/riscv64/kernel/entry.S')
| -rw-r--r-- | arch/riscv64/kernel/entry.S | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/riscv64/kernel/entry.S b/arch/riscv64/kernel/entry.S index 0ff1a69..7f697b5 100644 --- a/arch/riscv64/kernel/entry.S +++ b/arch/riscv64/kernel/entry.S @@ -74,8 +74,11 @@ handle_exception: j restore_all handle_syscall: - /* TODO: CSR_EPC should be moved forward one instruction when dealing - * with syscalls */ + /* add 4 (size of ecall) to EPC to avoid running the same instruction + * twice */ + csrr s0, CSR_SEPC + addi s0, s0, 4 + csrw CSR_SEPC, s0 jal syscall_dispatch /* if we had a thread switch, load kernel stack of current thread and * restore its context */ |
