percpu_64.h 833 字节
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13
#ifndef _ASM_X8664_PERCPU_H_
#define _ASM_X8664_PERCPU_H_
#include <linux/compiler.h>

/* Same as asm-generic/percpu.h, except that we store the per cpu offset
   in the PDA. Longer term the PDA and every per cpu variable
   should be just put into a single section and referenced directly
   from %gs */

#ifdef CONFIG_SMP

#include <asm/pda.h>

14
#define __per_cpu_offset(cpu) (cpu_pda(cpu)->data_offset)
15
#define __my_cpu_offset read_pda(data_offset)
L
Linus Torvalds 已提交
16

17 18
#define per_cpu_offset(x) (__per_cpu_offset(x))

L
Linus Torvalds 已提交
19 20 21 22
/* A macro to avoid #include hell... */
#define percpu_modcopy(pcpudst, src, size)			\
do {								\
	unsigned int __i;					\
23
	for_each_possible_cpu(__i)				\
24 25
		memcpy((pcpudst)+__per_cpu_offset(__i),		\
		       (src), (size));				\
L
Linus Torvalds 已提交
26 27 28 29
} while (0)

#endif	/* SMP */

30
#include <asm-generic/percpu.h>
L
Linus Torvalds 已提交
31 32

#endif /* _ASM_X8664_PERCPU_H_ */