Commit 978c038e authored by Jeremy Fitzhardinge's avatar Jeremy Fitzhardinge Committed by Andi Kleen

[PATCH] i386: cleanups to help using per-cpu variables from asm

This patch does a few small cleanups:
 - use PER_CPU_NAME to generate the names of per-cpu variables
 - use lea to add the per_cpu offset in PER_CPU(), because it doesn't
   affect condition flags
 - add PER_CPU_VAR which allows direct access to pre-cpu variables
   with the %fs: prefix on SMP.
Signed-off-by: default avatarJeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andi Kleen <ak@suse.de>
parent 7c3576d2
...@@ -16,12 +16,14 @@ ...@@ -16,12 +16,14 @@
* PER_CPU(cpu_gdt_descr, %ebx) * PER_CPU(cpu_gdt_descr, %ebx)
*/ */
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
#define PER_CPU(var, reg) \ #define PER_CPU(var, reg) \
movl %fs:per_cpu__this_cpu_off, reg; \ movl %fs:per_cpu__##this_cpu_off, reg; \
addl $per_cpu__##var, reg lea per_cpu__##var(reg), reg
#define PER_CPU_VAR(var) %fs:per_cpu__##var
#else /* ! SMP */ #else /* ! SMP */
#define PER_CPU(var, reg) \ #define PER_CPU(var, reg) \
movl $per_cpu__##var, reg; movl $per_cpu__##var, reg
#define PER_CPU_VAR(var) per_cpu__##var
#endif /* SMP */ #endif /* SMP */
#else /* ...!ASSEMBLY */ #else /* ...!ASSEMBLY */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment