diff options
author | Jonathan Matthew <jmatthew@cvs.openbsd.org> | 2017-06-17 09:32:27 +0000 |
---|---|---|
committer | Jonathan Matthew <jmatthew@cvs.openbsd.org> | 2017-06-17 09:32:27 +0000 |
commit | 5f0fc03ac6c7042c0bc946ad3c53356240f397cf (patch) | |
tree | 4256f7013708b4acf4f19ecef957fbceecba4bb1 /sys/arch | |
parent | 702d0925cf077204273d969d2621052366b7f640 (diff) |
add rdtsc() to match amd64
ok mikeb@ mlarkin@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/i386/include/cpufunc.h | 11 |
1 files changed, 10 insertions, 1 deletions
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) { |