summaryrefslogtreecommitdiff
path: root/arch/or1k/atomic_arch.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/or1k/atomic_arch.h')
-rw-r--r--arch/or1k/atomic_arch.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/or1k/atomic_arch.h b/arch/or1k/atomic_arch.h
new file mode 100644
index 00000000..11a54292
--- /dev/null
+++ b/arch/or1k/atomic_arch.h
@@ -0,0 +1,14 @@
+#define a_cas a_cas
+static inline int a_cas(volatile int *p, int t, int s)
+{
+ __asm__("1: l.lwa %0, %1\n"
+ " l.sfeq %0, %2\n"
+ " l.bnf 1f\n"
+ " l.nop\n"
+ " l.swa %1, %3\n"
+ " l.bnf 1b\n"
+ " l.nop\n"
+ "1: \n"
+ : "=&r"(t), "+m"(*p) : "r"(t), "r"(s) : "cc", "memory" );
+ return t;
+}