[PATCH] i386: cleanups to help using per-cpu variables from asm
authorJeremy Fitzhardinge <jeremy@goop.org>
Wed, 2 May 2007 17:27:16 +0000 (19:27 +0200)
committerAndi Kleen <andi@basil.nowhere.org>
Wed, 2 May 2007 17:27:16 +0000 (19:27 +0200)
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: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andi Kleen <ak@suse.de>
include/asm-i386/percpu.h

index c5f12f0d9c23b43f421e6cdf0382a3021907e936..cdcb63db30a90f29135c0460b1272b2e6b74d917 100644 (file)
  *    PER_CPU(cpu_gdt_descr, %ebx)
  */
 #ifdef CONFIG_SMP
-#define PER_CPU(var, reg)                      \
-       movl %fs:per_cpu__this_cpu_off, reg;            \
-       addl $per_cpu__##var, reg
+#define PER_CPU(var, reg)                              \
+       movl %fs:per_cpu__##this_cpu_off, reg;          \
+       lea per_cpu__##var(reg), reg
+#define PER_CPU_VAR(var)       %fs:per_cpu__##var
 #else /* ! SMP */
-#define PER_CPU(var, reg) \
-       movl $per_cpu__##var, reg;
+#define PER_CPU(var, reg)                      \
+       movl $per_cpu__##var, reg
+#define PER_CPU_VAR(var)       per_cpu__##var
 #endif /* SMP */
 
 #else /* ...!ASSEMBLY */