Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros
cmpxchg.h File Reference

Go to the source code of this file.

Macros

#define xchg(ptr, v)
 
#define __HAVE_ARCH_CMPXCHG   1
 
#define cmpxchg(ptr, old, new)
 

Macro Definition Documentation

#define __HAVE_ARCH_CMPXCHG   1

Definition at line 67 of file cmpxchg.h.

#define cmpxchg (   ptr,
  old,
  new 
)
Value:
({ \
__typeof__(ptr) __ptr = (ptr); \
__typeof__(*(ptr)) __old = (old); \
__typeof__(*(ptr)) __new = (new); \
__typeof__(*(ptr)) __oldval = 0; \
\
asm volatile( \
"1: %0 = memw_locked(%1);\n" \
" { P0 = cmp.eq(%0,%2);\n" \
" if (!P0.new) jump:nt 2f; }\n" \
" memw_locked(%1,p0) = %3;\n" \
" if (!P0) jump 1b;\n" \
"2:\n" \
: "=&r" (__oldval) \
: "r" (__ptr), "r" (__old), "r" (__new) \
: "memory", "p0" \
); \
__oldval; \
})

Definition at line 69 of file cmpxchg.h.

#define xchg (   ptr,
  v 
)
Value:
((__typeof__(*(ptr)))__xchg((unsigned long)(v), (ptr), \
sizeof(*(ptr))))

Definition at line 59 of file cmpxchg.h.