diff options
author | Alexander Yurchenko <grange@cvs.openbsd.org> | 2003-10-24 09:03:21 +0000 |
---|---|---|
committer | Alexander Yurchenko <grange@cvs.openbsd.org> | 2003-10-24 09:03:21 +0000 |
commit | f49d31942cf21d6d0e1a31f30776507cbe216638 (patch) | |
tree | 1a3472bcfc925e0f144569a2e194956ba5dd51a4 /sys/arch/i386 | |
parent | 45a92588bf4369748a3b9d7b473fae9ac8a1b532 (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')
-rw-r--r-- | sys/arch/i386/i386/longrun.c | 7 | ||||
-rw-r--r-- | sys/arch/i386/include/cpufunc.h | 19 | ||||
-rw-r--r-- | sys/arch/i386/isa/npx.c | 7 |
3 files changed, 20 insertions, 13 deletions
diff --git a/sys/arch/i386/i386/longrun.c b/sys/arch/i386/i386/longrun.c index 0b81a538479..ef13a266eb4 100644 --- a/sys/arch/i386/i386/longrun.c +++ b/sys/arch/i386/i386/longrun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: longrun.c,v 1.4 2003/07/07 03:07:19 tedu Exp $ */ +/* $OpenBSD: longrun.c,v 1.5 2003/10/24 09:03:20 grange Exp $ */ /* * Copyright (c) 2003 Ted Unangst * Copyright (c) 2001 Tamotsu Hattori @@ -54,11 +54,6 @@ union msrinfo { #define LONGRUN_MODE_MASK(x) ((x) & 0x000000007f) #define LONGRUN_MODE_RESERVED(x) ((x) & 0xffffff80) #define LONGRUN_MODE_WRITE(x, y) (LONGRUN_MODE_RESERVED(x) | LONGRUN_MODE_MASK(y)) -#define read_eflags() ({register u_long ef; \ - __asm("pushfl; popl %0" : "=r" (ef)); \ - ef;}) -#define write_eflags(x) ({register u_long ef = (x); \ - __asm("pushl %0; popfl" : : "r" (ef));}) /* * sysctl handler and entry point. Just call the right function 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) { diff --git a/sys/arch/i386/isa/npx.c b/sys/arch/i386/isa/npx.c index a8cde08d0ef..8a78c542c9c 100644 --- a/sys/arch/i386/isa/npx.c +++ b/sys/arch/i386/isa/npx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: npx.c,v 1.28 2003/07/25 18:31:25 jason Exp $ */ +/* $OpenBSD: npx.c,v 1.29 2003/10/24 09:03:20 grange Exp $ */ /* $NetBSD: npx.c,v 1.57 1996/05/12 23:12:24 mycroft Exp $ */ #if 0 @@ -93,11 +93,6 @@ #define fp_divide_by_0() __asm("fldz; fld1; fdiv %st,%st(1); fwait") #define frstor(addr) __asm("frstor %0" : : "m" (*addr)) #define fwait() __asm("fwait") -#define read_eflags() ({register u_long ef; \ - __asm("pushfl; popl %0" : "=r" (ef)); \ - ef;}) -#define write_eflags(x) ({register u_long ef = (x); \ - __asm("pushl %0; popfl" : : "r" (ef));}) #define clts() __asm("clts") #define stts() lcr0(rcr0() | CR0_TS) |