From 580e00e95ea51b295ec9285aca0df412609003ac Mon Sep 17 00:00:00 2001 From: Owain Ainsworth Date: Wed, 9 Dec 2009 14:28:47 +0000 Subject: add cpufunc functions for the clflush instruction and the mfence instruction. ok kettenis@ as part of a larger diff. --- sys/arch/i386/include/cpufunc.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'sys/arch/i386/include') diff --git a/sys/arch/i386/include/cpufunc.h b/sys/arch/i386/include/cpufunc.h index cd66ef4dde4..3f37e86627c 100644 --- a/sys/arch/i386/include/cpufunc.h +++ b/sys/arch/i386/include/cpufunc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpufunc.h,v 1.15 2009/08/13 13:24:48 kettenis Exp $ */ +/* $OpenBSD: cpufunc.h,v 1.16 2009/12/09 14:28:46 oga Exp $ */ /* $NetBSD: cpufunc.h,v 1.8 1994/10/27 04:15:59 cgd Exp $ */ /* @@ -63,6 +63,8 @@ static __inline void enable_intr(void); static __inline u_int read_eflags(void); static __inline void write_eflags(u_int); static __inline void wbinvd(void); +static __inline void clflush(u_int32_t addr); +static __inline void mfence(void); static __inline void wrmsr(u_int, u_int64_t); static __inline u_int64_t rdmsr(u_int); static __inline void breakpoint(void); @@ -220,6 +222,17 @@ wbinvd(void) __asm __volatile("wbinvd"); } +static __inline void +clflush(u_int32_t addr) +{ + __asm __volatile("clflush %0" : "+m" (addr)); +} + +static __inline void +mfence(void) +{ + __asm __volatile("mfence" : : : "memory"); +} static __inline void wrmsr(u_int msr, u_int64_t newval) -- cgit v1.2.3