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_LOCAL_H
     20 #define _ARCH_I386_LOCAL_H
     21 #include <linux/percpu.h>
     22 #include <asm/system.h>
     23 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     24 #include <asm/atomic.h>
     25 typedef struct
     26 {
     27  atomic_long_t a;
     28 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     29 } local_t;
     30 #define LOCAL_INIT(i) { ATOMIC_LONG_INIT(i) }
     31 #define local_read(l) atomic_long_read(&(l)->a)
     32 #define local_set(l,i) atomic_long_set(&(l)->a, (i))
     33 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     34 #define local_inc_return(l) (local_add_return(1,l))
     35 #define local_dec_return(l) (local_sub_return(1,l))
     36 #define local_cmpxchg(l, o, n)   (cmpxchg_local(&((l)->a.counter), (o), (n)))
     37 #define local_xchg(l, n) (xchg(&((l)->a.counter), (n)))
     38 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     39 #define local_add_unless(l, a, u)  ({   long c, old;   c = local_read(l);   for (;;) {   if (unlikely(c == (u)))   break;   old = local_cmpxchg((l), c, c + (a));   if (likely(old == c))   break;   c = old;   }   c != (u);  })
     40 #define local_inc_not_zero(l) local_add_unless((l), 1, 0)
     41 #define __local_inc(l) local_inc(l)
     42 #define __local_dec(l) local_dec(l)
     43 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     44 #define __local_add(i,l) local_add((i),(l))
     45 #define __local_sub(i,l) local_sub((i),(l))
     46 #define cpu_local_wrap_v(l)   ({ local_t res__;   preempt_disable();   res__ = (l);   preempt_enable();   res__; })
     47 #define cpu_local_wrap(l)   ({ preempt_disable();   l;   preempt_enable(); })
     48 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     49 #define cpu_local_read(l) cpu_local_wrap_v(local_read(&__get_cpu_var(l)))
     50 #define cpu_local_set(l, i) cpu_local_wrap(local_set(&__get_cpu_var(l), (i)))
     51 #define cpu_local_inc(l) cpu_local_wrap(local_inc(&__get_cpu_var(l)))
     52 #define cpu_local_dec(l) cpu_local_wrap(local_dec(&__get_cpu_var(l)))
     53 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     54 #define cpu_local_add(i, l) cpu_local_wrap(local_add((i), &__get_cpu_var(l)))
     55 #define cpu_local_sub(i, l) cpu_local_wrap(local_sub((i), &__get_cpu_var(l)))
     56 #define __cpu_local_inc(l) cpu_local_inc(l)
     57 #define __cpu_local_dec(l) cpu_local_dec(l)
     58 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     59 #define __cpu_local_add(i, l) cpu_local_add((i), (l))
     60 #define __cpu_local_sub(i, l) cpu_local_sub((i), (l))
     61 #endif
     62