summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2005-04-21 04:39:36 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2005-04-21 04:39:36 +0000
commit69e87fee98396ec10e442c4defdf192d9e53f997 (patch)
treec48c59ddc701b5f8aee3c870708fb4c8b5fd7659 /sys/arch
parent15c9f1f18f2762ddbd2ccdb7ffe0f7d14309de8e (diff)
count fpu lazy context switches; deraadt@ ok
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/alpha/alpha/trap.c3
-rw-r--r--sys/arch/amd64/amd64/fpu.c7
-rw-r--r--sys/arch/hppa/hppa/genassym.cf5
-rw-r--r--sys/arch/hppa/hppa/locore.S11
-rw-r--r--sys/arch/hppa64/hppa64/genassym.cf5
-rw-r--r--sys/arch/hppa64/hppa64/locore.S11
-rw-r--r--sys/arch/i386/isa/npx.c3
-rw-r--r--sys/arch/powerpc/powerpc/trap.c3
-rw-r--r--sys/arch/solbourne/solbourne/trap.c3
-rw-r--r--sys/arch/sparc/sparc/trap.c3
-rw-r--r--sys/arch/sparc64/sparc64/trap.c3
11 files changed, 34 insertions, 23 deletions
diff --git a/sys/arch/alpha/alpha/trap.c b/sys/arch/alpha/alpha/trap.c
index a21d1de511c..ef7c1ae6da4 100644
--- a/sys/arch/alpha/alpha/trap.c
+++ b/sys/arch/alpha/alpha/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.44 2004/12/06 20:12:21 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.45 2005/04/21 04:39:34 mickey Exp $ */
/* $NetBSD: trap.c,v 1.52 2000/05/24 16:48:33 thorpej Exp $ */
/*-
@@ -757,6 +757,7 @@ alpha_enable_fp(struct proc *p, int check)
p->p_addr->u_pcb.pcb_fpcpu = ci;
ci->ci_fpcurproc = p;
+ uvmexp.fpswtch++;
p->p_md.md_flags |= MDP_FPUSED;
alpha_pal_wrfen(1);
diff --git a/sys/arch/amd64/amd64/fpu.c b/sys/arch/amd64/amd64/fpu.c
index 820fb7a8305..93962c0cd17 100644
--- a/sys/arch/amd64/amd64/fpu.c
+++ b/sys/arch/amd64/amd64/fpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fpu.c,v 1.7 2004/10/28 20:36:15 kettenis Exp $ */
+/* $OpenBSD: fpu.c,v 1.8 2005/04/21 04:39:34 mickey Exp $ */
/* $NetBSD: fpu.c,v 1.1 2003/04/26 18:39:28 fvdl Exp $ */
/*-
@@ -207,9 +207,10 @@ fpudna(struct cpu_info *ci)
* Initialize the FPU state to clear any exceptions. If someone else
* was using the FPU, save their state.
*/
- if (ci->ci_fpcurproc != NULL && ci->ci_fpcurproc != p)
+ if (ci->ci_fpcurproc != NULL && ci->ci_fpcurproc != p) {
fpusave_cpu(ci, 1);
- else {
+ uvmexp.fpswtch++;
+ } else {
clts();
fninit();
fwait();
diff --git a/sys/arch/hppa/hppa/genassym.cf b/sys/arch/hppa/hppa/genassym.cf
index c9f494d4e20..3942e2971fa 100644
--- a/sys/arch/hppa/hppa/genassym.cf
+++ b/sys/arch/hppa/hppa/genassym.cf
@@ -1,4 +1,4 @@
-# $OpenBSD: genassym.cf,v 1.26 2004/06/13 21:49:14 niklas Exp $
+# $OpenBSD: genassym.cf,v 1.27 2005/04/21 04:39:35 mickey Exp $
#
# Copyright (c) 1982, 1990, 1993
@@ -157,6 +157,9 @@ member u_pcb
struct uvm
member page_idle_zero
+struct uvmexp
+member fpswtch
+
# system calls
export SYSCALLGATE
export SYS_exit
diff --git a/sys/arch/hppa/hppa/locore.S b/sys/arch/hppa/hppa/locore.S
index bd9c193408d..400616530b8 100644
--- a/sys/arch/hppa/hppa/locore.S
+++ b/sys/arch/hppa/hppa/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.149 2005/04/07 00:24:57 mickey Exp $ */
+/* $OpenBSD: locore.S,v 1.150 2005/04/21 04:39:35 mickey Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@@ -132,8 +132,6 @@ cpu_itmr /* itmr value at the most recent clk int */
.export kernelmapped, data
BSS(kernelmapped, 4) /* set when kernel is mapped */
- .export fpu_csw, data
- BSS(fpu_csw, 4) /* count fpu context switches */
.export fpu_curpcb, data
BSS(fpu_curpcb, 4) /* pcb of the fpu owner */
.export fpu_enable, data
@@ -1120,11 +1118,12 @@ $fpusw_set
$fpusw_nosave
/* count switches */
- ldil L%fpu_csw, r1
- ldw R%fpu_csw(r1), r16
+ .import uvmexp, data
+ ldil L%(uvmexp+FPSWTCH), r1
+ ldw R%(uvmexp+FPSWTCH)(r1), r16
ldo 31*8+PCB_FPREGS+U_PCB(r9), r17
ldo 1(r16), r16
- stw r16, R%fpu_csw(r1)
+ stw r16, R%(uvmexp+FPSWTCH)(r1)
fldds,ma -8(r17), fr31
fldds,ma -8(r17), fr30
diff --git a/sys/arch/hppa64/hppa64/genassym.cf b/sys/arch/hppa64/hppa64/genassym.cf
index 45e598e1d19..b3104b819c4 100644
--- a/sys/arch/hppa64/hppa64/genassym.cf
+++ b/sys/arch/hppa64/hppa64/genassym.cf
@@ -1,4 +1,4 @@
-# $OpenBSD: genassym.cf,v 1.1 2005/04/01 10:40:47 mickey Exp $
+# $OpenBSD: genassym.cf,v 1.2 2005/04/21 04:39:35 mickey Exp $
#
# Copyright (c) 1982, 1990, 1993
@@ -135,6 +135,9 @@ member ci_curproc
struct uvm
member page_idle_zero
+struct uvmexp
+member fpswtch
+
# system calls
export SYSCALLGATE
export SYS_exit
diff --git a/sys/arch/hppa64/hppa64/locore.S b/sys/arch/hppa64/hppa64/locore.S
index 8882c934d28..bc10a2f80bd 100644
--- a/sys/arch/hppa64/hppa64/locore.S
+++ b/sys/arch/hppa64/hppa64/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.1 2005/04/01 10:40:47 mickey Exp $ */
+/* $OpenBSD: locore.S,v 1.2 2005/04/21 04:39:35 mickey Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -61,8 +61,6 @@ cpl
BSS(emrg_stack, 8) /* stack for HPMC/TOC/PWRF */
BSS(fpemu_stack, 8) /* stack for FPU emulation */
- .export fpu_csw, data
- BSS(fpu_csw, 4) /* count fpu context switches */
.export fpu_enable, data
BSS(fpu_enable, 4) /* bits to set in the %cr10 to enable fpu */
.export fpu_curpcb, data
@@ -1008,11 +1006,12 @@ $fpusw_set
$fpusw_nosave
/* count switches */
- ldil L%fpu_csw, %r1
- ldw R%fpu_csw(%r1), %r16
+ .import umvexp, data
+ ldil L%(uvmexp+FPSWTCH), %r1
+ ldw R%(uvmexp+FPSWTCH)(%r1), %r16
ldo 31*8+PCB_FPREGS+U_PCB(%r9), %r17
ldo 1(%r16), %r16
- stw %r16, R%fpu_csw(%r1)
+ stw %r16, R%(uvmexp+FPSWTCH)(%r1)
fldds,ma -8(%r17), %fr31
fldds,ma -8(%r17), %fr30
diff --git a/sys/arch/i386/isa/npx.c b/sys/arch/i386/isa/npx.c
index 806581f4363..0df6941f654 100644
--- a/sys/arch/i386/isa/npx.c
+++ b/sys/arch/i386/isa/npx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: npx.c,v 1.35 2004/10/21 20:58:07 kettenis Exp $ */
+/* $OpenBSD: npx.c,v 1.36 2005/04/21 04:39:35 mickey Exp $ */
/* $NetBSD: npx.c,v 1.57 1996/05/12 23:12:24 mycroft Exp $ */
#if 0
@@ -698,6 +698,7 @@ npxdna_s87(struct cpu_info *ci)
ci->ci_fpcurproc = p;
p->p_addr->u_pcb.pcb_fpcpu = ci;
splx(s);
+ uvmexp.fpswtch++;
if ((p->p_md.md_flags & MDP_USEDFPU) == 0) {
fldcw(&p->p_addr->u_pcb.pcb_savefpu.sv_87.sv_env.en_cw);
diff --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c
index 0a7cd4ecbac..1154877cb97 100644
--- a/sys/arch/powerpc/powerpc/trap.c
+++ b/sys/arch/powerpc/powerpc/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.66 2005/04/17 21:34:26 kettenis Exp $ */
+/* $OpenBSD: trap.c,v 1.67 2005/04/21 04:39:35 mickey Exp $ */
/* $NetBSD: trap.c,v 1.3 1996/10/13 03:31:37 christos Exp $ */
/*
@@ -525,6 +525,7 @@ syscall_bad:
if (fpuproc)
save_fpu(fpuproc);
fpuproc = p;
+ uvmexp.fpswtch++;
enable_fpu(p);
break;
diff --git a/sys/arch/solbourne/solbourne/trap.c b/sys/arch/solbourne/solbourne/trap.c
index 493bdba4e72..33222dfa6ee 100644
--- a/sys/arch/solbourne/solbourne/trap.c
+++ b/sys/arch/solbourne/solbourne/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.1 2005/04/19 21:30:18 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.2 2005/04/21 04:39:35 mickey Exp $ */
/* OpenBSD: trap.c,v 1.42 2004/12/06 20:12:25 miod Exp */
/*
@@ -424,6 +424,7 @@ badtrap:
savefpstate(cpuinfo.fpproc->p_md.md_fpstate);
loadfpstate(fs);
cpuinfo.fpproc = p; /* now we do have it */
+ uvmexp.fpswtch++;
}
tf->tf_psr |= PSR_EF;
break;
diff --git a/sys/arch/sparc/sparc/trap.c b/sys/arch/sparc/sparc/trap.c
index cd10493565e..5ad537e4c19 100644
--- a/sys/arch/sparc/sparc/trap.c
+++ b/sys/arch/sparc/sparc/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.43 2005/04/17 18:47:51 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.44 2005/04/21 04:39:35 mickey Exp $ */
/* $NetBSD: trap.c,v 1.58 1997/09/12 08:55:01 pk Exp $ */
/*
@@ -417,6 +417,7 @@ badtrap:
savefpstate(cpuinfo.fpproc->p_md.md_fpstate);
loadfpstate(fs);
cpuinfo.fpproc = p; /* now we do have it */
+ uvmexp.fpswtch++;
}
tf->tf_psr |= PSR_EF;
break;
diff --git a/sys/arch/sparc64/sparc64/trap.c b/sys/arch/sparc64/sparc64/trap.c
index 47795b3b5ca..25a6ebbce11 100644
--- a/sys/arch/sparc64/sparc64/trap.c
+++ b/sys/arch/sparc64/sparc64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.34 2005/03/29 19:34:07 kettenis Exp $ */
+/* $OpenBSD: trap.c,v 1.35 2005/04/21 04:39:35 mickey Exp $ */
/* $NetBSD: trap.c,v 1.73 2001/08/09 01:03:01 eeh Exp $ */
/*
@@ -599,6 +599,7 @@ badtrap:
savefpstate(fpproc->p_md.md_fpstate);
loadfpstate(fs);
fpproc = p; /* now we do have it */
+ uvmexp.fpswtch++;
}
tf->tf_tstate |= (PSTATE_PEF<<TSTATE_PSTATE_SHIFT);
break;