zero PCU area when loading used area.

This commit is contained in:
matt 2011-06-07 01:01:42 +00:00
parent f57762471e
commit 8c87bc1fc9
3 changed files with 18 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: spe.c,v 1.4 2011/05/02 06:43:16 matt Exp $ */ /* $NetBSD: spe.c,v 1.5 2011/06/07 01:01:42 matt Exp $ */
/*- /*-
* Copyright (c) 2011 The NetBSD Foundation, Inc. * Copyright (c) 2011 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: spe.c,v 1.4 2011/05/02 06:43:16 matt Exp $"); __KERNEL_RCSID(0, "$NetBSD: spe.c,v 1.5 2011/06/07 01:01:42 matt Exp $");
#include "opt_altivec.h" #include "opt_altivec.h"
@ -77,6 +77,11 @@ vec_state_load(lwp_t *l, bool used)
{ {
struct pcb * const pcb = lwp_getpcb(l); struct pcb * const pcb = lwp_getpcb(l);
if (__predict_false(!vec_used_p(l))) {
memset(&pcb->pcb_vr, 0, sizeof(pcb->pcb_vr));
vec_mark_used(l);
}
/* /*
* Enable SPE temporarily (and disable interrupts). * Enable SPE temporarily (and disable interrupts).
*/ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: altivec.c,v 1.24 2011/05/25 05:42:37 matt Exp $ */ /* $NetBSD: altivec.c,v 1.25 2011/06/07 01:01:43 matt Exp $ */
/* /*
* Copyright (C) 1996 Wolfgang Solfrank. * Copyright (C) 1996 Wolfgang Solfrank.
@ -32,7 +32,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: altivec.c,v 1.24 2011/05/25 05:42:37 matt Exp $"); __KERNEL_RCSID(0, "$NetBSD: altivec.c,v 1.25 2011/06/07 01:01:43 matt Exp $");
#include "opt_multiprocessor.h" #include "opt_multiprocessor.h"
@ -77,6 +77,11 @@ vec_state_load(lwp_t *l, bool used)
{ {
struct pcb * const pcb = lwp_getpcb(l); struct pcb * const pcb = lwp_getpcb(l);
if (__predict_false(!vec_used_p(l))) {
memset(&pcb->pcb_vr, 0, sizeof(pcb->pcb_vr));
vec_mark_used(l);
}
/* /*
* Enable AltiVec temporarily (and disable interrupts). * Enable AltiVec temporarily (and disable interrupts).
*/ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: fpu.c,v 1.30 2011/06/07 00:48:32 matt Exp $ */ /* $NetBSD: fpu.c,v 1.31 2011/06/07 01:01:43 matt Exp $ */
/* /*
* Copyright (C) 1996 Wolfgang Solfrank. * Copyright (C) 1996 Wolfgang Solfrank.
@ -32,7 +32,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.30 2011/06/07 00:48:32 matt Exp $"); __KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.31 2011/06/07 01:01:43 matt Exp $");
#include "opt_multiprocessor.h" #include "opt_multiprocessor.h"
@ -80,8 +80,9 @@ fpu_state_load(lwp_t *l, bool used)
{ {
struct pcb * const pcb = lwp_getpcb(l); struct pcb * const pcb = lwp_getpcb(l);
if (__predict_false(!used)) { if (__predict_false(!fpu_used_p(l))) {
memset(&pcb->pcb_fpu, 0, sizeof(pcb->pcb_fpu)); memset(&pcb->pcb_fpu, 0, sizeof(pcb->pcb_fpu));
fpu_mark_used(l);
} }
const register_t msr = mfmsr(); const register_t msr = mfmsr();