Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Feb 2020 01:25:30 +0000 (UTC)
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r357607 - head/sys/powerpc/powerpc
Message-ID:  <202002060125.0161PUbK076253@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002060125.0161PUbK076253>