From 2a45d7c9b1d1d890fc8b1707e572de93848bfc40 Mon Sep 17 00:00:00 2001 From: jhb Date: Tue, 17 Apr 2001 18:27:55 +0000 Subject: [PATCH] Save are floating point state in cpu_switch() if needed instead of relying completely on lazy floating point state saving. This is needed for the SMP case since processes can migrate to other CPUs. Submitted by: dfr --- sys/alpha/alpha/machdep.c | 2 +- sys/alpha/alpha/swtch.s | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c index 836538ddd588..37fa0089eff4 100644 --- a/sys/alpha/alpha/machdep.c +++ b/sys/alpha/alpha/machdep.c @@ -2131,7 +2131,7 @@ alpha_fpstate_save(struct proc *p, int write) critical_t s; s = critical_enter(); - if (p == PCPU_GET(fpcurproc)) { + if (p != NULL && p == PCPU_GET(fpcurproc)) { /* * If curproc != fpcurproc, then we need to enable FEN * so that we can dump the fp state. diff --git a/sys/alpha/alpha/swtch.s b/sys/alpha/alpha/swtch.s index 7c121654cdbd..ef1e493942da 100644 --- a/sys/alpha/alpha/swtch.s +++ b/sys/alpha/alpha/swtch.s @@ -140,6 +140,13 @@ Lcs1: LDGP(pv) cmpeq s0, s2, t0 /* oldproc == newproc? */ bne t0, Lcs7 /* Yes! Skip! */ + /* + * Save fp state if we have some. + */ + mov s0, a0 /* curproc */ + ldiq a1, 1 /* clear fpcurproc */ + CALL(alpha_fpstate_save) + /* * Deactivate the old address space before activating the * new one. We need to do this before activating the