Index: dev/rnd.c =================================================================== RCS file: /cvs/src/sys/dev/rnd.c,v retrieving revision 1.219 diff -u -p -r1.219 rnd.c --- dev/rnd.c 29 May 2020 04:42:24 -0000 1.219 +++ dev/rnd.c 30 May 2020 04:18:17 -0000 @@ -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_messybytes(); rep->re_val += val; if (rnd_cold) { Index: arch/alpha/alpha/machdep.c =================================================================== RCS file: /cvs/src/sys/arch/alpha/alpha/machdep.c,v retrieving revision 1.190 diff -u -p -r1.190 machdep.c --- arch/alpha/alpha/machdep.c 25 May 2020 15:00:22 -0000 1.190 +++ arch/alpha/alpha/machdep.c 30 May 2020 04:18:17 -0000 @@ -1854,3 +1853,13 @@ alpha_XXX_dmamap(v) /* XXX */ return (vtophys(v) | alpha_XXX_dmamap_or); /* XXX */ } /* XXX */ /* XXX XXX END XXX XXX */ + +unsigned int +cpu_rnd_messybytes(void) +{ + struct timespec ts; + + nanotime(&ts); + + return (ts.tv_nsec ^ (ts.tv_sec << 20)); +} Index: arch/alpha/include/cpu.h =================================================================== RCS file: /cvs/src/sys/arch/alpha/include/cpu.h,v retrieving revision 1.61 diff -u -p -r1.61 cpu.h --- arch/alpha/include/cpu.h 24 Mar 2019 06:19:26 -0000 1.61 +++ arch/alpha/include/cpu.h 30 May 2020 04:18:17 -0000 @@ -288,6 +288,8 @@ do { \ */ #define cpu_number() alpha_pal_whami() +unsigned int cpu_rnd_messybytes(void); + /* * Arguments to hardclock and gatherstats encapsulate the previous * machine state in an opaque clockframe. On the Alpha, we use Index: arch/amd64/amd64/machdep.c =================================================================== RCS file: /cvs/src/sys/arch/amd64/amd64/machdep.c,v retrieving revision 1.264 diff -u -p -r1.264 machdep.c --- arch/amd64/amd64/machdep.c 16 May 2020 14:44:44 -0000 1.264 +++ arch/amd64/amd64/machdep.c 30 May 2020 04:18:17 -0000 @@ -2067,3 +2067,13 @@ check_context(const struct reg *regs, st return 0; } + +unsigned int +cpu_rnd_messybytes(void) +{ + struct timespec ts; + + nanotime(&ts); + + return (ts.tv_nsec ^ (ts.tv_sec << 20)); +} Index: arch/amd64/include/cpu.h =================================================================== RCS file: /cvs/src/sys/arch/amd64/include/cpu.h,v retrieving revision 1.135 diff -u -p -r1.135 cpu.h --- arch/amd64/include/cpu.h 28 Apr 2020 12:58:28 -0000 1.135 +++ arch/amd64/include/cpu.h 30 May 2020 04:18:17 -0000 @@ -304,6 +304,8 @@ void cpu_unidle(struct cpu_info *); #include #include +unsigned int cpu_rnd_messybytes(void); + #endif /* _KERNEL */ #ifdef MULTIPROCESSOR Index: arch/arm/include/cpu.h =================================================================== RCS file: /cvs/src/sys/arch/arm/include/cpu.h,v retrieving revision 1.58 diff -u -p -r1.58 cpu.h --- arch/arm/include/cpu.h 17 May 2020 15:36:50 -0000 1.58 +++ arch/arm/include/cpu.h 30 May 2020 04:18:17 -0000 @@ -249,6 +249,8 @@ void cpu_boot_secondary_processors(void) #define curpcb curcpu()->ci_curpcb +unsigned int cpu_rnd_messybytes(void); + /* * Scheduling glue */ Index: arch/arm64/arm64/machdep.c =================================================================== RCS file: /cvs/src/sys/arch/arm64/arm64/machdep.c,v retrieving revision 1.51 diff -u -p -r1.51 machdep.c --- arch/arm64/arm64/machdep.c 23 May 2020 19:54:12 -0000 1.51 +++ arch/arm64/arm64/machdep.c 30 May 2020 04:18:17 -0000 @@ -1247,3 +1247,13 @@ dumpregs(struct trapframe *frame) printf("pc: 0x%016lx\n", frame->tf_elr); printf("spsr: 0x%016lx\n", frame->tf_spsr); } + +unsigned int +cpu_rnd_messybytes(void) +{ + struct timespec ts; + + nanotime(&ts); + + return (ts.tv_nsec ^ (ts.tv_sec << 20)); +} Index: arch/arm64/include/cpu.h =================================================================== RCS file: /cvs/src/sys/arch/arm64/include/cpu.h,v retrieving revision 1.16 diff -u -p -r1.16 cpu.h --- arch/arm64/include/cpu.h 17 May 2020 13:36:33 -0000 1.16 +++ arch/arm64/include/cpu.h 30 May 2020 04:18:17 -0000 @@ -183,6 +183,8 @@ void cpu_boot_secondary_processors(void) #define curpcb curcpu()->ci_curpcb +unsigned int cpu_rnd_messybytes(void); + /* * Scheduling glue */ Index: arch/hppa/hppa/machdep.c =================================================================== RCS file: /cvs/src/sys/arch/hppa/hppa/machdep.c,v retrieving revision 1.258 diff -u -p -r1.258 machdep.c --- arch/hppa/hppa/machdep.c 16 May 2020 14:44:44 -0000 1.258 +++ arch/hppa/hppa/machdep.c 30 May 2020 04:18:17 -0000 @@ -1496,3 +1496,13 @@ blink_led_timeout(void *vsc) t = (((averunnable.ldavg[0] + FSCALE) * hz) >> (FSHIFT + 1)); timeout_add(&sc->bls_to, t); } + +unsigned int +cpu_rnd_messybytes(void) +{ + struct timespec ts; + + nanotime(&ts); + + return (ts.tv_nsec ^ (ts.tv_sec << 20)); +} Index: arch/hppa/include/cpu.h =================================================================== RCS file: /cvs/src/sys/arch/hppa/include/cpu.h,v retrieving revision 1.91 diff -u -p -r1.91 cpu.h --- arch/hppa/include/cpu.h 5 Dec 2018 10:28:21 -0000 1.91 +++ arch/hppa/include/cpu.h 30 May 2020 04:18:17 -0000 @@ -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_messybytes(void); #ifdef MULTIPROCESSOR void cpu_boot_secondary_processors(void); Index: arch/i386/i386/machdep.c =================================================================== RCS file: /cvs/src/sys/arch/i386/i386/machdep.c,v retrieving revision 1.633 diff -u -p -r1.633 machdep.c --- arch/i386/i386/machdep.c 16 May 2020 14:44:44 -0000 1.633 +++ arch/i386/i386/machdep.c 30 May 2020 04:18:17 -0000 @@ -4037,3 +4037,13 @@ intr_barrier(void *ih) { sched_barrier(NULL); } + +unsigned int +cpu_rnd_messybytes(void) +{ + struct timespec ts; + + nanotime(&ts); + + return (ts.tv_nsec ^ (ts.tv_sec << 20)); +} Index: arch/i386/include/cpu.h =================================================================== RCS file: /cvs/src/sys/arch/i386/include/cpu.h,v retrieving revision 1.169 diff -u -p -r1.169 cpu.h --- arch/i386/include/cpu.h 29 Apr 2020 08:53:45 -0000 1.169 +++ arch/i386/include/cpu.h 30 May 2020 04:18:17 -0000 @@ -267,6 +267,8 @@ void cpu_unidle(struct cpu_info *); #define want_resched (curcpu()->ci_want_resched) +unsigned int cpu_rnd_messybytes(void); + /* * Preempt the current process if in interrupt from user mode, * or after the current trap/syscall if in system mode. Index: arch/landisk/landisk/machdep.c =================================================================== RCS file: /cvs/src/sys/arch/landisk/landisk/machdep.c,v retrieving revision 1.47 diff -u -p -r1.47 machdep.c --- arch/landisk/landisk/machdep.c 1 Apr 2019 07:00:52 -0000 1.47 +++ arch/landisk/landisk/machdep.c 30 May 2020 04:18:17 -0000 @@ -509,3 +509,13 @@ blink_led(void *whatever) timeout_add(&blink_tmo, ((averunnable.ldavg[0] + FSCALE) * hz) >> FSHIFT); } + +unsigned int +cpu_rnd_messybytes(void) +{ + struct timespec ts; + + nanotime(&ts); + + return (ts.tv_nsec ^ (ts.tv_sec << 20)); +} Index: arch/loongson/loongson/machdep.c =================================================================== RCS file: /cvs/src/sys/arch/loongson/loongson/machdep.c,v retrieving revision 1.87 diff -u -p -r1.87 machdep.c --- arch/loongson/loongson/machdep.c 1 Apr 2019 07:02:04 -0000 1.87 +++ arch/loongson/loongson/machdep.c 30 May 2020 04:18:17 -0000 @@ -1354,3 +1354,13 @@ hw_ipi_intr_clear(u_long cpuid) } #endif /* MULTIPROCESSOR */ + +unsigned int +cpu_rnd_messybytes(void) +{ + struct timespec ts; + + nanotime(&ts); + + return (ts.tv_nsec ^ (ts.tv_sec << 20)); +} Index: arch/luna88k/luna88k/machdep.c =================================================================== RCS file: /cvs/src/sys/arch/luna88k/luna88k/machdep.c,v retrieving revision 1.132 diff -u -p -r1.132 machdep.c --- arch/luna88k/luna88k/machdep.c 16 May 2020 14:44:44 -0000 1.132 +++ arch/luna88k/luna88k/machdep.c 30 May 2020 04:18:17 -0000 @@ -1356,3 +1356,13 @@ m88k_broadcast_ipi(int ipi) } } #endif + +unsigned int +cpu_rnd_messybytes(void) +{ + struct timespec ts; + + nanotime(&ts); + + return (ts.tv_nsec ^ (ts.tv_sec << 20)); +} Index: arch/m88k/include/cpu.h =================================================================== RCS file: /cvs/src/sys/arch/m88k/include/cpu.h,v retrieving revision 1.67 diff -u -p -r1.67 cpu.h --- arch/m88k/include/cpu.h 28 Aug 2019 13:48:40 -0000 1.67 +++ arch/m88k/include/cpu.h 30 May 2020 04:18:17 -0000 @@ -229,6 +229,8 @@ struct cpu_info *set_cpu_number(cpuid_t) #define curpcb curcpu()->ci_curpcb +unsigned int cpu_rnd_messybytes(void); + #endif /* _LOCORE */ /* Index: arch/macppc/macppc/machdep.c =================================================================== RCS file: /cvs/src/sys/arch/macppc/macppc/machdep.c,v retrieving revision 1.190 diff -u -p -r1.190 machdep.c --- arch/macppc/macppc/machdep.c 25 May 2020 15:10:18 -0000 1.190 +++ arch/macppc/macppc/machdep.c 30 May 2020 04:18:17 -0000 @@ -913,3 +913,13 @@ cpu_switchto(struct proc *oldproc, struc cpu_switchto_asm(oldproc, newproc); } + +unsigned int +cpu_rnd_messybytes(void) +{ + struct timespec ts; + + nanotime(&ts); + + return (ts.tv_nsec ^ (ts.tv_sec << 20)); +} Index: arch/mips64/include/cpu.h =================================================================== RCS file: /cvs/src/sys/arch/mips64/include/cpu.h,v retrieving revision 1.128 diff -u -p -r1.128 cpu.h --- arch/mips64/include/cpu.h 2 Sep 2019 02:35:08 -0000 1.128 +++ arch/mips64/include/cpu.h 30 May 2020 04:18:17 -0000 @@ -277,6 +277,8 @@ void smp_rendezvous_cpus(unsigned long, extern void (*md_startclock)(struct cpu_info *); void cp0_calibrate(struct cpu_info *); +unsigned int cpu_rnd_messybytes(void); + #include /* Index: arch/octeon/octeon/machdep.c =================================================================== RCS file: /cvs/src/sys/arch/octeon/octeon/machdep.c,v retrieving revision 1.121 diff -u -p -r1.121 machdep.c --- arch/octeon/octeon/machdep.c 25 May 2020 13:04:25 -0000 1.121 +++ arch/octeon/octeon/machdep.c 30 May 2020 04:18:17 -0000 @@ -1248,3 +1248,13 @@ hw_cpu_hatch(struct cpu_info *ci) cpu_switchto(NULL, sched_chooseproc()); } #endif /* MULTIPROCESSOR */ + +unsigned int +cpu_rnd_messybytes(void) +{ + struct timespec ts; + + nanotime(&ts); + + return (ts.tv_nsec ^ (ts.tv_sec << 20)); +} Index: arch/powerpc/include/cpu.h =================================================================== RCS file: /cvs/src/sys/arch/powerpc/include/cpu.h,v retrieving revision 1.66 diff -u -p -r1.66 cpu.h --- arch/powerpc/include/cpu.h 17 Mar 2020 10:14:45 -0000 1.66 +++ arch/powerpc/include/cpu.h 30 May 2020 04:18:17 -0000 @@ -161,6 +161,8 @@ extern int ppc_nobat; void cpu_bootstrap(void); +unsigned int cpu_rnd_messybytes(void); + /* * This is used during profiling to integrate system time. */ Index: arch/powerpc64/include/cpu.h =================================================================== RCS file: /cvs/src/sys/arch/powerpc64/include/cpu.h,v retrieving revision 1.5 diff -u -p -r1.5 cpu.h --- arch/powerpc64/include/cpu.h 22 May 2020 16:27:49 -0000 1.5 +++ arch/powerpc64/include/cpu.h 30 May 2020 04:18:17 -0000 @@ -51,6 +51,8 @@ register struct cpu_info *__curcpu asm(" #define CPU_BUSY_CYCLE() do {} while (0) #define signotify(p) setsoftast() +unsigned int cpu_rnd_messybytes(void); + void need_resched(struct cpu_info *); #define clear_resched(ci) ((ci)->ci_want_resched = 0) Index: arch/powerpc64/powerpc64/machdep.c =================================================================== RCS file: /cvs/src/sys/arch/powerpc64/powerpc64/machdep.c,v retrieving revision 1.9 diff -u -p -r1.9 machdep.c --- arch/powerpc64/powerpc64/machdep.c 23 May 2020 11:40:16 -0000 1.9 +++ arch/powerpc64/powerpc64/machdep.c 30 May 2020 04:18:17 -0000 @@ -434,3 +434,13 @@ boot(int howto) continue; /* NOTREACHED */ } + +unsigned int +cpu_rnd_messybytes(void) +{ + struct timespec ts; + + nanotime(&ts); + + return (ts.tv_nsec ^ (ts.tv_sec << 20)); +} Index: arch/sgi/sgi/machdep.c =================================================================== RCS file: /cvs/src/sys/arch/sgi/sgi/machdep.c,v retrieving revision 1.161 diff -u -p -r1.161 machdep.c --- arch/sgi/sgi/machdep.c 20 Dec 2019 13:34:41 -0000 1.161 +++ arch/sgi/sgi/machdep.c 30 May 2020 04:18:17 -0000 @@ -1017,3 +1017,13 @@ intr_barrier(void *cookie) { sched_barrier(NULL); } + +unsigned int +cpu_rnd_messybytes(void) +{ + struct timespec ts; + + nanotime(&ts); + + return (ts.tv_nsec ^ (ts.tv_sec << 20)); +} Index: arch/sh/include/cpu.h =================================================================== RCS file: /cvs/src/sys/arch/sh/include/cpu.h,v retrieving revision 1.28 diff -u -p -r1.28 cpu.h --- arch/sh/include/cpu.h 24 Mar 2019 06:09:09 -0000 1.28 +++ arch/sh/include/cpu.h 30 May 2020 04:18:17 -0000 @@ -271,6 +271,7 @@ u_int cpu_dump(int (*)(dev_t, daddr_t, c u_int cpu_dumpsize(void); void dumpconf(void); void dumpsys(void); +unsigned int cpu_rnd_messybytes(void); static inline u_long intr_disable(void) Index: arch/sparc64/include/cpu.h =================================================================== RCS file: /cvs/src/sys/arch/sparc64/include/cpu.h,v retrieving revision 1.93 diff -u -p -r1.93 cpu.h --- arch/sparc64/include/cpu.h 5 Dec 2018 10:28:21 -0000 1.93 +++ arch/sparc64/include/cpu.h 30 May 2020 04:18:17 -0000 @@ -211,6 +211,8 @@ void cpu_unidle(struct cpu_info *); #define curpcb __curcpu->ci_cpcb #define fpproc __curcpu->ci_fpproc +unsigned int cpu_rnd_messybytes(void); + /* * On processors with multiple threads we force a thread switch. * Index: arch/sparc64/sparc64/machdep.c =================================================================== RCS file: /cvs/src/sys/arch/sparc64/sparc64/machdep.c,v retrieving revision 1.194 diff -u -p -r1.194 machdep.c --- arch/sparc64/sparc64/machdep.c 16 May 2020 14:44:45 -0000 1.194 +++ arch/sparc64/sparc64/machdep.c 30 May 2020 04:18:17 -0000 @@ -2115,3 +2115,13 @@ blink_led_timeout(void *vsc) t = (((averunnable.ldavg[0] + FSCALE) * hz) >> (FSHIFT + 1)); timeout_add(&sc->bls_to, t); } + +unsigned int +cpu_rnd_messybytes(void) +{ + struct timespec ts; + + nanotime(&ts); + + return (ts.tv_nsec ^ (ts.tv_sec << 20)); +}