debuggers.hg

view xen/include/asm-x86/x86_64/current.h @ 3715:d93748c50893

bitkeeper revision 1.1159.212.100 (42050e5fWLAKCQAvoZ3CPmyAaL-51g)

Reorganise 'struct domain' and 'struct exec_domain' to each have an
architecture-specific portion. Removed 'mm_struct'.
Signed-off-by: keir.fraser@cl.cam.ac.uk
author kaf24@viper.(none)
date Sat Feb 05 18:20:15 2005 +0000 (2005-02-05)
parents bf2c38625b39
children 88957a238191
line source
1 /* -*- Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
3 #ifndef _X86_64_CURRENT_H
4 #define _X86_64_CURRENT_H
6 struct domain;
8 #define STACK_RESERVED \
9 (sizeof(execution_context_t) + sizeof(struct domain *))
11 static inline struct exec_domain *get_current(void)
12 {
13 struct exec_domain *ed;
14 __asm__ ( "orq %%rsp,%0; andq $~7,%0; movq (%0),%0"
15 : "=r" (ed) : "0" (STACK_SIZE-8) );
16 return ed;
17 }
19 #define current get_current()
21 static inline void set_current(struct exec_domain *ed)
22 {
23 __asm__ ( "orq %%rsp,%0; andq $~7,%0; movq %1,(%0)"
24 : : "r" (STACK_SIZE-8), "r" (ed) );
25 }
27 static inline execution_context_t *get_execution_context(void)
28 {
29 execution_context_t *execution_context;
30 __asm__( "andq %%rsp,%0; addq %2,%0"
31 : "=r" (execution_context)
32 : "0" (~(STACK_SIZE-1)), "i" (STACK_SIZE-STACK_RESERVED) );
33 return execution_context;
34 }
36 static inline unsigned long get_stack_top(void)
37 {
38 unsigned long p;
39 __asm__ ( "orq %%rsp,%0; andq $~7,%0"
40 : "=r" (p) : "0" (STACK_SIZE-8) );
41 return p;
42 }
44 #define reset_stack_and_jump(__fn) \
45 __asm__ __volatile__ ( \
46 "movq %0,%%rsp; jmp "STR(__fn) \
47 : : "r" (get_execution_context()) )
49 #define schedule_tail(_ed) ((_ed)->arch.schedule_tail)(_ed)
51 #endif /* !(_X86_64_CURRENT_H) */