Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
cmpxchg.h File Reference
#include <linux/types.h>
#include <asm-generic/cmpxchg-local.h>

Go to the source code of this file.

Macros

#define xchg(ptr, x)
 
#define tas(ptr)   (xchg((ptr), 1))
 
#define cmpxchg(ptr, test, new)
 
#define cmpxchg_local(ptr, o, n)
 
#define cmpxchg64_local(ptr, o, n)   __cmpxchg64_local_generic((ptr), (o), (n))
 

Functions

uint64_t __xchg_64 (uint64_t i, volatile void *v)
 
uint64_t __cmpxchg_64 (uint64_t test, uint64_t new, volatile uint64_t *v)
 

Macro Definition Documentation

#define cmpxchg (   ptr,
  test,
  new 
)

Definition at line 84 of file cmpxchg.h.

#define cmpxchg64_local (   ptr,
  o,
  n 
)    __cmpxchg64_local_generic((ptr), (o), (n))

Definition at line 170 of file cmpxchg.h.

#define cmpxchg_local (   ptr,
  o,
  n 
)
Value:
((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \
(unsigned long)(n), sizeof(*(ptr))))

Definition at line 167 of file cmpxchg.h.

#define tas (   ptr)    (xchg((ptr), 1))

Definition at line 72 of file cmpxchg.h.

#define xchg (   ptr,
  x 
)
Value:
({ \
__typeof__(ptr) __xg_ptr = (ptr); \
__typeof__(*(ptr)) __xg_orig; \
\
switch (sizeof(__xg_orig)) { \
case 4: \
asm volatile( \
"swap%I0 %M0,%1" \
: "+m"(*__xg_ptr), "=r"(__xg_orig) \
: "1"(x) \
: "memory" \
); \
break; \
\
default: \
__xg_orig = (__typeof__(__xg_orig))0; \
asm volatile("break"); \
break; \
} \
\
__xg_orig; \
})

Definition at line 27 of file cmpxchg.h.

Function Documentation

uint64_t __cmpxchg_64 ( uint64_t  test,
uint64_t  new,
volatile uint64_t v 
)
uint64_t __xchg_64 ( uint64_t  i,
volatile void v 
)