aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv64/kernel/entry.S
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-05-21 21:02:17 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2022-05-21 21:02:17 +0300
commit8da0171e5ca3492cdb34422184a1c96acd0b5165 (patch)
treec125b7286f929c8ff7f8a2b938cec84328e99de4 /arch/riscv64/kernel/entry.S
parent836026dbba64793afc0d2591ffdb6fb39b696977 (diff)
downloadkmi-8da0171e5ca3492cdb34422184a1c96acd0b5165.tar.gz
kmi-8da0171e5ca3492cdb34422184a1c96acd0b5165.zip
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.
Diffstat (limited to 'arch/riscv64/kernel/entry.S')
-rw-r--r--arch/riscv64/kernel/entry.S7
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 */