summaryrefslogtreecommitdiff
path: root/sys/arch/amd64/include/cpufunc.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/amd64/include/cpufunc.h')
-rw-r--r--sys/arch/amd64/include/cpufunc.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/arch/amd64/include/cpufunc.h b/sys/arch/amd64/include/cpufunc.h
index f0599634079..bda18a00287 100644
--- a/sys/arch/amd64/include/cpufunc.h
+++ b/sys/arch/amd64/include/cpufunc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpufunc.h,v 1.13 2016/09/04 09:22:28 mpi Exp $ */
+/* $OpenBSD: cpufunc.h,v 1.14 2017/04/27 06:16:39 mlarkin Exp $ */
/* $NetBSD: cpufunc.h,v 1.3 2003/05/08 10:27:43 fvdl Exp $ */
/*-
@@ -335,6 +335,16 @@ xsetbv(uint32_t reg, uint64_t mask)
__asm volatile("xsetbv" :: "c" (reg), "a" (lo), "d" (hi) : "memory");
}
+static __inline uint64_t
+xgetbv(uint32_t reg)
+{
+ uint32_t lo, hi;
+
+ __asm volatile("xgetbv" : "=a" (lo), "=d" (hi) : "c" (reg));
+
+ return (((uint64_t)hi << 32) | (uint64_t)lo);
+}
+
/* Break into DDB/KGDB. */
static __inline void
breakpoint(void)