summaryrefslogtreecommitdiff
path: root/sys/arch/i386/include
diff options
context:
space:
mode:
authorAlexander Yurchenko <grange@cvs.openbsd.org>2003-10-24 09:03:21 +0000
committerAlexander Yurchenko <grange@cvs.openbsd.org>2003-10-24 09:03:21 +0000
commitf49d31942cf21d6d0e1a31f30776507cbe216638 (patch)
tree1a3472bcfc925e0f144569a2e194956ba5dd51a4 /sys/arch/i386/include
parent45a92588bf4369748a3b9d7b473fae9ac8a1b532 (diff)
No need to have several implementations of {read,write}_eflags(),
put it to cpufunc.h. ok weingart@ tedu@
Diffstat (limited to 'sys/arch/i386/include')
-rw-r--r--sys/arch/i386/include/cpufunc.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/sys/arch/i386/include/cpufunc.h b/sys/arch/i386/include/cpufunc.h
index 193c12e829e..514d634c8f2 100644
--- a/sys/arch/i386/include/cpufunc.h
+++ b/sys/arch/i386/include/cpufunc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpufunc.h,v 1.9 2003/05/27 23:52:01 fgsch Exp $ */
+/* $OpenBSD: cpufunc.h,v 1.10 2003/10/24 09:03:20 grange Exp $ */
/* $NetBSD: cpufunc.h,v 1.8 1994/10/27 04:15:59 cgd Exp $ */
/*
@@ -55,6 +55,8 @@ static __inline u_int rcr4(void);
static __inline void tlbflush(void);
static __inline void disable_intr(void);
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 wrmsr(u_int, u_int64_t);
static __inline u_int64_t rdmsr(u_int);
@@ -161,6 +163,21 @@ enable_intr(void)
__asm __volatile("sti");
}
+static __inline u_int
+read_eflags(void)
+{
+ u_int ef;
+
+ __asm __volatile("pushfl; popl %0" : "=r" (ef));
+ return (ef);
+}
+
+static __inline void
+write_eflags(u_int ef)
+{
+ __asm __volatile("pushl %0; popfl" : : "r" (ef));
+}
+
static __inline void
wbinvd(void)
{