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/bug.h>
#include <linux/irqflags.h>
#include <asm/war.h>
#include <asm-generic/cmpxchg-local.h>

Go to the source code of this file.

Macros

#define __xchg_u64   __xchg_u64_unsupported_on_32bit_kernels
 
#define xchg(ptr, x)
 
#define __HAVE_ARCH_CMPXCHG   1
 
#define __cmpxchg_asm(ld, st, m, old, new)
 
#define __cmpxchg(ptr, old, new, pre_barrier, post_barrier)
 
#define cmpxchg(ptr, old, new)   __cmpxchg(ptr, old, new, smp_mb__before_llsc(), smp_llsc_mb())
 
#define cmpxchg_local(ptr, old, new)   __cmpxchg(ptr, old, new, , )
 
#define cmpxchg64(ptr, o, n)
 
#define cmpxchg64_local(ptr, o, n)   __cmpxchg64_local_generic((ptr), (o), (n))
 

Functions

__u64 __xchg_u64_unsupported_on_32bit_kernels (volatile __u64 *m, __u64 val)
 
void __cmpxchg_called_with_bad_pointer (void)
 

Macro Definition Documentation

#define __cmpxchg (   ptr,
  old,
  new,
  pre_barrier,
  post_barrier 
)
Value:
({ \
__typeof__(ptr) __ptr = (ptr); \
__typeof__(*(ptr)) __old = (old); \
__typeof__(*(ptr)) __new = (new); \
__typeof__(*(ptr)) __res = 0; \
\
pre_barrier; \
\
switch (sizeof(*(__ptr))) { \
case 4: \
__res = __cmpxchg_asm("ll", "sc", __ptr, __old, __new); \
break; \
case 8: \
if (sizeof(long) == 8) { \
__res = __cmpxchg_asm("lld", "scd", __ptr, \
__old, __new); \
break; \
} \
default: \
__cmpxchg_called_with_bad_pointer(); \
break; \
} \
\
post_barrier; \
\
__res; \
})

Definition at line 197 of file cmpxchg.h.

#define __cmpxchg_asm (   ld,
  st,
  m,
  old,
  new 
)

Definition at line 140 of file cmpxchg.h.

#define __HAVE_ARCH_CMPXCHG   1

Definition at line 138 of file cmpxchg.h.

#define __xchg_u64   __xchg_u64_unsupported_on_32bit_kernels

Definition at line 115 of file cmpxchg.h.

#define cmpxchg (   ptr,
  old,
  new 
)    __cmpxchg(ptr, old, new, smp_mb__before_llsc(), smp_llsc_mb())

Definition at line 226 of file cmpxchg.h.

#define cmpxchg64 (   ptr,
  o,
  n 
)
Value:
({ \
BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
cmpxchg((ptr), (o), (n)); \
})

Definition at line 229 of file cmpxchg.h.

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

Definition at line 243 of file cmpxchg.h.

#define cmpxchg_local (   ptr,
  old,
  new 
)    __cmpxchg(ptr, old, new, , )

Definition at line 227 of file cmpxchg.h.

#define xchg (   ptr,
  x 
)
Value:
({ \
BUILD_BUG_ON(sizeof(*(ptr)) & ~0xc); \
\
((__typeof__(*(ptr))) \
__xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))); \
})

Definition at line 130 of file cmpxchg.h.

Function Documentation

void __cmpxchg_called_with_bad_pointer ( void  )
__u64 __xchg_u64_unsupported_on_32bit_kernels ( volatile __u64 m,
__u64  val 
)