From 23405ee4783c6028f7f9ba6056e24cef3c03358c Mon Sep 17 00:00:00 2001 From: Dmitrij Tejblum Date: Thu, 10 Jun 1999 20:40:59 +0000 Subject: [PATCH] Replace my previous fix of saving the FP state with a much simpler one: when we swap out fpcurproc, save its FP state. Suggested by: bde --- sys/alpha/alpha/fp_emulate.c | 3 +-- sys/alpha/alpha/machdep.c | 15 ++++----------- sys/alpha/alpha/pmap.c | 9 ++++++++- sys/alpha/alpha/prom.c | 5 +---- sys/alpha/alpha/trap.c | 8 ++------ sys/alpha/alpha/vm_machdep.c | 6 ++---- sys/powerpc/aim/vm_machdep.c | 6 ++---- sys/powerpc/powerpc/vm_machdep.c | 6 ++---- 8 files changed, 22 insertions(+), 36 deletions(-) diff --git a/sys/alpha/alpha/fp_emulate.c b/sys/alpha/alpha/fp_emulate.c index 47afa49be98e..a01642afc0ae 100644 --- a/sys/alpha/alpha/fp_emulate.c +++ b/sys/alpha/alpha/fp_emulate.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: fp_emulate.c,v 1.3 1999/04/08 20:32:51 gallatin Exp $ + * $Id: fp_emulate.c,v 1.4 1999/06/08 16:42:13 dt Exp $ */ #include @@ -263,7 +263,6 @@ static int fp_emulate(union alpha_instruction ins, struct proc *p) alpha_pal_wrfen(1); savefpstate(&fpcurproc->p_addr->u_pcb.pcb_fp); alpha_pal_wrfen(0); - PRELE(fpcurproc); fpcurproc = NULL; } diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c index 08790ad1af9d..f251e7850562 100644 --- a/sys/alpha/alpha/machdep.c +++ b/sys/alpha/alpha/machdep.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: machdep.c,v 1.43 1999/05/14 11:15:13 dfr Exp $ + * $Id: machdep.c,v 1.44 1999/06/08 16:42:14 dt Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -1353,7 +1353,6 @@ sendsig(sig_t catcher, int sig, int mask, u_long code) alpha_pal_wrfen(1); savefpstate(&p->p_addr->u_pcb.pcb_fp); alpha_pal_wrfen(0); - PRELE(fpcurproc); fpcurproc = NULL; } ksc.sc_ownedfp = p->p_md.md_flags & MDP_FPUSED; @@ -1466,10 +1465,8 @@ sigreturn(struct proc *p, alpha_pal_wrusp(ksc.sc_regs[R_SP]); /* XXX ksc.sc_ownedfp ? */ - if (p == fpcurproc) { - PRELE(fpcurproc); + if (p == fpcurproc) fpcurproc = NULL; - } bcopy((struct fpreg *)ksc.sc_fpregs, &p->p_addr->u_pcb.pcb_fp, sizeof(struct fpreg)); p->p_addr->u_pcb.pcb_fp_control = ksc.sc_fp_control; @@ -1529,10 +1526,8 @@ setregs(struct proc *p, u_long entry, u_long stack, u_long ps_strings) tfp->tf_regs[FRAME_T12] = tfp->tf_regs[FRAME_PC]; /* a.k.a. PV */ p->p_md.md_flags &= ~MDP_FPUSED; - if (fpcurproc == p) { - PRELE(fpcurproc); + if (fpcurproc == p) fpcurproc = NULL; - } } int @@ -1873,10 +1868,8 @@ set_fpregs(p, fpregs) struct proc *p; struct fpreg *fpregs; { - if (p == fpcurproc) { - PRELE(fpcurproc); + if (p == fpcurproc) fpcurproc = NULL; - } bcopy(fpregs, &p->p_addr->u_pcb.pcb_fp, sizeof *fpregs); return (0); diff --git a/sys/alpha/alpha/pmap.c b/sys/alpha/alpha/pmap.c index 3bfa23471a7f..abc565c4676f 100644 --- a/sys/alpha/alpha/pmap.c +++ b/sys/alpha/alpha/pmap.c @@ -43,7 +43,7 @@ * from: @(#)pmap.c 7.7 (Berkeley) 5/12/91 * from: i386 Id: pmap.c,v 1.193 1998/04/19 15:22:48 bde Exp * with some ideas from NetBSD's alpha pmap - * $Id: pmap.c,v 1.24 1999/05/28 05:38:47 alc Exp $ + * $Id: pmap.c,v 1.25 1999/06/08 17:14:07 dt Exp $ */ /* @@ -1053,6 +1053,13 @@ pmap_swapout_proc(p) vm_object_t upobj; vm_page_t m; + if (p == fpcurproc) { + alpha_pal_wrfen(1); + savefpstate(&fpcurproc->p_addr->u_pcb.pcb_fp); + fpcurproc = NULL; + alpha_pal_wrfen(0); + } + upobj = p->p_upages_obj; /* * let the upages be paged diff --git a/sys/alpha/alpha/prom.c b/sys/alpha/alpha/prom.c index 0cb27c3e2a85..4724eb4ea077 100644 --- a/sys/alpha/alpha/prom.c +++ b/sys/alpha/alpha/prom.c @@ -141,12 +141,9 @@ enter_prom() */ if (curproc != fpcurproc) { alpha_pal_wrfen(1); - if (fpcurproc) { + if (fpcurproc) savefpstate(&fpcurproc->p_addr->u_pcb.pcb_fp); - PRELE(fpcurproc); - } fpcurproc = curproc; - PHOLD(fpcurproc); restorefpstate(&fpcurproc->p_addr->u_pcb.pcb_fp); } #endif diff --git a/sys/alpha/alpha/trap.c b/sys/alpha/alpha/trap.c index e1dfc002f133..0e7b37514a9c 100644 --- a/sys/alpha/alpha/trap.c +++ b/sys/alpha/alpha/trap.c @@ -1,4 +1,4 @@ -/* $Id: trap.c,v 1.14 1999/05/10 16:00:56 peter Exp $ */ +/* $Id: trap.c,v 1.15 1999/06/08 16:42:17 dt Exp $ */ /* $NetBSD: trap.c,v 1.31 1998/03/26 02:21:46 thorpej Exp $ */ /* @@ -323,12 +323,9 @@ trap(a0, a1, a2, entry, framep) } alpha_pal_wrfen(1); - if (fpcurproc) { + if (fpcurproc) savefpstate(&fpcurproc->p_addr->u_pcb.pcb_fp); - PRELE(fpcurproc); - } fpcurproc = p; - PHOLD(fpcurproc); restorefpstate(&fpcurproc->p_addr->u_pcb.pcb_fp); alpha_pal_wrfen(0); @@ -747,7 +744,6 @@ const static int reg_to_framereg[32] = { alpha_pal_wrfen(1); \ savefpstate(&fpcurproc->p_addr->u_pcb.pcb_fp); \ alpha_pal_wrfen(0); \ - PRELE(fpcurproc); \ fpcurproc = NULL; \ } diff --git a/sys/alpha/alpha/vm_machdep.c b/sys/alpha/alpha/vm_machdep.c index f5f3cdfa3426..a63879401cfa 100644 --- a/sys/alpha/alpha/vm_machdep.c +++ b/sys/alpha/alpha/vm_machdep.c @@ -38,7 +38,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.14 1999/04/23 19:53:38 dt Exp $ + * $Id: vm_machdep.c,v 1.15 1999/06/08 16:42:19 dt Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -240,10 +240,8 @@ void cpu_exit(p) register struct proc *p; { - if (p == fpcurproc) { - PRELE(fpcurproc); + if (p == fpcurproc) fpcurproc = NULL; - } (void) splhigh(); cnt.v_swtch++; diff --git a/sys/powerpc/aim/vm_machdep.c b/sys/powerpc/aim/vm_machdep.c index f5f3cdfa3426..a63879401cfa 100644 --- a/sys/powerpc/aim/vm_machdep.c +++ b/sys/powerpc/aim/vm_machdep.c @@ -38,7 +38,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.14 1999/04/23 19:53:38 dt Exp $ + * $Id: vm_machdep.c,v 1.15 1999/06/08 16:42:19 dt Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -240,10 +240,8 @@ void cpu_exit(p) register struct proc *p; { - if (p == fpcurproc) { - PRELE(fpcurproc); + if (p == fpcurproc) fpcurproc = NULL; - } (void) splhigh(); cnt.v_swtch++; diff --git a/sys/powerpc/powerpc/vm_machdep.c b/sys/powerpc/powerpc/vm_machdep.c index f5f3cdfa3426..a63879401cfa 100644 --- a/sys/powerpc/powerpc/vm_machdep.c +++ b/sys/powerpc/powerpc/vm_machdep.c @@ -38,7 +38,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.14 1999/04/23 19:53:38 dt Exp $ + * $Id: vm_machdep.c,v 1.15 1999/06/08 16:42:19 dt Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -240,10 +240,8 @@ void cpu_exit(p) register struct proc *p; { - if (p == fpcurproc) { - PRELE(fpcurproc); + if (p == fpcurproc) fpcurproc = NULL; - } (void) splhigh(); cnt.v_swtch++;