riscv-v/fork.S: Fix clobbering of s0 in fork()

Value of s0 (callee-saved) must be preserved through the call, use
a0 (caller-saved) to calculate the original SP instead.
This commit is contained in:
Ville Juven 2024-05-30 15:11:24 +03:00 committed by Xiang Xiao
parent 275ec7102c
commit c1f3245167

View File

@ -117,8 +117,8 @@ up_fork:
REGSTORE s0, FORK_S0_OFFSET(sp) REGSTORE s0, FORK_S0_OFFSET(sp)
#endif #endif
addi s0, sp, FORK_SIZEOF addi a0, sp, FORK_SIZEOF
REGSTORE s0, FORK_SP_OFFSET(sp) /* original SP */ REGSTORE a0, FORK_SP_OFFSET(sp) /* original SP */
REGSTORE x1, FORK_RA_OFFSET(sp) /* return address */ REGSTORE x1, FORK_RA_OFFSET(sp) /* return address */
/* Floating point registers */ /* Floating point registers */