-static __always_inline
-unsigned int __xchg_u32(volatile void *p, unsigned int val)
-{
- unsigned int prev;
-
- __asm__ __volatile__(LWSYNC_ON_SMP
- "1:\t" "lwarx %0,0,%2\n"
- "stwcx. %3,0,%2\n"
- "bne- 1b"
- ISYNC_ON_SMP
- : "=&r" (prev), "+m" (*(volatile unsigned int *)p)
- : "r" (p), "r" (val)
- : "cc", "memory");
- return prev;
-}
-
-#if (BITS_PER_LONG == 64)
-/*
- * Exchange the 64-bits value pointed to by p, returns the old value.
- * Might not work with PPC405 (see err 77).
- */
-static __always_inline
-unsigned long __xchg_u64(volatile void *p, unsigned long val)
-{
- unsigned long prev;
-
- __asm__ __volatile__(LWSYNC_ON_SMP
- "1:\t" "ldarx %0,0,%2\n"
- "stdcx. %3,0,%2\n"
- "bne- 1b"
- ISYNC_ON_SMP
- : "=&r" (prev), "+m" (*(volatile unsigned long *)p)
- : "r" (p), "r" (val)
- : "cc", "memory");
- return prev;
-}
-#endif
-
-static __always_inline
-unsigned long __xchg(volatile void *ptr, unsigned long x, int size)