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  ***   To edit the content of this header, modify the corresponding
     11  ***   source file (e.g. under external/kernel-headers/original/) then
     12  ***   run bionic/libc/kernel/tools/update_all.py
     13  ***
     14  ***   Any manual change here will be lost the next time this script will
     15  ***   be run. You've been warned!
     16  ***
     17  ****************************************************************************
     18  ****************************************************************************/
     19 #ifndef __ARCH_I386_ATOMIC__
     20 #define __ARCH_I386_ATOMIC__
     21 #include <linux/compiler.h>
     22 #include <asm/processor.h>
     23 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     24 #include <asm/cmpxchg.h>
     25 typedef struct { int counter; } atomic_t;
     26 #define ATOMIC_INIT(i) { (i) }
     27 #define atomic_read(v) ((v)->counter)
     28 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     29 #define atomic_set(v,i) (((v)->counter) = (i))
     30 #define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new)))
     31 #define atomic_xchg(v, new) (xchg(&((v)->counter), (new)))
     32 #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
     33 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     34 #define atomic_inc_return(v) (atomic_add_return(1,v))
     35 #define atomic_dec_return(v) (atomic_sub_return(1,v))
     36 #define atomic_clear_mask(mask, addr)  __asm__ __volatile__(LOCK_PREFIX "andl %0,%1"  : : "r" (~(mask)),"m" (*addr) : "memory")
     37 #define atomic_set_mask(mask, addr)  __asm__ __volatile__(LOCK_PREFIX "orl %0,%1"  : : "r" (mask),"m" (*(addr)) : "memory")
     38 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     39 #define smp_mb__before_atomic_dec() barrier()
     40 #define smp_mb__after_atomic_dec() barrier()
     41 #define smp_mb__before_atomic_inc() barrier()
     42 #define smp_mb__after_atomic_inc() barrier()
     43 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     44 #include <asm-generic/atomic.h>
     45 #endif
     46