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
This commit is contained in:
Dmitrij Tejblum 1999-06-10 20:40:59 +00:00
parent b150665acf
commit 23405ee478
8 changed files with 22 additions and 36 deletions

View File

@ -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 <sys/param.h>
@ -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;
}

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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; \
}

View File

@ -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++;

View File

@ -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++;

View File

@ -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++;