aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xen/include/asm-x86/current.h13
-rw-r--r--xen/include/asm-x86/percpu.h2
2 files changed, 11 insertions, 4 deletions
diff --git a/xen/include/asm-x86/current.h b/xen/include/asm-x86/current.h
index 0a423fba67..bed04f1c24 100644
--- a/xen/include/asm-x86/current.h
+++ b/xen/include/asm-x86/current.h
@@ -16,8 +16,12 @@ struct vcpu;
struct cpu_info {
struct cpu_user_regs guest_cpu_user_regs;
- unsigned int processor_id;
- struct vcpu *current_vcpu;
+ unsigned int processor_id;
+ struct vcpu *current_vcpu;
+ unsigned long per_cpu_offset;
+#ifdef __x86_64__ /* get_stack_bottom() must be 16-byte aligned */
+ unsigned long __pad_for_stack_bottom;
+#endif
};
static inline struct cpu_info *get_cpu_info(void)
@@ -35,7 +39,10 @@ static inline struct cpu_info *get_cpu_info(void)
#define current (get_current())
#define get_processor_id() (get_cpu_info()->processor_id)
-#define set_processor_id(id) (get_cpu_info()->processor_id = (id))
+#define set_processor_id(id) do { \
+ struct cpu_info *ci__ = get_cpu_info(); \
+ ci__->per_cpu_offset = __per_cpu_offset[ci__->processor_id = (id)]; \
+} while (0)
#define guest_cpu_user_regs() (&get_cpu_info()->guest_cpu_user_regs)
diff --git a/xen/include/asm-x86/percpu.h b/xen/include/asm-x86/percpu.h
index fb1d4140ec..e6faa8ce07 100644
--- a/xen/include/asm-x86/percpu.h
+++ b/xen/include/asm-x86/percpu.h
@@ -16,7 +16,7 @@ void percpu_init_areas(void);
#define per_cpu(var, cpu) \
(*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
#define __get_cpu_var(var) \
- (per_cpu(var, smp_processor_id()))
+ (*RELOC_HIDE(&per_cpu__##var, get_cpu_info()->per_cpu_offset))
#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name