diff options
| author | Olivier Houchard <cognet@FreeBSD.org> | 2023-10-16 20:18:24 +0000 |
|---|---|---|
| committer | Olivier Houchard <cognet@FreeBSD.org> | 2023-10-19 23:05:26 +0000 |
| commit | 51be8675416df4aa066e823fec37ea6667494e63 (patch) | |
| tree | 0c89a5ece8805488f676dedd1f952697f68dff84 | |
| parent | b180f0040f95973a30fa26f5435e4bbab1197e80 (diff) | |
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)
| -rw-r--r-- | sys/arm64/arm64/freebsd32_machdep.c | 16 |
1 files 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(); |
