summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorHenric Jungheim <henric@cvs.openbsd.org>2007-08-14 20:10:06 +0000
committerHenric Jungheim <henric@cvs.openbsd.org>2007-08-14 20:10:06 +0000
commit92043168f10551988cfb03903c51dacd1ad4fa7b (patch)
tree4c4fab91412a51a73e7ddc6c1b3c8d3b1be75e9e /sys
parent43beb92f1c2c945bc25d93337f5fe2ab279110a2 (diff)
Work-around an interaction between FPU context switching and the VIA
Padlock entropy polling on SMP boxes. ok deraadt@, kettenis@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/i386/i386/via.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/arch/i386/i386/via.c b/sys/arch/i386/i386/via.c
index 9060e5aa67c..6352f08f20f 100644
--- a/sys/arch/i386/i386/via.c
+++ b/sys/arch/i386/i386/via.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: via.c,v 1.11 2007/08/07 09:45:24 markus Exp $ */
+/* $OpenBSD: via.c,v 1.12 2007/08/14 20:10:05 henric Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -538,6 +538,9 @@ viac3_rnd(void *v)
struct timeout *tmo = v;
unsigned int *p, i, rv, creg0, len = VIAC3_RNG_BUFSIZ;
static int buffer[VIAC3_RNG_BUFSIZ + 2]; /* XXX why + 2? */
+#ifdef MULTIPROCESSOR
+ int s = splipi();
+#endif
creg0 = rcr0(); /* Permit access to SIMD/FPU path */
lcr0(creg0 & ~(CR0_EM|CR0_TS));
@@ -553,6 +556,10 @@ viac3_rnd(void *v)
lcr0(creg0);
+#ifdef MULTIPROCESSOR
+ splx(s);
+#endif
+
for (i = 0, p = buffer; i < VIAC3_RNG_BUFSIZ; i++, p++)
add_true_randomness(*p);