mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-21 15:45:02 +00:00
Always read the VFP regs in the arm64 fill_fpregs
The PCB_FP_STARTED is used to indicate that the current VFP context has been used since either 1. the start of the thread, or 2. exiting a kernel FP context. When case 2 was added to the kernel this could cause incorrect results to be returned when a thread exits the kernel FP context and fill_fpregs is called before it has restored the VFP state, e.g. by trappin on a userspace VFP instruction. In both of the cases the base save area is still valid so reduce the use of the PCB_FP_STARTED flag check to help decide if we need to store the current threads VFP state. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D37994
This commit is contained in:
parent
1d577bedba
commit
95dd6974b5
@ -153,16 +153,17 @@ fill_fpregs(struct thread *td, struct fpreg *regs)
|
||||
*/
|
||||
if (td == curthread)
|
||||
vfp_save_state(td, pcb);
|
||||
}
|
||||
|
||||
KASSERT(pcb->pcb_fpusaved == &pcb->pcb_fpustate,
|
||||
("Called fill_fpregs while the kernel is using the VFP"));
|
||||
memcpy(regs->fp_q, pcb->pcb_fpustate.vfp_regs,
|
||||
sizeof(regs->fp_q));
|
||||
regs->fp_cr = pcb->pcb_fpustate.vfp_fpcr;
|
||||
regs->fp_sr = pcb->pcb_fpustate.vfp_fpsr;
|
||||
} else
|
||||
KASSERT(pcb->pcb_fpusaved == &pcb->pcb_fpustate,
|
||||
("Called fill_fpregs while the kernel is using the VFP"));
|
||||
memcpy(regs->fp_q, pcb->pcb_fpustate.vfp_regs,
|
||||
sizeof(regs->fp_q));
|
||||
regs->fp_cr = pcb->pcb_fpustate.vfp_fpcr;
|
||||
regs->fp_sr = pcb->pcb_fpustate.vfp_fpsr;
|
||||
#else
|
||||
memset(regs, 0, sizeof(*regs));
|
||||
#endif
|
||||
memset(regs, 0, sizeof(*regs));
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user