1 #ifndef __ASM_SH_FUTEX_CAS_H 2 #define __ASM_SH_FUTEX_CAS_H 3 4 static inline int atomic_futex_op_cmpxchg_inatomic(u32 *uval, 5 u32 __user *uaddr, 6 u32 oldval, u32 newval) 7 { 8 int err = 0; 9 __asm__ __volatile__( 10 "1:\n\t" 11 "cas.l %2, %1, @r0\n" 12 "2:\n\t" 13 #ifdef CONFIG_MMU 14 ".section .fixup,\"ax\"\n" 15 "3:\n\t" 16 "mov.l 4f, %0\n\t" 17 "jmp @%0\n\t" 18 " mov %3, %0\n\t" 19 ".balign 4\n" 20 "4: .long 2b\n\t" 21 ".previous\n" 22 ".section __ex_table,\"a\"\n\t" 23 ".long 1b, 3b\n\t" 24 ".previous" 25 #endif 26 :"+r" (err), "+r" (newval) 27 :"r" (oldval), "i" (-EFAULT), "z" (uaddr) 28 :"t", "memory"); 29 if (err) return err; 30 *uval = newval; 31 return 0; 32 } 33 34 #endif /* __ASM_SH_FUTEX_CAS_H */ 35