From: Jan Beulich Date: Wed, 26 Sep 2012 09:49:56 +0000 (+0200) Subject: x86: use compiler visible "add" instead of inline assembly "or" in get_cpu_info() X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~7856 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d55c5eefe190e5b0e571b8e9d54616376697ce7e;p=xen.git x86: use compiler visible "add" instead of inline assembly "or" in get_cpu_info() This follows the same idea as the previous patch, just that the effect is much more visible here: With a half-way [dr]ecent gcc this reduced .text size by over 12k for me. Signed-off-by: Jan Beulich Acked-by: Keir Fraser --- diff --git a/xen/include/asm-x86/current.h b/xen/include/asm-x86/current.h index 8bc1fc0f94..bec4dbe792 100644 --- a/xen/include/asm-x86/current.h +++ b/xen/include/asm-x86/current.h @@ -25,12 +25,9 @@ struct cpu_info { static inline struct cpu_info *get_cpu_info(void) { - struct cpu_info *cpu_info; - __asm__ ( "and %%"__OP"sp,%0; or %2,%0" - : "=r" (cpu_info) - : "0" (~(STACK_SIZE-1)), "i" (STACK_SIZE-sizeof(struct cpu_info)) - ); - return cpu_info; + unsigned long tos; + __asm__ ( "and %%rsp,%0" : "=r" (tos) : "0" (~(STACK_SIZE-1)) ); + return (struct cpu_info *)(tos + STACK_SIZE) - 1; } #define get_current() (get_cpu_info()->current_vcpu)