• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_MIPS_LOCAL_H
20 #define _ARCH_MIPS_LOCAL_H
21 #include <linux/percpu.h>
22 #include <linux/bitops.h>
23 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
24 #include <asm/atomic.h>
25 #include <asm/cmpxchg.h>
26 #include <asm/war.h>
27 typedef struct
28 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
29 {
30  atomic_long_t a;
31 } local_t;
32 #define LOCAL_INIT(i) { ATOMIC_LONG_INIT(i) }
33 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
34 #define local_read(l) atomic_long_read(&(l)->a)
35 #define local_set(l, i) atomic_long_set(&(l)->a, (i))
36 #define local_add(i, l) atomic_long_add((i), (&(l)->a))
37 #define local_sub(i, l) atomic_long_sub((i), (&(l)->a))
38 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
39 #define local_inc(l) atomic_long_inc(&(l)->a)
40 #define local_dec(l) atomic_long_dec(&(l)->a)
41 #define local_cmpxchg(l, o, n)   ((long)cmpxchg_local(&((l)->a.counter), (o), (n)))
42 #define local_xchg(l, n) (xchg_local(&((l)->a.counter), (n)))
43 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
44 #define local_add_unless(l, a, u)  ({   long c, old;   c = local_read(l);   while (c != (u) && (old = local_cmpxchg((l), c, c + (a))) != c)   c = old;   c != (u);  })
45 #define local_inc_not_zero(l) local_add_unless((l), 1, 0)
46 #define local_dec_return(l) local_sub_return(1, (l))
47 #define local_inc_return(l) local_add_return(1, (l))
48 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
49 #define local_sub_and_test(i, l) (local_sub_return((i), (l)) == 0)
50 #define local_inc_and_test(l) (local_inc_return(l) == 0)
51 #define local_dec_and_test(l) (local_sub_return(1, (l)) == 0)
52 #define local_add_negative(i, l) (local_add_return(i, (l)) < 0)
53 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
54 #define __local_inc(l) ((l)->a.counter++)
55 #define __local_dec(l) ((l)->a.counter++)
56 #define __local_add(i, l) ((l)->a.counter+=(i))
57 #define __local_sub(i, l) ((l)->a.counter-=(i))
58 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
59 #define cpu_local_wrap_v(l)   ({ local_t res__;   preempt_disable();   res__ = (l);   preempt_enable();   res__; })
60 #define cpu_local_wrap(l)   ({ preempt_disable();   l;   preempt_enable(); })
61 #define cpu_local_read(l) cpu_local_wrap_v(local_read(&__get_cpu_var(l)))
62 #define cpu_local_set(l, i) cpu_local_wrap(local_set(&__get_cpu_var(l), (i)))
63 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
64 #define cpu_local_inc(l) cpu_local_wrap(local_inc(&__get_cpu_var(l)))
65 #define cpu_local_dec(l) cpu_local_wrap(local_dec(&__get_cpu_var(l)))
66 #define cpu_local_add(i, l) cpu_local_wrap(local_add((i), &__get_cpu_var(l)))
67 #define cpu_local_sub(i, l) cpu_local_wrap(local_sub((i), &__get_cpu_var(l)))
68 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
69 #define __cpu_local_inc(l) cpu_local_inc(l)
70 #define __cpu_local_dec(l) cpu_local_dec(l)
71 #define __cpu_local_add(i, l) cpu_local_add((i), (l))
72 #define __cpu_local_sub(i, l) cpu_local_sub((i), (l))
73 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
74 #endif
75