Home | History | Annotate | Download | only in asm
      1 /****************************************************************************
      2  ****************************************************************************
      3  ***
      4  ***   This header was automatically generated from a Linux kernel header
      5  ***   of the same name, to make information necessary for userspace to
      6  ***   call into the kernel available to libc.  It contains only constants,
      7  ***   structures, and macros generated from the original header, and thus,
      8  ***   contains no copyrightable information.
      9  ***
     10  ****************************************************************************
     11  ****************************************************************************/
     12 #ifndef __ASM_CMPXCHG_H
     13 #define __ASM_CMPXCHG_H
     14 
     15 #include <linux/bitops.h>
     16 
     17 #define xchg(ptr,v) ((__typeof__(*(ptr)))__xchg((unsigned long)(v),(ptr),sizeof(*(ptr))))
     18 
     19 struct __xchg_dummy { unsigned long a[100]; };
     20 #define __xg(x) ((struct __xchg_dummy *)(x))
     21 
     22 #define ll_low(x) *(((unsigned int*)&(x))+0)
     23 #define ll_high(x) *(((unsigned int*)&(x))+1)
     24 #define set_64bit(ptr,value)  (__builtin_constant_p(value) ?   __set_64bit_constant(ptr, value) :   __set_64bit_var(ptr, value) )
     25 #define _set_64bit(ptr,value)  (__builtin_constant_p(value) ?   __set_64bit(ptr, (unsigned int)(value), (unsigned int)((value)>>32ULL) ) :   __set_64bit(ptr, ll_low(value), ll_high(value)) )
     26 
     27 #define cmpxchg(ptr,o,n)  ({   __typeof__(*(ptr)) __ret;   if (likely(boot_cpu_data.x86 > 3))   __ret = __cmpxchg((ptr), (unsigned long)(o),   (unsigned long)(n), sizeof(*(ptr)));   else   __ret = cmpxchg_386((ptr), (unsigned long)(o),   (unsigned long)(n), sizeof(*(ptr)));   __ret;  })
     28 #define cmpxchg_local(ptr,o,n)  ({   __typeof__(*(ptr)) __ret;   if (likely(boot_cpu_data.x86 > 3))   __ret = __cmpxchg_local((ptr), (unsigned long)(o),   (unsigned long)(n), sizeof(*(ptr)));   else   __ret = cmpxchg_386((ptr), (unsigned long)(o),   (unsigned long)(n), sizeof(*(ptr)));   __ret;  })
     29 #define cmpxchg64(ptr,o,n)  ((__typeof__(*(ptr)))__cmpxchg64((ptr),(unsigned long long)(o),  (unsigned long long)(n)))
     30 #define cmpxchg64_local(ptr,o,n)  ((__typeof__(*(ptr)))__cmpxchg64_local((ptr),(unsigned long long)(o),  (unsigned long long)(n)))
     31 #endif
     32