summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/alpha/alpha/machdep.c11
-rw-r--r--sys/arch/alpha/include/cpu.h4
-rw-r--r--sys/arch/amd64/amd64/machdep.c11
-rw-r--r--sys/arch/amd64/include/cpu.h4
-rw-r--r--sys/arch/arm/include/cpu.h4
-rw-r--r--sys/arch/arm64/arm64/machdep.c11
-rw-r--r--sys/arch/arm64/include/cpu.h4
-rw-r--r--sys/arch/armv7/armv7/armv7_machdep.c11
-rw-r--r--sys/arch/hppa/hppa/machdep.c11
-rw-r--r--sys/arch/hppa/include/cpu.h3
-rw-r--r--sys/arch/i386/i386/machdep.c11
-rw-r--r--sys/arch/i386/include/cpu.h4
-rw-r--r--sys/arch/landisk/landisk/machdep.c11
-rw-r--r--sys/arch/loongson/loongson/machdep.c11
-rw-r--r--sys/arch/luna88k/luna88k/machdep.c11
-rw-r--r--sys/arch/m88k/include/cpu.h4
-rw-r--r--sys/arch/macppc/macppc/machdep.c11
-rw-r--r--sys/arch/mips64/include/cpu.h4
-rw-r--r--sys/arch/octeon/octeon/machdep.c11
-rw-r--r--sys/arch/powerpc/include/cpu.h4
-rw-r--r--sys/arch/powerpc64/include/cpu.h2
-rw-r--r--sys/arch/powerpc64/powerpc64/machdep.c11
-rw-r--r--sys/arch/sgi/sgi/machdep.c11
-rw-r--r--sys/arch/sh/include/cpu.h3
-rw-r--r--sys/arch/sparc64/include/cpu.h4
-rw-r--r--sys/arch/sparc64/sparc64/machdep.c11
-rw-r--r--sys/dev/rnd.c6
27 files changed, 175 insertions, 29 deletions
diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c
index e7e3bcfcd36..09dc7e9cba5 100644
--- a/sys/arch/alpha/alpha/machdep.c
+++ b/sys/arch/alpha/alpha/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.190 2020/05/25 15:00:22 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.191 2020/05/31 06:23:56 dlg Exp $ */
/* $NetBSD: machdep.c,v 1.210 2000/06/01 17:12:38 thorpej Exp $ */
/*-
@@ -1854,3 +1854,12 @@ alpha_XXX_dmamap(v) /* XXX */
return (vtophys(v) | alpha_XXX_dmamap_or); /* XXX */
} /* XXX */
/* XXX XXX END XXX XXX */
+
+unsigned int
+cpu_rnd_messybits(void)
+{
+ struct timespec ts;
+
+ nanotime(&ts);
+ return (ts.tv_nsec ^ (ts.tv_sec << 20));
+}
diff --git a/sys/arch/alpha/include/cpu.h b/sys/arch/alpha/include/cpu.h
index 4a67099a8d5..5c06ad3aa15 100644
--- a/sys/arch/alpha/include/cpu.h
+++ b/sys/arch/alpha/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.61 2019/03/24 06:19:26 visa Exp $ */
+/* $OpenBSD: cpu.h,v 1.62 2020/05/31 06:23:56 dlg Exp $ */
/* $NetBSD: cpu.h,v 1.45 2000/08/21 02:03:12 thorpej Exp $ */
/*-
@@ -288,6 +288,8 @@ do { \
*/
#define cpu_number() alpha_pal_whami()
+unsigned int cpu_rnd_messybits(void);
+
/*
* Arguments to hardclock and gatherstats encapsulate the previous
* machine state in an opaque clockframe. On the Alpha, we use
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index de97b6c74f4..fe16af19570 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.265 2020/05/28 15:06:36 yasuoka Exp $ */
+/* $OpenBSD: machdep.c,v 1.266 2020/05/31 06:23:56 dlg Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
@@ -2055,3 +2055,12 @@ check_context(const struct reg *regs, struct trapframe *tf)
return 0;
}
+
+unsigned int
+cpu_rnd_messybits(void)
+{
+ struct timespec ts;
+
+ nanotime(&ts);
+ return (ts.tv_nsec ^ (ts.tv_sec << 20));
+}
diff --git a/sys/arch/amd64/include/cpu.h b/sys/arch/amd64/include/cpu.h
index 0c96b8abde8..95f715d5e0f 100644
--- a/sys/arch/amd64/include/cpu.h
+++ b/sys/arch/amd64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.135 2020/04/28 12:58:28 kettenis Exp $ */
+/* $OpenBSD: cpu.h,v 1.136 2020/05/31 06:23:56 dlg Exp $ */
/* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */
/*-
@@ -304,6 +304,8 @@ void cpu_unidle(struct cpu_info *);
#include <machine/cpufunc.h>
#include <machine/psl.h>
+unsigned int cpu_rnd_messybits(void);
+
#endif /* _KERNEL */
#ifdef MULTIPROCESSOR
diff --git a/sys/arch/arm/include/cpu.h b/sys/arch/arm/include/cpu.h
index c4d47ec0e18..118381e7fc7 100644
--- a/sys/arch/arm/include/cpu.h
+++ b/sys/arch/arm/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.58 2020/05/17 15:36:50 kettenis Exp $ */
+/* $OpenBSD: cpu.h,v 1.59 2020/05/31 06:23:57 dlg Exp $ */
/* $NetBSD: cpu.h,v 1.34 2003/06/23 11:01:08 martin Exp $ */
/*
@@ -249,6 +249,8 @@ void cpu_boot_secondary_processors(void);
#define curpcb curcpu()->ci_curpcb
+unsigned int cpu_rnd_messybits(void);
+
/*
* Scheduling glue
*/
diff --git a/sys/arch/arm64/arm64/machdep.c b/sys/arch/arm64/arm64/machdep.c
index 93e0f973b62..4e292479233 100644
--- a/sys/arch/arm64/arm64/machdep.c
+++ b/sys/arch/arm64/arm64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.51 2020/05/23 19:54:12 kettenis Exp $ */
+/* $OpenBSD: machdep.c,v 1.52 2020/05/31 06:23:57 dlg Exp $ */
/*
* Copyright (c) 2014 Patrick Wildt <patrick@blueri.se>
*
@@ -1247,3 +1247,12 @@ dumpregs(struct trapframe *frame)
printf("pc: 0x%016lx\n", frame->tf_elr);
printf("spsr: 0x%016lx\n", frame->tf_spsr);
}
+
+unsigned int
+cpu_rnd_messybits(void)
+{
+ struct timespec ts;
+
+ nanotime(&ts);
+ return (ts.tv_nsec ^ (ts.tv_sec << 20));
+}
diff --git a/sys/arch/arm64/include/cpu.h b/sys/arch/arm64/include/cpu.h
index 6f1da4c0720..099567d225c 100644
--- a/sys/arch/arm64/include/cpu.h
+++ b/sys/arch/arm64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.16 2020/05/17 13:36:33 kettenis Exp $ */
+/* $OpenBSD: cpu.h,v 1.17 2020/05/31 06:23:57 dlg Exp $ */
/*
* Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>
*
@@ -183,6 +183,8 @@ void cpu_boot_secondary_processors(void);
#define curpcb curcpu()->ci_curpcb
+unsigned int cpu_rnd_messybits(void);
+
/*
* Scheduling glue
*/
diff --git a/sys/arch/armv7/armv7/armv7_machdep.c b/sys/arch/armv7/armv7/armv7_machdep.c
index 81b6e72019f..1a5418cbf58 100644
--- a/sys/arch/armv7/armv7/armv7_machdep.c
+++ b/sys/arch/armv7/armv7/armv7_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: armv7_machdep.c,v 1.60 2020/05/23 20:32:47 kettenis Exp $ */
+/* $OpenBSD: armv7_machdep.c,v 1.61 2020/05/31 06:23:57 dlg Exp $ */
/* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */
/*
@@ -1013,3 +1013,12 @@ board_startup(void)
#endif
}
}
+
+unsigned int
+cpu_rnd_messybits(void)
+{
+ struct timespec ts;
+
+ nanotime(&ts);
+ return (ts.tv_nsec ^ (ts.tv_sec << 20));
+}
diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c
index 8c7d053ee51..f7bb998d53e 100644
--- a/sys/arch/hppa/hppa/machdep.c
+++ b/sys/arch/hppa/hppa/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.258 2020/05/16 14:44:44 kettenis Exp $ */
+/* $OpenBSD: machdep.c,v 1.259 2020/05/31 06:23:57 dlg Exp $ */
/*
* Copyright (c) 1999-2003 Michael Shalayeff
@@ -1496,3 +1496,12 @@ blink_led_timeout(void *vsc)
t = (((averunnable.ldavg[0] + FSCALE) * hz) >> (FSHIFT + 1));
timeout_add(&sc->bls_to, t);
}
+
+unsigned int
+cpu_rnd_messybits(void)
+{
+ struct timespec ts;
+
+ nanotime(&ts);
+ return (ts.tv_nsec ^ (ts.tv_sec << 20));
+}
diff --git a/sys/arch/hppa/include/cpu.h b/sys/arch/hppa/include/cpu.h
index 934be69ea1b..902b10e8d6b 100644
--- a/sys/arch/hppa/include/cpu.h
+++ b/sys/arch/hppa/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.91 2018/12/05 10:28:21 jsg Exp $ */
+/* $OpenBSD: cpu.h,v 1.92 2020/05/31 06:23:57 dlg Exp $ */
/*
* Copyright (c) 2000-2004 Michael Shalayeff
@@ -237,6 +237,7 @@ int copy_on_fault(void);
void switch_trampoline(void);
int cpu_dumpsize(void);
int cpu_dump(void);
+unsigned int cpu_rnd_messybits(void);
#ifdef MULTIPROCESSOR
void cpu_boot_secondary_processors(void);
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index fe97bd1c047..0d392c75802 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.635 2020/05/29 04:42:23 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.636 2020/05/31 06:23:57 dlg Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -4038,3 +4038,12 @@ intr_barrier(void *ih)
{
sched_barrier(NULL);
}
+
+unsigned int
+cpu_rnd_messybits(void)
+{
+ struct timespec ts;
+
+ nanotime(&ts);
+ return (ts.tv_nsec ^ (ts.tv_sec << 20));
+}
diff --git a/sys/arch/i386/include/cpu.h b/sys/arch/i386/include/cpu.h
index 63e5e840e96..ec4f2e432e7 100644
--- a/sys/arch/i386/include/cpu.h
+++ b/sys/arch/i386/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.169 2020/04/29 08:53:45 kettenis Exp $ */
+/* $OpenBSD: cpu.h,v 1.170 2020/05/31 06:23:57 dlg Exp $ */
/* $NetBSD: cpu.h,v 1.35 1996/05/05 19:29:26 christos Exp $ */
/*-
@@ -267,6 +267,8 @@ void cpu_unidle(struct cpu_info *);
#define want_resched (curcpu()->ci_want_resched)
+unsigned int cpu_rnd_messybits(void);
+
/*
* Preempt the current process if in interrupt from user mode,
* or after the current trap/syscall if in system mode.
diff --git a/sys/arch/landisk/landisk/machdep.c b/sys/arch/landisk/landisk/machdep.c
index 48de8c85ee4..d5ea8df1740 100644
--- a/sys/arch/landisk/landisk/machdep.c
+++ b/sys/arch/landisk/landisk/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.47 2019/04/01 07:00:52 tedu Exp $ */
+/* $OpenBSD: machdep.c,v 1.48 2020/05/31 06:23:57 dlg Exp $ */
/* $NetBSD: machdep.c,v 1.1 2006/09/01 21:26:18 uwe Exp $ */
/*-
@@ -509,3 +509,12 @@ blink_led(void *whatever)
timeout_add(&blink_tmo,
((averunnable.ldavg[0] + FSCALE) * hz) >> FSHIFT);
}
+
+unsigned int
+cpu_rnd_messybits(void)
+{
+ struct timespec ts;
+
+ nanotime(&ts);
+ return (ts.tv_nsec ^ (ts.tv_sec << 20));
+}
diff --git a/sys/arch/loongson/loongson/machdep.c b/sys/arch/loongson/loongson/machdep.c
index 53a1c403ea6..aaceb54bea8 100644
--- a/sys/arch/loongson/loongson/machdep.c
+++ b/sys/arch/loongson/loongson/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.87 2019/04/01 07:02:04 tedu Exp $ */
+/* $OpenBSD: machdep.c,v 1.88 2020/05/31 06:23:57 dlg Exp $ */
/*
* Copyright (c) 2009, 2010, 2014 Miodrag Vallat.
@@ -1354,3 +1354,12 @@ hw_ipi_intr_clear(u_long cpuid)
}
#endif /* MULTIPROCESSOR */
+
+unsigned int
+cpu_rnd_messybits(void)
+{
+ struct timespec ts;
+
+ nanotime(&ts);
+ return (ts.tv_nsec ^ (ts.tv_sec << 20));
+}
diff --git a/sys/arch/luna88k/luna88k/machdep.c b/sys/arch/luna88k/luna88k/machdep.c
index c0f11bfcc9b..9501ad85210 100644
--- a/sys/arch/luna88k/luna88k/machdep.c
+++ b/sys/arch/luna88k/luna88k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.133 2020/05/29 04:42:24 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.134 2020/05/31 06:23:57 dlg Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -1355,3 +1355,12 @@ m88k_broadcast_ipi(int ipi)
}
}
#endif
+
+unsigned int
+cpu_rnd_messybits(void)
+{
+ struct timespec ts;
+
+ nanotime(&ts);
+ return (ts.tv_nsec ^ (ts.tv_sec << 20));
+}
diff --git a/sys/arch/m88k/include/cpu.h b/sys/arch/m88k/include/cpu.h
index f6ee4eb5541..48e6d36e1d4 100644
--- a/sys/arch/m88k/include/cpu.h
+++ b/sys/arch/m88k/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.67 2019/08/28 13:48:40 aoyama Exp $ */
+/* $OpenBSD: cpu.h,v 1.68 2020/05/31 06:23:57 dlg Exp $ */
/*
* Copyright (c) 1996 Nivas Madhur
* Copyright (c) 1992, 1993
@@ -229,6 +229,8 @@ struct cpu_info *set_cpu_number(cpuid_t);
#define curpcb curcpu()->ci_curpcb
+unsigned int cpu_rnd_messybits(void);
+
#endif /* _LOCORE */
/*
diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c
index ee394d305e8..178fe0995da 100644
--- a/sys/arch/macppc/macppc/machdep.c
+++ b/sys/arch/macppc/macppc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.190 2020/05/25 15:10:18 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.191 2020/05/31 06:23:57 dlg Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
@@ -913,3 +913,12 @@ cpu_switchto(struct proc *oldproc, struct proc *newproc)
cpu_switchto_asm(oldproc, newproc);
}
+
+unsigned int
+cpu_rnd_messybits(void)
+{
+ struct timespec ts;
+
+ nanotime(&ts);
+ return (ts.tv_nsec ^ (ts.tv_sec << 20));
+}
diff --git a/sys/arch/mips64/include/cpu.h b/sys/arch/mips64/include/cpu.h
index 40e1f59a39f..6614cf9c321 100644
--- a/sys/arch/mips64/include/cpu.h
+++ b/sys/arch/mips64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.128 2019/09/02 02:35:08 deraadt Exp $ */
+/* $OpenBSD: cpu.h,v 1.129 2020/05/31 06:23:58 dlg Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -277,6 +277,8 @@ void smp_rendezvous_cpus(unsigned long, void (*)(void *), void *arg);
extern void (*md_startclock)(struct cpu_info *);
void cp0_calibrate(struct cpu_info *);
+unsigned int cpu_rnd_messybits(void);
+
#include <machine/frame.h>
/*
diff --git a/sys/arch/octeon/octeon/machdep.c b/sys/arch/octeon/octeon/machdep.c
index 7b4875ca680..1387af284ca 100644
--- a/sys/arch/octeon/octeon/machdep.c
+++ b/sys/arch/octeon/octeon/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.122 2020/05/29 04:42:24 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.123 2020/05/31 06:23:58 dlg Exp $ */
/*
* Copyright (c) 2009, 2010 Miodrag Vallat.
@@ -1247,3 +1247,12 @@ hw_cpu_hatch(struct cpu_info *ci)
cpu_switchto(NULL, sched_chooseproc());
}
#endif /* MULTIPROCESSOR */
+
+unsigned int
+cpu_rnd_messybits(void)
+{
+ struct timespec ts;
+
+ nanotime(&ts);
+ return (ts.tv_nsec ^ (ts.tv_sec << 20));
+}
diff --git a/sys/arch/powerpc/include/cpu.h b/sys/arch/powerpc/include/cpu.h
index 65d3625d692..cc3dcd16aa6 100644
--- a/sys/arch/powerpc/include/cpu.h
+++ b/sys/arch/powerpc/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.66 2020/03/17 10:14:45 kettenis Exp $ */
+/* $OpenBSD: cpu.h,v 1.67 2020/05/31 06:23:58 dlg Exp $ */
/* $NetBSD: cpu.h,v 1.1 1996/09/30 16:34:21 ws Exp $ */
/*
@@ -161,6 +161,8 @@ extern int ppc_nobat;
void cpu_bootstrap(void);
+unsigned int cpu_rnd_messybits(void);
+
/*
* This is used during profiling to integrate system time.
*/
diff --git a/sys/arch/powerpc64/include/cpu.h b/sys/arch/powerpc64/include/cpu.h
index 30efd9f46ad..86713353383 100644
--- a/sys/arch/powerpc64/include/cpu.h
+++ b/sys/arch/powerpc64/include/cpu.h
@@ -51,6 +51,8 @@ register struct cpu_info *__curcpu asm("r13");
#define CPU_BUSY_CYCLE() do {} while (0)
#define signotify(p) setsoftast()
+unsigned int cpu_rnd_messybits(void);
+
void need_resched(struct cpu_info *);
#define clear_resched(ci) ((ci)->ci_want_resched = 0)
diff --git a/sys/arch/powerpc64/powerpc64/machdep.c b/sys/arch/powerpc64/powerpc64/machdep.c
index d7677469bbc..bae64a1f297 100644
--- a/sys/arch/powerpc64/powerpc64/machdep.c
+++ b/sys/arch/powerpc64/powerpc64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.10 2020/05/27 22:22:04 gkoehler Exp $ */
+/* $OpenBSD: machdep.c,v 1.11 2020/05/31 06:23:58 dlg Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@@ -460,3 +460,12 @@ boot(int howto)
continue;
/* NOTREACHED */
}
+
+unsigned int
+cpu_rnd_messybits(void)
+{
+ struct timespec ts;
+
+ nanotime(&ts);
+ return (ts.tv_nsec ^ (ts.tv_sec << 20));
+}
diff --git a/sys/arch/sgi/sgi/machdep.c b/sys/arch/sgi/sgi/machdep.c
index 2cd4e1ead57..d251c15fc01 100644
--- a/sys/arch/sgi/sgi/machdep.c
+++ b/sys/arch/sgi/sgi/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.161 2019/12/20 13:34:41 visa Exp $ */
+/* $OpenBSD: machdep.c,v 1.162 2020/05/31 06:23:58 dlg Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -1017,3 +1017,12 @@ intr_barrier(void *cookie)
{
sched_barrier(NULL);
}
+
+unsigned int
+cpu_rnd_messybits(void)
+{
+ struct timespec ts;
+
+ nanotime(&ts);
+ return (ts.tv_nsec ^ (ts.tv_sec << 20));
+}
diff --git a/sys/arch/sh/include/cpu.h b/sys/arch/sh/include/cpu.h
index c548e265e74..04384bbe847 100644
--- a/sys/arch/sh/include/cpu.h
+++ b/sys/arch/sh/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.28 2019/03/24 06:09:09 visa Exp $ */
+/* $OpenBSD: cpu.h,v 1.29 2020/05/31 06:23:58 dlg Exp $ */
/* $NetBSD: cpu.h,v 1.41 2006/01/21 04:24:12 uwe Exp $ */
/*-
@@ -271,6 +271,7 @@ u_int cpu_dump(int (*)(dev_t, daddr_t, caddr_t, size_t), daddr_t *);
u_int cpu_dumpsize(void);
void dumpconf(void);
void dumpsys(void);
+unsigned int cpu_rnd_messybits(void);
static inline u_long
intr_disable(void)
diff --git a/sys/arch/sparc64/include/cpu.h b/sys/arch/sparc64/include/cpu.h
index c61fb5d3c9e..d3873dc821d 100644
--- a/sys/arch/sparc64/include/cpu.h
+++ b/sys/arch/sparc64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.93 2018/12/05 10:28:21 jsg Exp $ */
+/* $OpenBSD: cpu.h,v 1.94 2020/05/31 06:23:58 dlg Exp $ */
/* $NetBSD: cpu.h,v 1.28 2001/06/14 22:56:58 thorpej Exp $ */
/*
@@ -211,6 +211,8 @@ void cpu_unidle(struct cpu_info *);
#define curpcb __curcpu->ci_cpcb
#define fpproc __curcpu->ci_fpproc
+unsigned int cpu_rnd_messybits(void);
+
/*
* On processors with multiple threads we force a thread switch.
*
diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c
index ae4fdc94274..05aa4342943 100644
--- a/sys/arch/sparc64/sparc64/machdep.c
+++ b/sys/arch/sparc64/sparc64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.195 2020/05/29 04:42:24 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.196 2020/05/31 06:23:58 dlg Exp $ */
/* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */
/*-
@@ -2114,3 +2114,12 @@ blink_led_timeout(void *vsc)
t = (((averunnable.ldavg[0] + FSCALE) * hz) >> (FSHIFT + 1));
timeout_add(&sc->bls_to, t);
}
+
+unsigned int
+cpu_rnd_messybits(void)
+{
+ struct timespec ts;
+
+ nanotime(&ts);
+ return (ts.tv_nsec ^ (ts.tv_sec << 20));
+}
diff --git a/sys/dev/rnd.c b/sys/dev/rnd.c
index 8802965514a..ae68999910c 100644
--- a/sys/dev/rnd.c
+++ b/sys/dev/rnd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rnd.c,v 1.219 2020/05/29 04:42:24 deraadt Exp $ */
+/* $OpenBSD: rnd.c,v 1.220 2020/05/31 06:23:56 dlg Exp $ */
/*
* Copyright (c) 2011 Theo de Raadt.
@@ -177,13 +177,11 @@ void
enqueue_randomness(u_int val)
{
struct rand_event *rep;
- struct timespec ts;
int e;
- nanotime(&ts);
e = (atomic_inc_int_nv(&rnd_event_prod) - 1) & (QEVLEN-1);
rep = &rnd_event_space[e];
- rep->re_time += ts.tv_nsec ^ (ts.tv_sec << 20);
+ rep->re_time += cpu_rnd_messybits();
rep->re_val += val;
if (rnd_cold) {