aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv64
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2023-06-08 18:43:18 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2023-06-08 18:43:18 +0300
commitdd10667c56b943c19436c6540946f9ad0f71d257 (patch)
tree407bb9cea33344831c17347183303e8de0200b78 /arch/riscv64
parenta8540ed5cc382ac71716b9978862e57edf274d77 (diff)
downloadkmi-dd10667c56b943c19436c6540946f9ad0f71d257.tar.gz
kmi-dd10667c56b943c19436c6540946f9ad0f71d257.zip
add fast userspace return to do_ipc
Diffstat (limited to 'arch/riscv64')
-rw-r--r--arch/riscv64/kernel/entry.S21
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/riscv64/kernel/entry.S b/arch/riscv64/kernel/entry.S
index 32a04f6..2f9a9e6 100644
--- a/arch/riscv64/kernel/entry.S
+++ b/arch/riscv64/kernel/entry.S
@@ -149,3 +149,24 @@ _load_context:
/* assume supervisor for now */
sret
+
+.global ret_userspace_fast
+ret_userspace_fast:
+ lr sp, offsetof_regs(tp)
+ addi sp, sp, -sizeof_registers
+
+ lr s0, offsetof_exec(tp)
+ csrw CSR_SEPC, s0
+
+ csrw CSR_SSCRATCH, tp
+
+ lr a0, offsetof_a0(sp)
+ lr a1, offsetof_a1(sp)
+ lr a2, offsetof_a2(sp)
+ lr a3, offsetof_a3(sp)
+ lr a4, offsetof_a4(sp)
+ lr a5, offsetof_a5(sp)
+
+ lr sp, offsetof_sp(sp)
+
+ sret