1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 #ifndef __ASM_GENERIC_PERCPU_H__ 3 #define __ASM_GENERIC_PERCPU_H__ 4 5 #ifndef __ASSEMBLY__ 6 7 #include <xen/types.h> 8 #include <asm/current.h> 9 10 extern char __per_cpu_start[]; 11 extern const char __per_cpu_data_end[]; 12 extern unsigned long __per_cpu_offset[NR_CPUS]; 13 void percpu_init_areas(void); 14 15 #define per_cpu(var, cpu) \ 16 (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu])) 17 18 #define this_cpu(var) \ 19 (*RELOC_HIDE(&per_cpu__##var, get_per_cpu_offset())) 20 21 #define per_cpu_ptr(var, cpu) \ 22 (*RELOC_HIDE(var, __per_cpu_offset[cpu])) 23 #define this_cpu_ptr(var) \ 24 (*RELOC_HIDE(var, get_per_cpu_offset())) 25 26 #endif 27 28 #endif /* __ASM_GENERIC_PERCPU_H__ */ 29 30 /* 31 * Local variables: 32 * mode: C 33 * c-file-style: "BSD" 34 * c-basic-offset: 4 35 * indent-tabs-mode: nil 36 * End: 37 */ 38