diff options
author | kettenis <kettenis@openbsd.org> | 2020-07-10 16:10:54 +0000 |
---|---|---|
committer | kettenis <kettenis@openbsd.org> | 2020-07-10 16:10:54 +0000 |
commit | 6b637f08c68b91ccbb517181c055c83aee993cc3 (patch) | |
tree | 10591bfdab17a4dc0c7937026d671b235ecfc4c7 | |
parent | Add check for userland VSID overflow. (diff) | |
download | wireguard-openbsd-6b637f08c68b91ccbb517181c055c83aee993cc3.tar.xz wireguard-openbsd-6b637f08c68b91ccbb517181c055c83aee993cc3.zip |
Clear FPU state if we try to restore the state when the process didn't use
the FPU yet.
-rw-r--r-- | sys/arch/powerpc64/powerpc64/fpu.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/arch/powerpc64/powerpc64/fpu.c b/sys/arch/powerpc64/powerpc64/fpu.c index 6f083b44100..23705aee400 100644 --- a/sys/arch/powerpc64/powerpc64/fpu.c +++ b/sys/arch/powerpc64/powerpc64/fpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fpu.c,v 1.1 2020/06/27 15:04:49 kettenis Exp $ */ +/* $OpenBSD: fpu.c,v 1.2 2020/07/10 16:10:54 kettenis Exp $ */ /* * Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org> @@ -65,7 +65,11 @@ save_vsx(struct proc *p) void restore_vsx(struct proc *p) { - struct fpreg *fp = &p->p_addr->u_pcb.pcb_fpstate; + struct pcb *pcb = &p->p_addr->u_pcb; + struct fpreg *fp = &pcb->pcb_fpstate; + + if ((pcb->pcb_flags & (PCB_FP|PCB_VEC|PCB_VSX)) == 0) + memset(fp, 0, sizeof(*fp)); mtmsr(mfmsr() | (PSL_FP|PSL_VEC|PSL_VSX)); |