debuggers.hg

view xen/include/asm-x86/x86_32/asm_defns.h @ 2955:4a610e420c0d

bitkeeper revision 1.1159.170.2 (418fc0cbyeYILYK3WoFh0bVv3e_-KA)

Allow users of SAVE_ALL and SET_XEN_SEGMENTS to specify which register
is to be clobbered on return.
author kaf24@freefall.cl.cam.ac.uk
date Mon Nov 08 18:54:03 2004 +0000 (2004-11-08)
parents 5974d9d97d89
children 90b094417ff3 20087d779fb6 4644bea63898
line source
1 #ifndef __ASM_DEFNS_H__
2 #define __ASM_DEFNS_H__
4 /* Offsets in 'struct xen_regs' --- AUTO-GENERATE ME! */
5 #define XREGS_ebx 0x00
6 #define XREGS_ecx 0x04
7 #define XREGS_edx 0x08
8 #define XREGS_esi 0x0C
9 #define XREGS_edi 0x10
10 #define XREGS_ebp 0x14
11 #define XREGS_eax 0x18
12 #define XREGS_orig_eax 0x1C
13 #define XREGS_eip 0x20
14 #define XREGS_cs 0x24
15 #define XREGS_eflags 0x28
16 #define XREGS_esp 0x2C
17 #define XREGS_ss 0x30
18 #define XREGS_es 0x34
19 #define XREGS_ds 0x38
20 #define XREGS_fs 0x3C
21 #define XREGS_gs 0x40
23 /* Offsets in 'struct domain' --- AUTO-GENERATE ME! */
24 #define DOMAIN_processor 0
25 #define DOMAIN_shared_info 4
26 #define DOMAIN_event_sel 8
27 #define DOMAIN_event_addr 12
28 #define DOMAIN_failsafe_sel 16
29 #define DOMAIN_failsafe_addr 20
31 /* Offsets in shared_info_t --- AUTO-GENERATE ME! */
32 #define SHINFO_upcall_pending /* 0 */
33 #define SHINFO_upcall_mask 1
35 /* Offsets in 'struct guest_trap_bounce' --- AUTO-GENERATE ME! */
36 #define GTB_error_code 0
37 #define GTB_cr2 4
38 #define GTB_flags 8
39 #define GTB_cs 10
40 #define GTB_eip 12
41 #define GTBF_TRAP 1
42 #define GTBF_TRAP_NOCODE 2
43 #define GTBF_TRAP_CR2 4
45 /* EFLAGS masks. */
46 #define CF_MASK 0x00000001
47 #define IF_MASK 0x00000200
48 #define NT_MASK 0x00004000
50 #define __STR(x) #x
51 #define STR(x) __STR(x)
53 /* AUTO-GENERATE the following two cases (quoted vs. unquoted). */
54 #ifndef __ASSEMBLY__
56 #define __SAVE_ALL_PRE(_reg) \
57 "cld;" \
58 "pushl %eax;" \
59 "pushl %ebp;" \
60 "pushl %edi;" \
61 "pushl %esi;" \
62 "pushl %edx;" \
63 "pushl %ecx;" \
64 "pushl %ebx;" \
65 "movb "STR(XREGS_cs)"(%esp),%"STR(_reg)"l;" \
66 "testb $3,%"STR(_reg)"l;" \
67 "je 1f;" \
68 "movl %ds,"STR(XREGS_ds)"(%esp);" \
69 "movl %es,"STR(XREGS_es)"(%esp);" \
70 "movl %fs,"STR(XREGS_fs)"(%esp);" \
71 "movl %gs,"STR(XREGS_gs)"(%esp);"
73 #define SAVE_ALL_NOSEGREGS(_reg) \
74 __SAVE_ALL_PRE(_reg) \
75 "1:"
77 #define SET_XEN_SEGMENTS(_reg) \
78 "movl $("STR(__HYPERVISOR_DS)"),%e"STR(_reg)"x;" \
79 "movl %e"STR(_reg)"x,%ds;" \
80 "movl %e"STR(_reg)"x,%es;"
82 #define SAVE_ALL(_reg) \
83 __SAVE_ALL_PRE(_reg) \
84 SET_XEN_SEGMENTS(_reg) \
85 "1:"
87 #else
89 #define __SAVE_ALL_PRE(_reg) \
90 cld; \
91 pushl %eax; \
92 pushl %ebp; \
93 pushl %edi; \
94 pushl %esi; \
95 pushl %edx; \
96 pushl %ecx; \
97 pushl %ebx; \
98 movb XREGS_cs(%esp),% ## _reg ## l; \
99 testb $3,% ## _reg ## l; \
100 je 1f; \
101 movl %ds,XREGS_ds(%esp); \
102 movl %es,XREGS_es(%esp); \
103 movl %fs,XREGS_fs(%esp); \
104 movl %gs,XREGS_gs(%esp);
106 #define SAVE_ALL_NOSEGREGS(_reg) \
107 __SAVE_ALL_PRE(_reg) \
108 1:
110 #define SET_XEN_SEGMENTS(_reg) \
111 movl $(__HYPERVISOR_DS),%e ## _reg ## x; \
112 movl %e ## _reg ## x,%ds; \
113 movl %e ## _reg ## x,%es;
115 #define SAVE_ALL(_reg) \
116 __SAVE_ALL_PRE(_reg) \
117 SET_XEN_SEGMENTS(_reg) \
118 1:
120 #endif
122 #endif /* __ASM_DEFNS_H__ */