aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/asm-x86/x86_64
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2010-07-13 18:12:15 +0100
committerKeir Fraser <keir.fraser@citrix.com>2010-07-13 18:12:15 +0100
commit917335d8b352cb59b5d54592693d80f160582d83 (patch)
tree6f0a58884f1bd6e942f9d49995cf09630cab20ae /xen/include/asm-x86/x86_64
parentf65bd343b074358ce3222e9aebd70908d0362f25 (diff)
downloadxen-917335d8b352cb59b5d54592693d80f160582d83.tar.gz
xen-917335d8b352cb59b5d54592693d80f160582d83.tar.bz2
xen-917335d8b352cb59b5d54592693d80f160582d83.zip
x86: Avoid assumptions about C struct layouts from asm code.
Largely this involves avoiding assumptions about 'struct cpu_info'. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'xen/include/asm-x86/x86_64')
-rw-r--r--xen/include/asm-x86/x86_64/asm_defns.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/xen/include/asm-x86/x86_64/asm_defns.h b/xen/include/asm-x86/x86_64/asm_defns.h
index 7a8cfdbb6a..a56ac63211 100644
--- a/xen/include/asm-x86/x86_64/asm_defns.h
+++ b/xen/include/asm-x86/x86_64/asm_defns.h
@@ -122,4 +122,12 @@ STR(IRQ) #nr "_interrupt:\n\t" \
"movl $"#nr",4(%rsp)\n\t" \
"jmp common_interrupt");
+#define GET_CPUINFO_FIELD(field,reg) \
+ movq $~(STACK_SIZE-1),reg; \
+ andq %rsp,reg; \
+ orq $(STACK_SIZE-CPUINFO_sizeof+field),reg;
+#define GET_CURRENT(reg) \
+ GET_CPUINFO_FIELD(CPUINFO_current_vcpu,reg) \
+ movq (reg),reg;
+
#endif /* __X86_64_ASM_DEFNS_H__ */