Date: Thu, 14 Sep 2017 14:36:57 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323581 - head/sys/arm/arm Message-ID: <201709141436.v8EEavSd049785@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Thu Sep 14 14:36:56 2017 New Revision: 323581 URL: https://svnweb.freebsd.org/changeset/base/323581 Log: Only mess with VFP state on the CPU for curthread for get/set_vfpcontext. Future changes will use these functions to fetch and store VFP state for threads other than curthread. Reviewed by: andrew, stevek, Michal Meloun <meloun-miracle-cz> MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D12292 Modified: head/sys/arm/arm/machdep.c Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Thu Sep 14 14:30:43 2017 (r323580) +++ head/sys/arm/arm/machdep.c Thu Sep 14 14:36:56 2017 (r323581) @@ -408,17 +408,18 @@ exec_setregs(struct thread *td, struct image_params *i static void get_vfpcontext(struct thread *td, mcontext_vfp_t *vfp) { - struct pcb *curpcb; + struct pcb *pcb; - curpcb = curthread->td_pcb; - critical_enter(); - - vfp_store(&curpcb->pcb_vfpstate, false); - memcpy(vfp->mcv_reg, curpcb->pcb_vfpstate.reg, + pcb = td->td_pcb; + if (td == curthread) { + critical_enter(); + vfp_store(&pcb->pcb_vfpstate, false); + critical_exit(); + } else + MPASS(TD_IS_SUSPENDED(td)); + memcpy(vfp->mcv_reg, pcb->pcb_vfpstate.reg, sizeof(vfp->mcv_reg)); - vfp->mcv_fpscr = curpcb->pcb_vfpstate.fpscr; - - critical_exit(); + vfp->mcv_fpscr = pcb->pcb_vfpstate.fpscr; } /* @@ -427,17 +428,18 @@ get_vfpcontext(struct thread *td, mcontext_vfp_t *vfp) static void set_vfpcontext(struct thread *td, mcontext_vfp_t *vfp) { - struct pcb *curpcb; + struct pcb *pcb; - curpcb = curthread->td_pcb; - critical_enter(); - - vfp_discard(td); - memcpy(curpcb->pcb_vfpstate.reg, vfp->mcv_reg, - sizeof(curpcb->pcb_vfpstate.reg)); - curpcb->pcb_vfpstate.fpscr = vfp->mcv_fpscr; - - critical_exit(); + pcb = td->td_pcb; + if (td == curthread) { + critical_enter(); + vfp_discard(td); + critical_exit(); + } else + MPASS(TD_IS_SUSPENDED(td)); + memcpy(pcb->pcb_vfpstate.reg, vfp->mcv_reg, + sizeof(pcb->pcb_vfpstate.reg)); + pcb->pcb_vfpstate.fpscr = vfp->mcv_fpscr; } #endif
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201709141436.v8EEavSd049785>