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
This commit is contained in:
Justin Hibbits 2020-02-06 01:25:30 +00:00
parent 21935a41fd
commit 31091dea96
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=357607

View File

@ -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);