-void uatomic_add_32(volatile unsigned int *addr, unsigned int val)
-{
- unsigned int result, old;
-
- __asm__ __volatile__(
- " l %0, %1\n"
- "0: lr %2, %0\n"
- " ar %2, %3\n"
- " cs %0,%2,%1\n"
- " brc 4,0b\n"
- : "=&r"(old), "+m" (*addr),
- "=&r"(result)
- : "r"(val)
- : "memory", "cc");
-}
-
-#if (BITS_PER_LONG == 64)
-
-static inline __attribute__((always_inline))
-void uatomic_add_64(volatile unsigned long *addr, unsigned long val)
-{
- unsigned long result, old;
-
- __asm__ __volatile__(
- " lg %0, %1\n"
- "0: lgr %2, %0\n"
- " agr %2, %3\n"
- " csg %0,%2,%1\n"
- " brc 4,0b\n"
- : "=&r"(old), "+m" (*addr),
- "=&r"(result)
- : "r"(val)
- : "memory", "cc");
-}
-
-#endif
-
-static inline __attribute__((always_inline))
-void _uatomic_add(void *addr, unsigned long val, int len)
+unsigned long _uatomic_cmpxchg(void *addr, unsigned long old,
+ unsigned long _new, int len)