From 6f2e7884b67738b227642fd6afda105bdbc49a5d Mon Sep 17 00:00:00 2001
From: dt
Date: Tue, 8 Jun 1999 16:42:19 +0000
Subject: Keep fpcurproc locked in memory, so that we always can save the FP
state correctly.
This should fix the "pmap_changebit didn't" panic that some people see.
Reviewed by: dfr
---
sys/alpha/alpha/fp_emulate.c | 3 ++-
sys/alpha/alpha/machdep.c | 15 +++++++++++----
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 ++++--
7 files changed, 35 insertions(+), 14 deletions(-)
(limited to 'sys')
diff --git a/sys/alpha/alpha/fp_emulate.c b/sys/alpha/alpha/fp_emulate.c
index 49759e9..47afa49 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.2 1998/12/30 10:38:58 dfr Exp $
+ * $Id: fp_emulate.c,v 1.3 1999/04/08 20:32:51 gallatin Exp $
*/
#include
@@ -263,6 +263,7 @@ 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 bef4b1e..08790ad 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.42 1999/05/14 11:13:21 dfr Exp $
+ * $Id: machdep.c,v 1.43 1999/05/14 11:15:13 dfr Exp $
*/
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -1353,6 +1353,7 @@ 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;
@@ -1465,8 +1466,10 @@ sigreturn(struct proc *p,
alpha_pal_wrusp(ksc.sc_regs[R_SP]);
/* XXX ksc.sc_ownedfp ? */
- if (p == fpcurproc)
+ if (p == fpcurproc) {
+ PRELE(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;
@@ -1526,8 +1529,10 @@ 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)
+ if (fpcurproc == p) {
+ PRELE(fpcurproc);
fpcurproc = NULL;
+ }
}
int
@@ -1868,8 +1873,10 @@ set_fpregs(p, fpregs)
struct proc *p;
struct fpreg *fpregs;
{
- if (p == fpcurproc)
+ if (p == fpcurproc) {
+ PRELE(fpcurproc);
fpcurproc = NULL;
+ }
bcopy(fpregs, &p->p_addr->u_pcb.pcb_fp, sizeof *fpregs);
return (0);
diff --git a/sys/alpha/alpha/prom.c b/sys/alpha/alpha/prom.c
index 4724eb4..0cb27c3 100644
--- a/sys/alpha/alpha/prom.c
+++ b/sys/alpha/alpha/prom.c
@@ -141,9 +141,12 @@ 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 4e215d7..e1dfc00 100644
--- a/sys/alpha/alpha/trap.c
+++ b/sys/alpha/alpha/trap.c
@@ -1,4 +1,4 @@
-/* $Id: trap.c,v 1.13 1999/04/23 19:53:38 dt Exp $ */
+/* $Id: trap.c,v 1.14 1999/05/10 16:00:56 peter Exp $ */
/* $NetBSD: trap.c,v 1.31 1998/03/26 02:21:46 thorpej Exp $ */
/*
@@ -323,9 +323,12 @@ 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);
@@ -744,6 +747,7 @@ 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 929d9fb..f5f3cdf 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.13 1999/04/20 22:53:54 dt Exp $
+ * $Id: vm_machdep.c,v 1.14 1999/04/23 19:53:38 dt Exp $
*/
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -240,8 +240,10 @@ void
cpu_exit(p)
register struct proc *p;
{
- if (p == fpcurproc)
+ if (p == fpcurproc) {
+ PRELE(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 929d9fb..f5f3cdf 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.13 1999/04/20 22:53:54 dt Exp $
+ * $Id: vm_machdep.c,v 1.14 1999/04/23 19:53:38 dt Exp $
*/
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -240,8 +240,10 @@ void
cpu_exit(p)
register struct proc *p;
{
- if (p == fpcurproc)
+ if (p == fpcurproc) {
+ PRELE(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 929d9fb..f5f3cdf 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.13 1999/04/20 22:53:54 dt Exp $
+ * $Id: vm_machdep.c,v 1.14 1999/04/23 19:53:38 dt Exp $
*/
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -240,8 +240,10 @@ void
cpu_exit(p)
register struct proc *p;
{
- if (p == fpcurproc)
+ if (p == fpcurproc) {
+ PRELE(fpcurproc);
fpcurproc = NULL;
+ }
(void) splhigh();
cnt.v_swtch++;
--
cgit v1.1