svn commit: r357607 - head/sys/powerpc/powerpc
Justin Hibbits
jhibbits at FreeBSD.org
Thu Feb 6 01:25:31 UTC 2020
Author: jhibbits
Date: Thu Feb 6 01:25:30 2020
New Revision: 357607
URL: https://svnweb.freebsd.org/changeset/base/357607
Log:
powerpc: Fix altivec disabling in set_mcontext()
We somewhat blindly copy the srr1 from the new context to the trap frame,
but disable FPU and VSX unconditionally, relying on the trap to re-enable
them. This works because the FPU manages the VSX extended FP registers,
which is governed by the PCB_FPFREGS flag. However, with altivec, we
would blindly disable PSL_VEC, without touching PCB_VEC. Handle this case
by disabling altivec in both srr1 and pcb_flags, if the mcontext doesn't
have _MC_AV_VALID set.
Reported by: pkubaj
Modified:
head/sys/powerpc/powerpc/exec_machdep.c
Modified: head/sys/powerpc/powerpc/exec_machdep.c
==============================================================================
--- head/sys/powerpc/powerpc/exec_machdep.c Wed Feb 5 22:29:01 2020 (r357606)
+++ head/sys/powerpc/powerpc/exec_machdep.c Thu Feb 6 01:25:30 2020 (r357607)
@@ -526,6 +526,9 @@ set_mcontext(struct thread *td, mcontext_t *mcp)
pcb->pcb_vec.vscr = mcp->mc_vscr;
pcb->pcb_vec.vrsave = mcp->mc_vrsave;
memcpy(pcb->pcb_vec.vr, mcp->mc_avec, sizeof(mcp->mc_avec));
+ } else {
+ tf->srr1 &= ~PSL_VEC;
+ pcb->pcb_flags &= ~PCB_VEC;
}
return (0);
More information about the svn-src-head
mailing list