aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/include/x86
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2007-11-23 16:23:03 +0000
committerKeir Fraser <keir.fraser@citrix.com>2007-11-23 16:23:03 +0000
commita222af2ef1f49e5c232466ab162fd606732a9d05 (patch)
treeef3eff7c5510e0f1f605353425dd23ae784c4343 /extras/mini-os/include/x86
parentbb44bead1012120e08e81ce206612618384481de (diff)
downloadxen-a222af2ef1f49e5c232466ab162fd606732a9d05.tar.gz
xen-a222af2ef1f49e5c232466ab162fd606732a9d05.tar.bz2
xen-a222af2ef1f49e5c232466ab162fd606732a9d05.zip
[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>
Diffstat (limited to 'extras/mini-os/include/x86')
-rw-r--r--extras/mini-os/include/x86/arch_sched.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/extras/mini-os/include/x86/arch_sched.h b/extras/mini-os/include/x86/arch_sched.h
index 6bc47f89d3..7bf0036fac 100644
--- a/extras/mini-os/include/x86/arch_sched.h
+++ b/extras/mini-os/include/x86/arch_sched.h
@@ -7,10 +7,11 @@ static inline struct thread* get_current(void)
{
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;
}