aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv64/kernel
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-09-14 21:30:11 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2022-09-14 21:30:11 +0300
commitcabbf335824db0df835e4c541c19d3803ce38454 (patch)
treee7397d2b6637545b8e18f26135e3ad2a0a2fbe1e /arch/riscv64/kernel
parent025778e89e7d0fe3cd1ad53537c9cc6f3cd819cc (diff)
downloadkmi-cabbf335824db0df835e4c541c19d3803ce38454.tar.gz
kmi-cabbf335824db0df835e4c541c19d3803ce38454.zip
add canary to kernel stack
Diffstat (limited to 'arch/riscv64/kernel')
-rw-r--r--arch/riscv64/kernel/entry.S4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/riscv64/kernel/entry.S b/arch/riscv64/kernel/entry.S
index 9c7a54c..7301d4e 100644
--- a/arch/riscv64/kernel/entry.S
+++ b/arch/riscv64/kernel/entry.S
@@ -29,7 +29,8 @@ _save_context:
mv sp, tp
/* move thread pointer back */
- csrrw tp, CSR_SSCRATCH, tp
+ addi tp, tp, sizeof_registers
+ csrrw tp, CSR_SSCRATCH, tp
/* save registers */
sr ra, offsetof_ra(sp)
@@ -77,6 +78,7 @@ _save_context:
handle_exception:
li t0, EXC_SYSCALL
/* system exceptions fall through, syscalls jump */
+ /* temp, at some point we want to handle system exceptions as well */
beq s4, t0, handle_syscall
j restore_all