Rev | Line | |
---|
[34] | 1 | #ifndef __X86_PERCPU_H__ |
---|
| 2 | #define __X86_PERCPU_H__ |
---|
| 3 | |
---|
| 4 | #define PERCPU_SHIFT 12 |
---|
| 5 | #define PERCPU_SIZE (1UL << PERCPU_SHIFT) |
---|
| 6 | |
---|
| 7 | /* Separate out the type, so (int[3], foo) works. */ |
---|
| 8 | #define DEFINE_PER_CPU(type, name) \ |
---|
| 9 | __attribute__((__section__(".data.percpu"))) \ |
---|
| 10 | __typeof__(type) per_cpu__##name |
---|
| 11 | |
---|
| 12 | /* var is in discarded region: offset to particular copy we want */ |
---|
| 13 | #define per_cpu(var, cpu) \ |
---|
| 14 | (*RELOC_HIDE(&per_cpu__##var, ((unsigned int)(cpu))<<PERCPU_SHIFT)) |
---|
| 15 | #define __get_cpu_var(var) \ |
---|
| 16 | (per_cpu(var, smp_processor_id())) |
---|
| 17 | |
---|
| 18 | #define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name |
---|
| 19 | |
---|
| 20 | #endif /* __X86_PERCPU_H__ */ |
---|
Note: See
TracBrowser
for help on using the repository browser.