debuggers.hg

view xen/include/asm-x86/x86_64/current.h @ 3659:bf2c38625b39

bitkeeper revision 1.1159.212.72 (42011b79Y7C9nEKFZ5pdQXwp8jC9hw)

More x86/64. Now boot secondary CPUs, but I seem to have problems
executing IRET, so interrupts are fatal.
Signed-off-by: keir.fraser@cl.cam.ac.uk
author kaf24@scramble.cl.cam.ac.uk
date Wed Feb 02 18:27:05 2005 +0000 (2005-02-02)
parents c65b544a8c4e
children bbe8541361dd d93748c50893
line source
1 #ifndef _X86_64_CURRENT_H
2 #define _X86_64_CURRENT_H
4 struct domain;
6 #define STACK_RESERVED \
7 (sizeof(execution_context_t) + sizeof(struct domain *))
9 static inline struct exec_domain *get_current(void)
10 {
11 struct exec_domain *ed;
12 __asm__ ( "orq %%rsp,%0; andq $~7,%0; movq (%0),%0"
13 : "=r" (ed) : "0" (STACK_SIZE-8) );
14 return ed;
15 }
17 #define current get_current()
19 static inline void set_current(struct exec_domain *ed)
20 {
21 __asm__ ( "orq %%rsp,%0; andq $~7,%0; movq %1,(%0)"
22 : : "r" (STACK_SIZE-8), "r" (ed) );
23 }
25 static inline execution_context_t *get_execution_context(void)
26 {
27 execution_context_t *execution_context;
28 __asm__( "andq %%rsp,%0; addq %2,%0"
29 : "=r" (execution_context)
30 : "0" (~(STACK_SIZE-1)), "i" (STACK_SIZE-STACK_RESERVED) );
31 return execution_context;
32 }
34 static inline unsigned long get_stack_top(void)
35 {
36 unsigned long p;
37 __asm__ ( "orq %%rsp,%0; andq $~7,%0"
38 : "=r" (p) : "0" (STACK_SIZE-8) );
39 return p;
40 }
42 #define reset_stack_and_jump(__fn) \
43 __asm__ __volatile__ ( \
44 "movq %0,%%rsp; jmp "STR(__fn) \
45 : : "r" (get_execution_context()) )
47 #define schedule_tail(_d) ((_d)->thread.schedule_tail)(_d)
49 #endif /* !(_X86_64_CURRENT_H) */