From 092e3c8b7a21b4de6aba97538fab2be99b71f246 Mon Sep 17 00:00:00 2001 From: martin Date: Fri, 15 Sep 2006 07:42:38 +0000 Subject: [PATCH] Do not bother to save fpu state when we are about to get rid of it. --- sys/arch/sparc64/include/cpu.h | 3 ++- sys/arch/sparc64/sparc64/locore.s | 13 ++++++++++++- sys/arch/sparc64/sparc64/vm_machdep.c | 6 +++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/sys/arch/sparc64/include/cpu.h b/sys/arch/sparc64/include/cpu.h index f79f8db9600d..ab48b37a77b6 100644 --- a/sys/arch/sparc64/include/cpu.h +++ b/sys/arch/sparc64/include/cpu.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.55 2006/09/13 11:35:53 mrg Exp $ */ +/* $NetBSD: cpu.h,v 1.56 2006/09/15 07:42:38 martin Exp $ */ /* * Copyright (c) 1992, 1993 @@ -307,6 +307,7 @@ int statintr(void *); /* level 14 (statclock) interrupt code */ struct fpstate64; void savefpstate(struct fpstate64 *); void loadfpstate(struct fpstate64 *); +void clearfpstate(void); uint64_t probeget(paddr_t, int, int); int probeset(paddr_t, int, int, uint64_t); diff --git a/sys/arch/sparc64/sparc64/locore.s b/sys/arch/sparc64/sparc64/locore.s index 37086983eba6..0aed3a181ca0 100644 --- a/sys/arch/sparc64/sparc64/locore.s +++ b/sys/arch/sparc64/sparc64/locore.s @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.215 2006/09/13 11:35:53 mrg Exp $ */ +/* $NetBSD: locore.s,v 1.216 2006/09/15 07:42:38 martin Exp $ */ /* * Copyright (c) 1996-2002 Eduardo Horvath @@ -10232,6 +10232,17 @@ Lkcerr: mov EFAULT, %o0 NOTREACHED +/* + * clearfpstate() + * + * Drops the current fpu state, without saving it. + */ +ENTRY(clearfpstate) + rdpr %pstate, %o1 ! enable FPU + wr %g0, FPRS_FEF, %fprs + or %o1, PSTATE_PEF, %o1 + retl + wrpr %o1, 0, %pstate /* * savefpstate(f) struct fpstate *f; diff --git a/sys/arch/sparc64/sparc64/vm_machdep.c b/sys/arch/sparc64/sparc64/vm_machdep.c index 346236328447..6cad47e63e23 100644 --- a/sys/arch/sparc64/sparc64/vm_machdep.c +++ b/sys/arch/sparc64/sparc64/vm_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.64 2006/08/31 16:49:21 matt Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.65 2006/09/15 07:42:38 martin Exp $ */ /* * Copyright (c) 1996-2002 Eduardo Horvath. All rights reserved. @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.64 2006/08/31 16:49:21 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.65 2006/09/15 07:42:38 martin Exp $"); #include "opt_coredump.h" @@ -325,7 +325,7 @@ cpu_lwp_free(l, proc) if ((fs = l->l_md.md_fpstate) != NULL) { if (l == fplwp) { - savefpstate(fs); + clearfpstate(); fplwp = NULL; } free((void *)fs, M_SUBPROC);