ia64/xen-unstable

view extras/mini-os/include/x86/arch_sched.h @ 16434:d46265d21dc5

[Mini-OS] Fix x86 arch_switch_thread

Fix x86 arch_switch_thread by making it pure assembly.
There were missing general register clobbers for x86_64, and BP should
theorically be clobbered too, but gcc does not believe that, so the
only simple safe solution is to use pure assembly.

Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Nov 23 16:23:28 2007 +0000 (2007-11-23)
parents 2215f4f6f0f2
children 8f6640070a86
line source
2 #ifndef __ARCH_SCHED_H__
3 #define __ARCH_SCHED_H__
6 static inline struct thread* get_current(void)
7 {
8 struct thread **current;
9 #ifdef __i386__
10 register unsigned long sp asm("esp");
11 #else
12 register unsigned long sp asm("rsp");
13 #endif
14 current = (void *)(sp & ~8191UL);
15 return *current;
16 }
18 extern void __arch_switch_threads(unsigned long *prevctx, unsigned long *nextctx);
20 #define arch_switch_threads(prev,next) __arch_switch_threads(&(prev)->sp, &(next)->sp)
24 #endif /* __ARCH_SCHED_H__ */