git: 665838d939f3 - releng/14.0 - 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:12 UTC
The branch releng/14.0 has been updated by cognet: URL: https://cgit.FreeBSD.org/src/commit/?id=665838d939f3d32ca851e815506989d80a207f52 commit 665838d939f3d32ca851e815506989d80a207f52 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:04:16 +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) Approved by: re (cperciva) --- 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 e19d845ca66e..1cf8403e0a0e 100644 --- a/sys/arm64/arm64/freebsd32_machdep.c +++ b/sys/arm64/arm64/freebsd32_machdep.c @@ -151,8 +151,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); } @@ -168,8 +172,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();