summaryrefslogtreecommitdiff
path: root/components/lwp/arch/risc-v
diff options
context:
space:
mode:
Diffstat (limited to 'components/lwp/arch/risc-v')
-rw-r--r--components/lwp/arch/risc-v/rv64/lwp_gcc.S10
1 files changed, 10 insertions, 0 deletions
diff --git a/components/lwp/arch/risc-v/rv64/lwp_gcc.S b/components/lwp/arch/risc-v/rv64/lwp_gcc.S
index c54726bc45..3977553dbf 100644
--- a/components/lwp/arch/risc-v/rv64/lwp_gcc.S
+++ b/components/lwp/arch/risc-v/rv64/lwp_gcc.S
@@ -121,6 +121,16 @@ arch_signal_quit:
* routine in user stack
*/
user_do_signal:
+ /* prefetch ustack to avoid corrupted status in RESTORE/STORE pair below */
+ LOAD t0, FRAME_OFF_SP(sp)
+ addi t1, t0, -CTX_REG_NR * REGBYTES
+ LOAD t2, (t0)
+ li t3, -0x1000
+1:
+ add t0, t0, t3
+ LOAD t2, (t0)
+ bgt t0, t1, 1b
+
/** restore and backup kernel sp carefully to avoid leaking */
addi t0, sp, CTX_REG_NR * REGBYTES
csrw sscratch, t0