summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJeff Roberson <jeff@FreeBSD.org>2008-04-18 05:47:56 +0000
committerJeff Roberson <jeff@FreeBSD.org>2008-04-18 05:47:56 +0000
commit66247efa5a318851128e6a13b6517e812b7a800c (patch)
tree20907530b877615853105653b47e518194e874d0 /sys
parent6bdf667b511f5b08aad68440306a31a60d61377b (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/include/cpufunc.h13
-rw-r--r--sys/i386/include/cpufunc.h13
2 files changed, 26 insertions, 0 deletions
diff --git a/sys/amd64/include/cpufunc.h b/sys/amd64/include/cpufunc.h
index 2c5fcb2acda1..ac0db87ee2fc 100644
--- a/sys/amd64/include/cpufunc.h
+++ b/sys/amd64/include/cpufunc.h
@@ -514,6 +514,19 @@ load_es(u_int sel)
__asm __volatile("movl %0,%%es" : : "rm" (sel));
}
+static inline void
+cpu_monitor(const void *addr, int extensions, int hints)
+{
+ __asm __volatile("monitor;"
+ : :"a" (addr), "c" (extensions), "d"(hints));
+}
+
+static inline void
+cpu_mwait(int extensions, int hints)
+{
+ __asm __volatile("mwait;" : :"a" (hints), "c" (extensions));
+}
+
#ifdef _KERNEL
/* This is defined in <machine/specialreg.h> but is too painful to get to */
#ifndef MSR_FSBASE
diff --git a/sys/i386/include/cpufunc.h b/sys/i386/include/cpufunc.h
index f3f671503a3b..85b3f3dfad33 100644
--- a/sys/i386/include/cpufunc.h
+++ b/sys/i386/include/cpufunc.h
@@ -106,6 +106,19 @@ enable_intr(void)
__asm __volatile("sti");
}
+static inline void
+cpu_monitor(const void *addr, int extensions, int hints)
+{
+ __asm __volatile("monitor;"
+ : :"a" (addr), "c" (extensions), "d"(hints));
+}
+
+static inline void
+cpu_mwait(int extensions, int hints)
+{
+ __asm __volatile("mwait;" : :"a" (hints), "c" (extensions));
+}
+
#ifdef _KERNEL
#define HAVE_INLINE_FFS