ia64/xen-unstable

changeset 16433:2215f4f6f0f2

[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@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Nov 23 16:23:03 2007 +0000 (2007-11-23)
parents f28d36628de8
children d46265d21dc5
files extras/mini-os/include/x86/arch_sched.h
line diff
     1.1 --- a/extras/mini-os/include/x86/arch_sched.h	Fri Nov 23 16:22:36 2007 +0000
     1.2 +++ b/extras/mini-os/include/x86/arch_sched.h	Fri Nov 23 16:23:03 2007 +0000
     1.3 @@ -7,10 +7,11 @@ static inline struct thread* get_current
     1.4  {
     1.5      struct thread **current;
     1.6  #ifdef __i386__    
     1.7 -    __asm__("andl %%esp,%0; ":"=r" (current) : "0" (~8191UL));
     1.8 +    register unsigned long sp asm("esp");
     1.9  #else
    1.10 -    __asm__("andq %%rsp,%0; ":"=r" (current) : "0" (~8191UL));
    1.11 +    register unsigned long sp asm("rsp");
    1.12  #endif 
    1.13 +    current = (void *)(sp & ~8191UL);
    1.14      return *current;
    1.15  }
    1.16