Skip to content

Commit

Permalink
[PATCH] i386: cleanups to help using per-cpu variables from asm
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeremy Fitzhardinge authored and Andi Kleen committed May 2, 2007
1 parent 7c3576d commit 978c038
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions include/asm-i386/percpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
* 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 */
Expand Down

0 comments on commit 978c038

Please sign in to comment.