summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/sh/include/atomic.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/arch/sh/include/atomic.h b/sys/arch/sh/include/atomic.h
index 736b0e5b87a..9ba0a329bdf 100644
--- a/sys/arch/sh/include/atomic.h
+++ b/sys/arch/sh/include/atomic.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: atomic.h,v 1.2 2007/02/19 17:18:43 deraadt Exp $ */
+/* $OpenBSD: atomic.h,v 1.3 2007/04/05 17:35:11 miod Exp $ */
/* Public Domain */
@@ -7,16 +7,28 @@
#if defined(_KERNEL)
+#include <sh/psl.h>
+
static __inline void
atomic_setbits_int(__volatile unsigned int *uip, unsigned int v)
{
+ unsigned int sr;
+
+ __asm__ __volatile__ ("stc sr, %0" : "=r"(sr));
+ __asm__ __volatile__ ("ldc %0, sr" : : "r"(sr | PSL_IMASK));
*uip |= v;
+ __asm__ __volatile__ ("ldc %0, sr" : : "r"(sr));
}
static __inline void
atomic_clearbits_int(__volatile unsigned int *uip, unsigned int v)
{
+ unsigned int sr;
+
+ __asm__ __volatile__ ("stc sr, %0" : "=r"(sr));
+ __asm__ __volatile__ ("ldc %0, sr" : : "r"(sr | PSL_IMASK));
*uip &= ~v;
+ __asm__ __volatile__ ("ldc %0, sr" : : "r"(sr));
}
#endif /* defined(_KERNEL) */