[rv]修正signal退出后用户态sp少8的问题 (#9080)
This commit is contained in:
parent
5e04d8b3c1
commit
a5a89c439f
|
@ -107,6 +107,7 @@ arch_signal_quit:
|
|||
call arch_signal_ucontext_restore
|
||||
|
||||
/* reset kernel sp to the stack */
|
||||
addi sp, sp, CTX_REG_NR * REGBYTES
|
||||
STORE sp, FRAME_OFF_SP(a0)
|
||||
/* return value is user sp */
|
||||
mv sp, a0
|
||||
|
@ -280,7 +281,7 @@ arch_syscall_exit:
|
|||
CLOSE_INTERRUPT
|
||||
|
||||
#if defined(ARCH_MM_MMU)
|
||||
LOAD s0, 2 * REGBYTES(sp)
|
||||
LOAD s0, FRAME_OFF_SSTATUS(sp)
|
||||
andi s0, s0, 0x100
|
||||
bnez s0, dont_ret_to_user
|
||||
j arch_ret_to_user
|
||||
|
|
|
@ -44,9 +44,11 @@
|
|||
li s10, (SSTATUS_SPP)
|
||||
or s11, s11, s10
|
||||
PUSH_8 s11
|
||||
addi sp, sp, -8
|
||||
.endm
|
||||
|
||||
.macro RESTORE_CONTEXT
|
||||
addi sp, sp, 8
|
||||
POP_8 s11
|
||||
csrw sstatus, s11
|
||||
POP_8 s11
|
||||
|
|
|
@ -52,6 +52,7 @@ void *_rt_hw_stack_init(rt_ubase_t *sp, rt_ubase_t ra, rt_ubase_t sstatus)
|
|||
(*--sp) = 0; /* s10 */
|
||||
(*--sp) = 0; /* s11 */
|
||||
(*--sp) = sstatus; /* sstatus */
|
||||
--sp; /* align to 16bytes */
|
||||
|
||||
return (void *)sp;
|
||||
}
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
#error "Not supported XLEN"
|
||||
#endif
|
||||
|
||||
/* 33 general register */
|
||||
#define CTX_GENERAL_REG_NR 33
|
||||
/* 33 general register + 1 padding */
|
||||
#define CTX_GENERAL_REG_NR 34
|
||||
|
||||
#ifdef ENABLE_FPU
|
||||
/* 32 fpu register */
|
||||
|
|
|
@ -47,6 +47,7 @@ struct rt_hw_stack_frame
|
|||
rt_ubase_t t5; /* x30 - t5 - temporary register 5 */
|
||||
rt_ubase_t t6; /* x31 - t6 - temporary register 6 */
|
||||
rt_ubase_t user_sp_exc_stack; /* sscratch - user mode sp/exception stack */
|
||||
rt_ubase_t __padding; /* align to 16bytes */
|
||||
#ifdef ENABLE_FPU
|
||||
rt_ubase_t f[CTX_FPU_REG_NR]; /* f0~f31 */
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue