When fpcurthread is not the current thread it may be non-NULL. In this

case another thread has had the VFP unit enabled and will have its state
in the VFP registers along with it stored in memory. As such we don't need
to store the state, but do need to zero the fpcurthread pointer to stop
the VFP driver from using the enable fast path.

Reported by:	emaste
Sponsored by:	DARPA, AFRL
This commit is contained in:
Andrew Turner 2017-11-21 13:19:38 +00:00
parent 5070d56d41
commit 2eb3e51e71

View File

@ -273,11 +273,8 @@ fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags)
critical_enter();
if (curthread == PCPU_GET(fpcurthread)) {
vfp_save_state(curthread, pcb);
PCPU_SET(fpcurthread, NULL);
} else {
KASSERT(PCPU_GET(fpcurthread) == NULL,
("invalid fpcurthread"));
}
PCPU_SET(fpcurthread, NULL);
vfp_enable();
pcb->pcb_fpflags |= PCB_FP_KERN | PCB_FP_NOSAVE |