summaryrefslogtreecommitdiff
path: root/sys/arch/hppa/include/atomic.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/hppa/include/atomic.h')
-rw-r--r--sys/arch/hppa/include/atomic.h34
1 files changed, 33 insertions, 1 deletions
diff --git a/sys/arch/hppa/include/atomic.h b/sys/arch/hppa/include/atomic.h
index ee7b4a4ab27..16514db9153 100644
--- a/sys/arch/hppa/include/atomic.h
+++ b/sys/arch/hppa/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 2007/04/26 20:52:48 miod 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) */