riscv/fork: fix gp register handling
This fixes the handling of gp register in fork. Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
This commit is contained in:
parent
3f021d5429
commit
77cfbf8914
@ -123,6 +123,10 @@ up_fork:
|
||||
REGSTORE s0, FORK_S0_OFFSET(sp)
|
||||
#endif
|
||||
|
||||
#ifdef RISCV_SAVE_GP
|
||||
REGSTORE gp, FORK_GP_OFFSET(sp)
|
||||
#endif
|
||||
|
||||
addi a0, sp, FORK_SIZEOF
|
||||
REGSTORE a0, FORK_SP_OFFSET(sp) /* original SP */
|
||||
REGSTORE x1, FORK_RA_OFFSET(sp) /* return address */
|
||||
|
@ -308,7 +308,7 @@ pid_t riscv_fork(const struct fork_s *context)
|
||||
#endif
|
||||
child->cmn.xcp.regs[REG_SP] = newsp; /* Stack pointer */
|
||||
#ifdef RISCV_SAVE_GP
|
||||
child->cmn.xcp.regs[REG_GP] = newsp; /* Global pointer */
|
||||
child->cmn.xcp.regs[REG_GP] = context->gp; /* Global pointer */
|
||||
#endif
|
||||
#ifdef CONFIG_ARCH_FPU
|
||||
fregs = riscv_fpuregs(&child->cmn);
|
||||
|
Loading…
Reference in New Issue
Block a user