debuggers.hg

view xen/include/asm-x86/x86_64/current.h @ 3726:88957a238191

bitkeeper revision 1.1159.1.544 (4207248crq3YxiyLWjUehtHv_Yd3tg)

Merge tempest.cl.cam.ac.uk:/auto/groups/xeno-xenod/BK/xeno.bk
into tempest.cl.cam.ac.uk:/local/scratch/smh22/xen-unstable.bk
author smh22@tempest.cl.cam.ac.uk
date Mon Feb 07 08:19:24 2005 +0000 (2005-02-07)
parents bbe8541361dd d93748c50893
children 2318bacbb21e
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) */