diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/amd64/machdep.c | 11 | ||||
-rw-r--r-- | sys/arch/amd64/include/cpu.h | 12 |
2 files changed, 11 insertions, 12 deletions
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index fe16af19570..9dab8947af0 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.266 2020/05/31 06:23:56 dlg Exp $ */ +/* $OpenBSD: machdep.c,v 1.267 2020/06/03 06:54:04 dlg Exp $ */ /* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */ /*- @@ -2055,12 +2055,3 @@ 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 95f715d5e0f..5a76eb21e3c 100644 --- a/sys/arch/amd64/include/cpu.h +++ b/sys/arch/amd64/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.136 2020/05/31 06:23:56 dlg Exp $ */ +/* $OpenBSD: cpu.h,v 1.137 2020/06/03 06:54:04 dlg Exp $ */ /* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */ /*- @@ -304,7 +304,15 @@ void cpu_unidle(struct cpu_info *); #include <machine/cpufunc.h> #include <machine/psl.h> -unsigned int cpu_rnd_messybits(void); +static inline unsigned int +cpu_rnd_messybits(void) +{ + unsigned int hi, lo; + + __asm volatile("rdtsc" : "=d" (hi), "=a" (lo)); + + return (hi ^ lo); +} #endif /* _KERNEL */ |