From e4fade54070a8d98d2cc1d88be1343c3a8f2770e Mon Sep 17 00:00:00 2001 From: jmatthew Date: Sat, 17 Jun 2017 09:32:26 +0000 Subject: [PATCH] add rdtsc() to match amd64 ok mikeb@ mlarkin@ --- sys/arch/i386/include/cpufunc.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/arch/i386/include/cpufunc.h b/sys/arch/i386/include/cpufunc.h index 8ae5382d828..fb745da8edb 100644 --- a/sys/arch/i386/include/cpufunc.h +++ b/sys/arch/i386/include/cpufunc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpufunc.h,v 1.25 2017/05/27 12:21:50 tedu Exp $ */ +/* $OpenBSD: cpufunc.h,v 1.26 2017/06/17 09:32:26 jmatthew Exp $ */ /* $NetBSD: cpufunc.h,v 1.8 1994/10/27 04:15:59 cgd Exp $ */ /* @@ -217,6 +217,15 @@ mfence(void) __asm volatile("mfence" : : : "memory"); } +static __inline u_int64_t +rdtsc(void) +{ + uint64_t tsc; + + __asm volatile("rdtsc" : "=A" (tsc)); + return (tsc); +} + static __inline void wrmsr(u_int msr, u_int64_t newval) { -- 2.20.1