Changeset View
Changeset View
Standalone View
Standalone View
sys/arm/arm/exec_machdep.c
Show First 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Get machine VFP context. | * Get machine VFP context. | ||||
*/ | */ | ||||
void | void | ||||
get_vfpcontext(struct thread *td, mcontext_vfp_t *vfp) | get_vfpcontext(struct thread *td, mcontext_vfp_t *vfp) | ||||
{ | { | ||||
struct pcb *pcb; | struct pcb *pcb; | ||||
MPASS(td == curthread); | MPASS(td == curthread || TD_IS_SUSPENDED(td) || | ||||
P_SHOULDSTOP(td->td_proc)); | |||||
pcb = td->td_pcb; | pcb = td->td_pcb; | ||||
if ((pcb->pcb_fpflags & PCB_FP_STARTED) != 0) { | if ((pcb->pcb_fpflags & PCB_FP_STARTED) != 0 && td == curthread) { | ||||
critical_enter(); | critical_enter(); | ||||
vfp_store(&pcb->pcb_vfpstate, false); | vfp_store(&pcb->pcb_vfpstate, false); | ||||
critical_exit(); | critical_exit(); | ||||
} | } | ||||
KASSERT(pcb->pcb_vfpsaved == &pcb->pcb_vfpstate, | KASSERT(pcb->pcb_vfpsaved == &pcb->pcb_vfpstate, | ||||
("Called get_vfpcontext while the kernel is using the VFP")); | ("Called get_vfpcontext while the kernel is using the VFP")); | ||||
memcpy(vfp->mcv_reg, pcb->pcb_vfpstate.reg, | memcpy(vfp, &pcb->pcb_vfpstate, sizeof(*vfp)); | ||||
sizeof(vfp->mcv_reg)); | |||||
vfp->mcv_fpscr = pcb->pcb_vfpstate.fpscr; | |||||
} | } | ||||
/* | /* | ||||
* Set machine VFP context. | * Set machine VFP context. | ||||
*/ | */ | ||||
void | void | ||||
set_vfpcontext(struct thread *td, mcontext_vfp_t *vfp) | set_vfpcontext(struct thread *td, mcontext_vfp_t *vfp) | ||||
{ | { | ||||
struct pcb *pcb; | struct pcb *pcb; | ||||
MPASS(td == curthread); | |||||
pcb = td->td_pcb; | pcb = td->td_pcb; | ||||
if ((pcb->pcb_fpflags & PCB_FP_STARTED) != 0) { | if (td == curthread) { | ||||
critical_enter(); | critical_enter(); | ||||
vfp_discard(td); | vfp_discard(td); | ||||
critical_exit(); | critical_exit(); | ||||
} | } | ||||
KASSERT(pcb->pcb_vfpsaved == &pcb->pcb_vfpstate, | KASSERT(pcb->pcb_vfpsaved == &pcb->pcb_vfpstate, | ||||
("Called set_vfpcontext while the kernel is using the VFP")); | ("Called set_vfpcontext while the kernel is using the VFP")); | ||||
memcpy(pcb->pcb_vfpstate.reg, vfp->mcv_reg, | memcpy(&pcb->pcb_vfpstate, vfp, sizeof(*vfp)); | ||||
sizeof(pcb->pcb_vfpstate.reg)); | |||||
pcb->pcb_vfpstate.fpscr = vfp->mcv_fpscr; | |||||
} | } | ||||
andrew: Why do you need to expand the critical section? | |||||
Done Inline ActionsI suppose that there is no need to do that. kd: I suppose that there is no need to do that.
I just wanted to be safe, but after examinng the… | |||||
#endif | #endif | ||||
int | int | ||||
arm_get_vfpstate(struct thread *td, void *args) | arm_get_vfpstate(struct thread *td, void *args) | ||||
{ | { | ||||
int rv; | int rv; | ||||
struct arm_get_vfpstate_args ua; | struct arm_get_vfpstate_args ua; | ||||
mcontext_vfp_t mcontext_vfp; | mcontext_vfp_t mcontext_vfp; | ||||
▲ Show 20 Lines • Show All 250 Lines • Show Last 20 Lines |
Why do you need to expand the critical section?