diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2010-07-01 03:36:13 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2010-07-01 03:36:13 +0000 |
commit | 797ad9d0edde762ee142aa0ea7008cf766c8f357 (patch) | |
tree | 41303a71ee945a9db113625f10f4f5650b94ffbb /sys/arch/hppa64/include | |
parent | e10a58b58a94729c6e8395511345ec71c3b19921 (diff) |
Partially sync atomic.h with hppa so that we get real atomic ops and some
missing functions.
ok kettenis@
Diffstat (limited to 'sys/arch/hppa64/include')
-rw-r--r-- | sys/arch/hppa64/include/atomic.h | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/sys/arch/hppa64/include/atomic.h b/sys/arch/hppa64/include/atomic.h index 3b451b8696d..d8474e881ad 100644 --- a/sys/arch/hppa64/include/atomic.h +++ b/sys/arch/hppa64/include/atomic.h @@ -1,4 +1,4 @@ -/* $OpenBSD: atomic.h,v 1.2 2007/02/19 17:18:42 deraadt Exp $ */ +/* $OpenBSD: atomic.h,v 1.3 2010/07/01 03:36:12 jsing Exp $ */ /* Public Domain */ @@ -10,13 +10,45 @@ static __inline void atomic_setbits_int(__volatile unsigned int *uip, unsigned int v) { + register_t eiem; + + __asm __volatile("mfctl %%cr15, %0": "=r" (eiem)); + __asm __volatile("mtctl %r0, %cr15"); *uip |= v; + __asm __volatile("mtctl %0, %%cr15":: "r" (eiem)); } static __inline void atomic_clearbits_int(__volatile unsigned int *uip, unsigned int v) { + register_t eiem; + + __asm __volatile("mfctl %%cr15, %0": "=r" (eiem)); + __asm __volatile("mtctl %r0, %cr15"); + *uip &= ~v; + __asm __volatile("mtctl %0, %%cr15":: "r" (eiem)); +} + +static __inline void +atomic_setbits_long(__volatile unsigned long *uip, unsigned long v) +{ + register_t eiem; + + __asm __volatile("mfctl %%cr15, %0": "=r" (eiem)); + __asm __volatile("mtctl %r0, %cr15"); + *uip |= v; + __asm __volatile("mtctl %0, %%cr15":: "r" (eiem)); +} + +static __inline void +atomic_clearbits_long(__volatile unsigned long *uip, unsigned long v) +{ + register_t eiem; + + __asm __volatile("mfctl %%cr15, %0": "=r" (eiem)); + __asm __volatile("mtctl %r0, %cr15"); *uip &= ~v; + __asm __volatile("mtctl %0, %%cr15":: "r" (eiem)); } #endif /* defined(_KERNEL) */ |