Optimize get_current()
PATCH 1/1 Optimize get_current()
Let gcc perform the computation with SP itself, leading to yet better code.
extras/mini-os/include/x86/arch_sched.h +3 -2
@@ -7,10 +7,11 @@ {struct thread **current;#ifdef __i386__ - __asm__("andl %%esp,%0; " :"=r" (current) :"0" (~8191UL )); + registerunsigned long sp asm("esp" );#else - __asm__("andq %%rsp,%0; " :"=r" (current) :"0" (~8191UL )); + registerunsigned long sp asm("rsp" );#endif + current = (void *)(sp & ~8191UL );return *current; }