git: 51be8675416d - stable/13 - arm64/compat32: Fix handling of 32bits FP registers.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 19 Oct 2023 23:05:34 UTC
The branch stable/13 has been updated by cognet: URL: https://cgit.FreeBSD.org/src/commit/?id=51be8675416df4aa066e823fec37ea6667494e63 commit 51be8675416df4aa066e823fec37ea6667494e63 Author: Olivier Houchard <cognet@FreeBSD.org> AuthorDate: 2023-10-16 20:18:24 +0000 Commit: Olivier Houchard <cognet@FreeBSD.org> CommitDate: 2023-10-19 23:05:26 +0000 arm64/compat32: Fix handling of 32bits FP registers. We must consider the aarch32 FP registers as 16 128bits registers, and store that as the first 16 aarch64 FP registers. PR: 267788 (cherry picked from commit ccd0f34d8585cba727dd17a381309855af655b82) (cherry picked from commit 0e0a03c792542a2509702378559622efafc86548) --- sys/arm64/arm64/freebsd32_machdep.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sys/arm64/arm64/freebsd32_machdep.c b/sys/arm64/arm64/freebsd32_machdep.c index 731ce8e6d4be..00c9878deb7c 100644 --- a/sys/arm64/arm64/freebsd32_machdep.c +++ b/sys/arm64/arm64/freebsd32_machdep.c @@ -142,8 +142,12 @@ get_fpcontext32(struct thread *td, mcontext32_vfp_t *mcp) ("Called get_fpcontext32 while the kernel is using the VFP")); KASSERT((pcb->pcb_fpflags & ~PCB_FP_USERMASK) == 0, ("Non-userspace FPU flags set in get_fpcontext32")); - for (i = 0; i < 32; i++) - mcp->mcv_reg[i] = (uint64_t)pcb->pcb_fpustate.vfp_regs[i]; + for (i = 0; i < 16; i++) { + uint64_t *tmpreg = (uint64_t *)&pcb->pcb_fpustate.vfp_regs[i]; + + mcp->mcv_reg[i * 2] = tmpreg[0]; + mcp->mcv_reg[i * 2 + 1] = tmpreg[1]; + } mcp->mcv_fpscr = VFP_FPSCR_FROM_SRCR(pcb->pcb_fpustate.vfp_fpcr, pcb->pcb_fpustate.vfp_fpsr); } @@ -159,8 +163,12 @@ set_fpcontext32(struct thread *td, mcontext32_vfp_t *mcp) pcb = td->td_pcb; if (td == curthread) vfp_discard(td); - for (i = 0; i < 32; i++) - pcb->pcb_fpustate.vfp_regs[i] = mcp->mcv_reg[i]; + for (i = 0; i < 16; i++) { + uint64_t *tmpreg = (uint64_t *)&pcb->pcb_fpustate.vfp_regs[i]; + + tmpreg[0] = mcp->mcv_reg[i * 2]; + tmpreg[1] = mcp->mcv_reg[i * 2 + 1]; + } pcb->pcb_fpustate.vfp_fpsr = VFP_FPSR_FROM_FPSCR(mcp->mcv_fpscr); pcb->pcb_fpustate.vfp_fpcr = VFP_FPSR_FROM_FPSCR(mcp->mcv_fpscr); critical_exit();