diff --git a/arch/arm64/include/irq.h b/arch/arm64/include/irq.h index 1f8b45a7b7549..b4ce09ce284f0 100644 --- a/arch/arm64/include/irq.h +++ b/arch/arm64/include/irq.h @@ -268,11 +268,6 @@ struct xcptcontext uint64_t *saved_reg; -#ifdef CONFIG_ARCH_FPU - uint64_t *fpu_regs; - uint64_t *saved_fpu_regs; -#endif - /* Extra fault address register saved for common paging logic. In the * case of the pre-fetch abort, this value is the same as regs[REG_ELR]; * For the case of the data abort, this value is the value of the fault diff --git a/arch/arm64/src/common/arm64_copystate.c b/arch/arm64/src/common/arm64_copystate.c index fbb04f2c733cc..4d06f2ddafe34 100644 --- a/arch/arm64/src/common/arm64_copystate.c +++ b/arch/arm64/src/common/arm64_copystate.c @@ -102,14 +102,15 @@ int arm64_syscall_save_context(uint64_t * regs) #ifdef CONFIG_ARCH_FPU rtcb = (struct tcb_s *)f_regs->regs[REG_X1]; - p_save += XCPTCONTEXT_GP_SIZE; + p_save += XCPTCONTEXT_GP_REGS; if (rtcb_cur == rtcb) { arch_save_fpucontext(p_save); } else { - p_fpu = (uint64_t *)rtcb->xcp.fpu_regs; + p_fpu = (uint64_t *)rtcb->xcp.regs; + p_fpu += XCPTCONTEXT_GP_REGS; for (i = 0; i < XCPTCONTEXT_FPU_REGS; i++) { p_save[i] = p_fpu[i]; diff --git a/arch/arm64/src/common/arm64_fork.c b/arch/arm64/src/common/arm64_fork.c index faddc4d4d3ffc..a23600950cd49 100644 --- a/arch/arm64/src/common/arm64_fork.c +++ b/arch/arm64/src/common/arm64_fork.c @@ -130,9 +130,6 @@ pid_t arm64_fork(const struct fork_s *context) uint64_t stackutil; char *stack_ptr; struct regs_context *pforkctx; -#ifdef CONFIG_ARCH_FPU - struct fpu_reg *pfpuctx; -#endif /* Allocate and initialize a TCB for the child task. */ @@ -189,16 +186,6 @@ pid_t arm64_fork(const struct fork_s *context) stack_ptr = (char *)newsp; -#ifdef CONFIG_ARCH_FPU - pfpuctx = STACK_PTR_TO_FRAME(struct fpu_reg, stack_ptr); - - child->cmn.xcp.fpu_regs = (uint64_t *)pfpuctx; - memcpy(pfpuctx, &context->fpu, sizeof(struct fpu_reg)); - - stack_ptr = (char *)pfpuctx; - -#endif - pforkctx = STACK_PTR_TO_FRAME(struct regs_context, stack_ptr); pforkctx->regs[REG_X0] = 0; @@ -247,6 +234,10 @@ pid_t arm64_fork(const struct fork_s *context) child->cmn.xcp.regs = (uint64_t *)pforkctx; +#ifdef CONFIG_ARCH_FPU + memcpy(&pforkctx->fpu_regs, &context->fpu, sizeof(struct fpu_reg)); +#endif + /* And, finally, start the child task. On a failure, nxtask_start_fork() * will discard the TCB by calling nxtask_abort_fork(). */