Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Merge branch 'devel'
[palacios.git] / kitten / include / arch-x86_64 / percpu.h
1 #ifndef _X86_64_PERCPU_H
2 #define _X86_64_PERCPU_H
3 #include <lwk/compiler.h>
4
5 /* Same as asm-generic/percpu.h, except that we store the per cpu offset
6    in the PDA. Longer term the PDA and every per cpu variable
7    should be just put into a single section and referenced directly
8    from %gs */
9
10 #include <arch/pda.h>
11
12 #define __per_cpu_offset(cpu) (cpu_pda(cpu)->data_offset)
13 #define __my_cpu_offset() read_pda(data_offset)
14
15 /* Separate out the type, so (int[3], foo) works. */
16 #define DEFINE_PER_CPU(type, name) \
17     __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name
18
19 /* var is in discarded region: offset to particular copy we want */
20 #define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu)))
21 #define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()))
22
23 #define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
24
25 #endif /* _X86_64_PERCPU_H */