a87a976f49b35257112d7b836f4997ae121ffe43
[linux-flexiantxendom0-3.2.10.git] / include / asm-ia64 / percpu.h
1 #ifndef _ASM_IA64_PERCPU_H
2 #define _ASM_IA64_PERCPU_H
3
4 #include <linux/config.h>
5 #include <linux/compiler.h>
6
7 /*
8  * Copyright (C) 2002 Hewlett-Packard Co
9  *      David Mosberger-Tang <davidm@hpl.hp.com>
10  */
11
12 #ifdef __ASSEMBLY__
13
14 #define THIS_CPU(var)   (var##__per_cpu)  /* use this to mark accesses to per-CPU variables... */
15
16 #else /* !__ASSEMBLY__ */
17
18 #include <linux/threads.h>
19
20 extern unsigned long __per_cpu_offset[NR_CPUS];
21
22 #ifndef MODULE
23 #define DEFINE_PER_CPU(type, name) \
24     __attribute__((__section__(".data.percpu"))) __typeof__(type) name##__per_cpu
25 #endif
26 #define DECLARE_PER_CPU(type, name) extern __typeof__(type) name##__per_cpu
27
28 #define __get_cpu_var(var)      (var##__per_cpu)
29 #ifdef CONFIG_SMP
30 # define per_cpu(var, cpu)      (*RELOC_HIDE(&var##__per_cpu, __per_cpu_offset[cpu]))
31 #else
32 # define per_cpu(var, cpu)      ((void)cpu, __get_cpu_var(var))
33 #endif
34
35 #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(var##__per_cpu)
36 #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(var##__per_cpu)
37
38 #endif /* !__ASSEMBLY__ */
39
40 #endif /* _ASM_IA64_PERCPU_H */