[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86: use compiler visible "add" instead of inline assembly "or" in get_cpu_info()


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Thu, 27 Sep 2012 22:33:15 +0000
  • Delivery-date: Thu, 27 Sep 2012 22:33:21 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1348652996 -7200
# Node ID d49e0c5ffe8ada4db156ac53ad8bc6adee077c7d
# Parent  42bacb953f6b8d2ae1df8cbe8d6347d02eaeeccb
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 <jbeulich@xxxxxxxx>
Acked-by: Keir Fraser <keir@xxxxxxx>
---


diff -r 42bacb953f6b -r d49e0c5ffe8a xen/include/asm-x86/current.h
--- a/xen/include/asm-x86/current.h     Wed Sep 26 11:48:21 2012 +0200
+++ b/xen/include/asm-x86/current.h     Wed Sep 26 11:49:56 2012 +0200
@@ -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)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.