blob: 8c5b322a7809a2d910b12fcca0ee4eb4fed0f73b [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001/****************************************************************************
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 ***
Ben Cheng654325d2012-03-07 21:13:49 -080010 *** 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 ***
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080017 ****************************************************************************
18 ****************************************************************************/
19#ifndef _ARCH_I386_LOCAL_H
20#define _ARCH_I386_LOCAL_H
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080021#include <linux/percpu.h>
22#include <asm/system.h>
Ben Cheng654325d2012-03-07 21:13:49 -080023/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080024#include <asm/atomic.h>
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080025typedef struct
26{
27 atomic_long_t a;
Ben Cheng654325d2012-03-07 21:13:49 -080028/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080029} local_t;
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080030#define LOCAL_INIT(i) { ATOMIC_LONG_INIT(i) }
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080031#define local_read(l) atomic_long_read(&(l)->a)
32#define local_set(l,i) atomic_long_set(&(l)->a, (i))
Ben Cheng654325d2012-03-07 21:13:49 -080033/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080034#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)))
Ben Cheng654325d2012-03-07 21:13:49 -080038/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080039#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)
Ben Cheng654325d2012-03-07 21:13:49 -080043/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080044#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__; })
Elliott Hughesc95eb572013-01-29 18:15:55 -080047#define cpu_local_wrap(l) ({ preempt_disable(); l; preempt_enable(); })
Ben Cheng654325d2012-03-07 21:13:49 -080048/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080049#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)))
Ben Cheng654325d2012-03-07 21:13:49 -080053/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080054#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)
Ben Cheng654325d2012-03-07 21:13:49 -080058/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080059#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