From 8da0171e5ca3492cdb34422184a1c96acd0b5165 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sat, 21 May 2022 21:02:17 +0300 Subject: add status info to memory mappings + next up would probably be to start working on process/thread relationships, largely as documented. Still not entirely sure about how I want to handle fork, but I suppose I might figure it out at some point. --- arch/riscv64/kernel/entry.S | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'arch/riscv64/kernel/entry.S') 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 */ -- cgit v1.3