 
	
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] [Mini-OS] Optimize get_current()
 Let gcc perform the computation with SP itself, leading to yet better
code.
diff -r 2e05a6173be0 extras/mini-os/include/x86/arch_sched.h
--- a/extras/mini-os/include/x86/arch_sched.h   Fri Nov 23 11:58:11 2007 +0000
+++ b/extras/mini-os/include/x86/arch_sched.h   Fri Nov 23 15:53:18 2007 +0000
@@ -7,10 +7,11 @@
 {
     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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
 | 
|  | Lists.xenproject.org is hosted with RackSpace, monitoring our |