From 4abab5ad6c8465a7528ccdd5f49367da05f78bbd Mon Sep 17 00:00:00 2001 From: Vladimir Azarov Date: Tue, 1 Oct 2024 15:47:05 +0200 Subject: Initial version --- arch/or1k/atomic_arch.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 arch/or1k/atomic_arch.h (limited to 'arch/or1k/atomic_arch.h') diff --git a/arch/or1k/atomic_arch.h b/arch/or1k/atomic_arch.h new file mode 100644 index 0000000..11a5429 --- /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; +} -- cgit v1.2.3