Index: mysql-cluster-gpl-7.3.7/storage/ndb/src/kernel/vm/mt-asm.h =================================================================== --- mysql-cluster-gpl-7.3.7.orig/storage/ndb/src/kernel/vm/mt-asm.h +++ mysql-cluster-gpl-7.3.7/storage/ndb/src/kernel/vm/mt-asm.h @@ -106,12 +106,32 @@ extern void cpu_pause(); #define NDB_HAVE_RMB #define NDB_HAVE_WMB #define NDB_HAVE_READ_BARRIER_DEPENDS +#define NDB_HAVE_XCNG #define mb() asm volatile("lwsync;" ::: "memory") #define rmb() asm volatile("lwsync;" ::: "memory") #define wmb() asm volatile("lwsync;" ::: "memory") #define read_barrier_depends() do {} while(0) +static +inline +int +xcng(volatile unsigned * addr, int val) +{ + int prev; + + asm volatile ( "lwsync;\n" + "1: lwarx %0,0,%2;" + " stwcx. %3,0,%2;" + " bne- 1b;" + "isync;" + : "=&r" (prev), "+m" (*(volatile unsigned int *)addr) + : "r" (addr), "r" (val) + : "cc", "memory"); + + return prev; +} + #else #define NDB_NO_ASM "Unsupported architecture (gcc)" #endif