x86/current: provide additional information to optimise get_cpu_info()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 3 Sep 2014 13:09:06 +0000 (15:09 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 3 Sep 2014 13:09:06 +0000 (15:09 +0200)
Exactly as with c/s d55c5eefe "x86: use compiler visible "add" instead of
inline assembly "or" in get_cpu_info()", this is achieved by providing more
information to the compiler.

This causes a net drop of almost 4K of .text

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/include/asm-x86/current.h

index 2081015ff9cc9f00a07284943158ec58b3c2248d..b95fd796981405a0019e56251ce7e6953f7ec236 100644 (file)
@@ -25,9 +25,9 @@ struct cpu_info {
 
 static inline struct cpu_info *get_cpu_info(void)
 {
-    unsigned long tos;
-    __asm__ ( "and %%rsp,%0" : "=r" (tos) : "0" (~(STACK_SIZE-1)) );
-    return (struct cpu_info *)(tos + STACK_SIZE) - 1;
+    register unsigned long sp asm("rsp");
+
+    return (struct cpu_info *)((sp & ~(STACK_SIZE-1)) + STACK_SIZE) - 1;
 }
 
 #define get_current()         (get_cpu_info()->current_vcpu)