diff options
author | bde <bde@FreeBSD.org> | 1996-07-01 20:16:10 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1996-07-01 20:16:10 +0000 |
commit | 325165ab608d04f8a5bfd39e6a3563b72a0ffd26 (patch) | |
tree | 1801ddb437691bf2fd00a49cc7eeac4ec5f0ae1d /sys/i386/include/cpufunc.h | |
parent | ae8d73b2e42e4798298240f05b3ea0e2ee19cdc6 (diff) | |
download | FreeBSD-src-325165ab608d04f8a5bfd39e6a3563b72a0ffd26.zip FreeBSD-src-325165ab608d04f8a5bfd39e6a3563b72a0ffd26.tar.gz |
Fixed lots of warnings about unportable casts of pointers to volatile
variables: don't depend on the compiler generating atomic code to set
the variables - use inline asm to specify the atomic instruction(s)
explicitly.
Diffstat (limited to 'sys/i386/include/cpufunc.h')
-rw-r--r-- | sys/i386/include/cpufunc.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/i386/include/cpufunc.h b/sys/i386/include/cpufunc.h index 204a228..9dce136 100644 --- a/sys/i386/include/cpufunc.h +++ b/sys/i386/include/cpufunc.h @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: cpufunc.h,v 1.50 1996/06/14 11:01:01 asami Exp $ + * $Id: cpufunc.h,v 1.51 1996/07/01 18:12:23 bde Exp $ */ /* @@ -43,8 +43,6 @@ #include <sys/cdefs.h> #include <sys/types.h> -#include <machine/spl.h> /* XXX belongs elsewhere */ - #ifdef __GNUC__ static __inline void @@ -358,6 +356,12 @@ rdtsc(void) } static __inline void +setbits(volatile unsigned *addr, u_int bits) +{ + __asm __volatile("orl %1,%0" : "=m" (*addr) : "ir" (bits)); +} + +static __inline void write_eflags(u_long ef) { __asm __volatile("pushl %0; popfl" : : "r" (ef)); @@ -393,6 +397,7 @@ quad_t rdmsr __P((u_int msr)); quad_t rdpmc __P((u_int pmc)); quad_t rdtsc __P((void)); u_long read_eflags __P((void)); +void setbits __P((volatile unsigned *addr, u_int bits)); void write_eflags __P((u_long ef)); void wrmsr __P((u_int msr, quad_t newval)); @@ -404,4 +409,6 @@ void ltr __P((u_short sel)); u_int rcr0 __P((void)); u_long rcr3 __P((void)); +#include <machine/spl.h> /* XXX belongs elsewhere */ + #endif /* !_MACHINE_CPUFUNC_H_ */ |