From: jmatthew Date: Sat, 17 Jun 2017 09:32:26 +0000 (+0000) Subject: add rdtsc() to match amd64 X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e4fade54070a8d98d2cc1d88be1343c3a8f2770e;p=openbsd add rdtsc() to match amd64 ok mikeb@ mlarkin@ --- 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) {