blob: a10e7c68ae9dcdc483345aea3510fc853da6e65b [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __ARCH_I386_PERCPU__
2#define __ARCH_I386_PERCPU__
3
Stas Sergeevbe44d2a2006-12-07 02:14:01 +01004#ifndef __ASSEMBLY__
Linus Torvalds1da177e2005-04-16 15:20:36 -07005#include <asm-generic/percpu.h>
Stas Sergeevbe44d2a2006-12-07 02:14:01 +01006#else
7
8/*
9 * PER_CPU finds an address of a per-cpu variable.
10 *
11 * Args:
12 * var - variable name
13 * cpu - 32bit register containing the current CPU number
14 *
15 * The resulting address is stored in the "cpu" argument.
16 *
17 * Example:
18 * PER_CPU(cpu_gdt_descr, %ebx)
19 */
20#ifdef CONFIG_SMP
21#define PER_CPU(var, cpu) \
22 movl __per_cpu_offset(,cpu,4), cpu; \
Jeremy Fitzhardingef76c3922007-05-02 19:27:05 +020023 addl $per_cpu__##var, cpu;
Stas Sergeevbe44d2a2006-12-07 02:14:01 +010024#else /* ! SMP */
25#define PER_CPU(var, cpu) \
Jeremy Fitzhardingef76c3922007-05-02 19:27:05 +020026 movl $per_cpu__##var, cpu;
Stas Sergeevbe44d2a2006-12-07 02:14:01 +010027#endif /* SMP */
28
29#endif /* !__ASSEMBLY__ */
Linus Torvalds1da177e2005-04-16 15:20:36 -070030
31#endif /* __ARCH_I386_PERCPU__ */