debuggers.hg

view xen/include/asm-x86/x86_32/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 c65b544a8c4e
children 88957a238191
line source
1 /* -*- Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
3 #ifndef _X86_CURRENT_H
4 #define _X86_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__ ( "orl %%esp,%0; andl $~3,%0; movl (%0),%0"
15 : "=r" (ed) : "0" (STACK_SIZE-4) );
16 return ed;
17 }
19 #define current get_current()
21 static inline void set_current(struct exec_domain *ed)
22 {
23 __asm__ ( "orl %%esp,%0; andl $~3,%0; movl %1,(%0)"
24 : : "r" (STACK_SIZE-4), "r" (ed) );
25 }
27 static inline execution_context_t *get_execution_context(void)
28 {
29 execution_context_t *execution_context;
30 __asm__ ( "andl %%esp,%0; addl %2,%0"
31 : "=r" (execution_context)
32 : "0" (~(STACK_SIZE-1)), "i" (STACK_SIZE-STACK_RESERVED) );
33 return execution_context;
34 }
36 /*
37 * Get the top-of-stack, as stored in the per-CPU TSS. This is actually
38 * 20 bytes below the real top of the stack to allow space for:
39 * domain pointer, DS, ES, FS, GS.
40 */
41 static inline unsigned long get_stack_top(void)
42 {
43 unsigned long p;
44 __asm__ ( "andl %%esp,%0; addl %2,%0"
45 : "=r" (p)
46 : "0" (~(STACK_SIZE-1)), "i" (STACK_SIZE-20) );
47 return p;
48 }
50 #define reset_stack_and_jump(__fn) \
51 __asm__ __volatile__ ( \
52 "movl %0,%%esp; jmp "STR(__fn) \
53 : : "r" (get_execution_context()) )
55 #define schedule_tail(_ed) ((_ed)->arch.schedule_tail)(_ed)
57 #endif /* _X86_CURRENT_H */