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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

Xen patchbot-unstable
# HG changeset patch
# User Keir Fraser <[hidden email]>
# 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 <[hidden email]>
---
 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
[hidden email]
http://lists.xensource.com/xen-changelog