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

[Xen-changelog] [xen-unstable] [Mini-OS] Optimize get_current()



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1195834983 0
# Node ID 2215f4f6f0f225c8b7d377f376ca3fa4d5d6d742
# Parent  f28d36628de80b05fcab24094684d95a17026db1
[Mini-OS] Optimize get_current()

Let gcc perform the computation with SP itself, leading to yet better
code.

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxx>
---
 extras/mini-os/include/x86/arch_sched.h |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff -r f28d36628de8 -r 2215f4f6f0f2 extras/mini-os/include/x86/arch_sched.h
--- a/extras/mini-os/include/x86/arch_sched.h   Fri Nov 23 16:22:36 2007 +0000
+++ b/extras/mini-os/include/x86/arch_sched.h   Fri Nov 23 16:23:03 2007 +0000
@@ -7,10 +7,11 @@ static inline struct thread* get_current
 {
     struct thread **current;
 #ifdef __i386__    
-    __asm__("andl %%esp,%0; ":"=r" (current) : "0" (~8191UL));
+    register unsigned long sp asm("esp");
 #else
-    __asm__("andq %%rsp,%0; ":"=r" (current) : "0" (~8191UL));
+    register unsigned long sp asm("rsp");
 #endif 
+    current = (void *)(sp & ~8191UL);
     return *current;
 }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
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®.