ia64/xen-unstable

view extras/mini-os/include/x86/arch_sched.h @ 13878:9d103e5fd471

[XEN] Fix typos in comment describing 32on64 memory layout

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
author Ian Campbell <ian.campbell@xensource.com>
date Thu Feb 08 12:33:32 2007 +0000 (2007-02-08)
parents a3c6479c87ef
children d915111f8246
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 __asm__("andl %%esp,%0; ":"=r" (current) : "r" (~8191UL));
11 #else
12 __asm__("andq %%rsp,%0; ":"=r" (current) : "r" (~8191UL));
13 #endif
14 return *current;
15 }
17 #ifdef __i386__
18 #define arch_switch_threads(prev, next) do { \
19 unsigned long esi,edi; \
20 __asm__ __volatile__("pushfl\n\t" \
21 "pushl %%ebp\n\t" \
22 "movl %%esp,%0\n\t" /* save ESP */ \
23 "movl %4,%%esp\n\t" /* restore ESP */ \
24 "movl $1f,%1\n\t" /* save EIP */ \
25 "pushl %5\n\t" /* restore EIP */ \
26 "ret\n\t" \
27 "1:\t" \
28 "popl %%ebp\n\t" \
29 "popfl" \
30 :"=m" (prev->sp),"=m" (prev->ip), \
31 "=S" (esi),"=D" (edi) \
32 :"m" (next->sp),"m" (next->ip), \
33 "2" (prev), "d" (next)); \
34 } while (0)
35 #elif __x86_64__
36 #define arch_switch_threads(prev, next) do { \
37 unsigned long rsi,rdi; \
38 __asm__ __volatile__("pushfq\n\t" \
39 "pushq %%rbp\n\t" \
40 "movq %%rsp,%0\n\t" /* save RSP */ \
41 "movq %4,%%rsp\n\t" /* restore RSP */ \
42 "movq $1f,%1\n\t" /* save RIP */ \
43 "pushq %5\n\t" /* restore RIP */ \
44 "ret\n\t" \
45 "1:\t" \
46 "popq %%rbp\n\t" \
47 "popfq" \
48 :"=m" (prev->sp),"=m" (prev->ip), \
49 "=S" (rsi),"=D" (rdi) \
50 :"m" (next->sp),"m" (next->ip), \
51 "2" (prev), "d" (next)); \
52 } while (0)
53 #endif
58 #endif /* __ARCH_SCHED_H__ */