summaryrefslogtreecommitdiff
path: root/sys/arch/i386/include
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2009-12-09 14:28:47 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2009-12-09 14:28:47 +0000
commit580e00e95ea51b295ec9285aca0df412609003ac (patch)
tree6cb584ef90edf8881adc701a7fe8e81fc7135891 /sys/arch/i386/include
parent62e20001a22537cd09005eaa87a882f508f37eb1 (diff)
add cpufunc functions for the clflush instruction and the mfence
instruction. ok kettenis@ as part of a larger diff.
Diffstat (limited to 'sys/arch/i386/include')
-rw-r--r--sys/arch/i386/include/cpufunc.h15
1 files changed, 14 insertions, 1 deletions
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)