Enter a critical section when storing the vfp registers, we don't want to
be preempted here as this will enter back into this function, but the hardware could be in an inconsistant state, and the vfp unit will be off when switced back to this function. Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
899b27a318
commit
731b28fb31
@ -88,14 +88,13 @@ vfp_save_state(struct thread *td)
|
|||||||
uint64_t fpcr, fpsr;
|
uint64_t fpcr, fpsr;
|
||||||
uint32_t cpacr;
|
uint32_t cpacr;
|
||||||
|
|
||||||
|
critical_enter();
|
||||||
/*
|
/*
|
||||||
* Only store the registers if the VFP is enabled,
|
* Only store the registers if the VFP is enabled,
|
||||||
* i.e. return if we are trapping on FP access.
|
* i.e. return if we are trapping on FP access.
|
||||||
*/
|
*/
|
||||||
cpacr = READ_SPECIALREG(cpacr_el1);
|
cpacr = READ_SPECIALREG(cpacr_el1);
|
||||||
if ((cpacr & CPACR_FPEN_MASK) != CPACR_FPEN_TRAP_NONE)
|
if ((cpacr & CPACR_FPEN_MASK) == CPACR_FPEN_TRAP_NONE) {
|
||||||
return;
|
|
||||||
|
|
||||||
vfp_state = td->td_pcb->pcb_vfp;
|
vfp_state = td->td_pcb->pcb_vfp;
|
||||||
__asm __volatile(
|
__asm __volatile(
|
||||||
"mrs %0, fpcr \n"
|
"mrs %0, fpcr \n"
|
||||||
@ -123,6 +122,8 @@ vfp_save_state(struct thread *td)
|
|||||||
|
|
||||||
dsb();
|
dsb();
|
||||||
vfp_disable();
|
vfp_disable();
|
||||||
|
}
|
||||||
|
critical_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user