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

Go to the source code of this file.

Macros

#define xchg(ptr, x)
 
#define __HAVE_ARCH_CMPXCHG
 
#define cmpxchg(ptr, o, n)
 
#define cmpxchg64(ptr, o, n)
 
#define __cmpxchg_double_op(p1, p2, o1, o2, n1, n2, insn)
 
#define __cmpxchg_double_4(p1, p2, o1, o2, n1, n2)   __cmpxchg_double_op(p1, p2, o1, o2, n1, n2, "cds")
 
#define __cmpxchg_double_8(p1, p2, o1, o2, n1, n2)   __cmpxchg_double_op(p1, p2, o1, o2, n1, n2, "cdsg")
 
#define __cmpxchg_double(p1, p2, o1, o2, n1, n2)
 
#define cmpxchg_double(p1, p2, o1, o2, n1, n2)
 
#define system_has_cmpxchg_double()   1
 
#define cmpxchg_local(ptr, o, n)
 
#define cmpxchg64_local(ptr, o, n)   cmpxchg64((ptr), (o), (n))
 

Functions

void __xchg_called_with_bad_pointer (void)
 
void __cmpxchg_called_with_bad_pointer (void)
 
void __cmpxchg_double_called_with_bad_pointer (void)
 

Macro Definition Documentation

#define __cmpxchg_double (   p1,
  p2,
  o1,
  o2,
  n1,
  n2 
)
Value:
({ \
int __ret; \
switch (sizeof(*(p1))) { \
case 4: \
__ret = __cmpxchg_double_4(p1, p2, o1, o2, n1, n2); \
break; \
case 8: \
__ret = __cmpxchg_double_8(p1, p2, o1, o2, n1, n2); \
break; \
default: \
__cmpxchg_double_called_with_bad_pointer(); \
} \
__ret; \
})

Definition at line 234 of file cmpxchg.h.

#define __cmpxchg_double_4 (   p1,
  p2,
  o1,
  o2,
  n1,
  n2 
)    __cmpxchg_double_op(p1, p2, o1, o2, n1, n2, "cds")

Definition at line 226 of file cmpxchg.h.

#define __cmpxchg_double_8 (   p1,
  p2,
  o1,
  o2,
  n1,
  n2 
)    __cmpxchg_double_op(p1, p2, o1, o2, n1, n2, "cdsg")

Definition at line 229 of file cmpxchg.h.

#define __cmpxchg_double_op (   p1,
  p2,
  o1,
  o2,
  n1,
  n2,
  insn 
)
Value:
({ \
register __typeof__(*(p1)) __old1 asm("2") = (o1); \
register __typeof__(*(p2)) __old2 asm("3") = (o2); \
register __typeof__(*(p1)) __new1 asm("4") = (n1); \
register __typeof__(*(p2)) __new2 asm("5") = (n2); \
int cc; \
asm volatile( \
insn " %[old],%[new],%[ptr]\n" \
" ipm %[cc]\n" \
" srl %[cc],28" \
: [cc] "=d" (cc), [old] "+d" (__old1), "+d" (__old2) \
: [new] "d" (__new1), "d" (__new2), \
[ptr] "Q" (*(p1)), "Q" (*(p2)) \
: "memory", "cc"); \
!cc; \
})

Definition at line 208 of file cmpxchg.h.

#define __HAVE_ARCH_CMPXCHG

Definition at line 91 of file cmpxchg.h.

#define cmpxchg (   ptr,
  o,
  n 
)
Value:
({ \
__typeof__(*(ptr)) __ret; \
__ret = (__typeof__(*(ptr))) \
__cmpxchg((ptr), (unsigned long)(o), (unsigned long)(n), \
sizeof(*(ptr))); \
__ret; \
})

Definition at line 167 of file cmpxchg.h.

#define cmpxchg64 (   ptr,
  o,
  n 
)
Value:
({ \
__typeof__(*(ptr)) __ret; \
__ret = (__typeof__(*(ptr))) \
__cmpxchg64((ptr), \
(unsigned long long)(o), \
(unsigned long long)(n)); \
__ret; \
})

Definition at line 197 of file cmpxchg.h.

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

Definition at line 301 of file cmpxchg.h.

#define cmpxchg_double (   p1,
  p2,
  o1,
  o2,
  n1,
  n2 
)
Value:
({ \
__typeof__(p1) __p1 = (p1); \
__typeof__(p2) __p2 = (p2); \
int __ret; \
BUILD_BUG_ON(sizeof(*(p1)) != sizeof(long)); \
BUILD_BUG_ON(sizeof(*(p2)) != sizeof(long)); \
VM_BUG_ON((unsigned long)((__p1) + 1) != (unsigned long)(__p2));\
if (sizeof(long) == 4) \
__ret = __cmpxchg_double_4(__p1, __p2, o1, o2, n1, n2); \
else \
__ret = __cmpxchg_double_8(__p1, __p2, o1, o2, n1, n2); \
__ret; \
})

Definition at line 250 of file cmpxchg.h.

#define cmpxchg_local (   ptr,
  o,
  n 
)
Value:
({ \
__typeof__(*(ptr)) __ret; \
__ret = (__typeof__(*(ptr))) \
__cmpxchg_local((ptr), (unsigned long)(o), \
(unsigned long)(n), sizeof(*(ptr))); \
__ret; \
})

Definition at line 292 of file cmpxchg.h.

#define system_has_cmpxchg_double ( )    1

Definition at line 265 of file cmpxchg.h.

#define xchg (   ptr,
  x 
)
Value:
({ \
__typeof__(*(ptr)) __ret; \
__ret = (__typeof__(*(ptr))) \
__xchg((unsigned long)(x), (void *)(ptr), sizeof(*(ptr)));\
__ret; \
})

Definition at line 77 of file cmpxchg.h.

Function Documentation

void __cmpxchg_called_with_bad_pointer ( void  )
void __cmpxchg_double_called_with_bad_pointer ( void  )
void __xchg_called_with_bad_pointer ( void  )