direct-io.hg

view xen/include/asm-x86/x86_32/asm_defns.h @ 3280:dda5ab69e74a

bitkeeper revision 1.1159.1.477 (41bf20d2wgoxIqhcE0nzBC8W-yFPhg)

sync w/ head.
author cl349@arcadians.cl.cam.ac.uk
date Tue Dec 14 17:20:18 2004 +0000 (2004-12-14)
parents 91d462a4e723 da409d40699a
children bf2c38625b39 bbe8541361dd
line source
1 #ifndef __X86_32_ASM_DEFNS_H__
2 #define __X86_32_ASM_DEFNS_H__
4 /* Maybe auto-generate the following two cases (quoted vs. unquoted). */
5 #ifndef __ASSEMBLY__
7 #define __SAVE_ALL_PRE \
8 "cld;" \
9 "pushl %eax;" \
10 "pushl %ebp;" \
11 "pushl %edi;" \
12 "pushl %esi;" \
13 "pushl %edx;" \
14 "pushl %ecx;" \
15 "pushl %ebx;" \
16 "testl $"STR(X86_EFLAGS_VM)","STR(XREGS_eflags)"(%esp);" \
17 "jz 2f;" \
18 "call setup_vm86_frame;" \
19 "jmp 3f;" \
20 "2:testb $3,"STR(XREGS_cs)"(%esp);" \
21 "jz 1f;" \
22 "movl %ds,"STR(XREGS_ds)"(%esp);" \
23 "movl %es,"STR(XREGS_es)"(%esp);" \
24 "movl %fs,"STR(XREGS_fs)"(%esp);" \
25 "movl %gs,"STR(XREGS_gs)"(%esp);" \
26 "3:"
28 #define SAVE_ALL_NOSEGREGS(_reg) \
29 __SAVE_ALL_PRE \
30 "1:"
32 #define SET_XEN_SEGMENTS(_reg) \
33 "movl $("STR(__HYPERVISOR_DS)"),%e"STR(_reg)"x;" \
34 "movl %e"STR(_reg)"x,%ds;" \
35 "movl %e"STR(_reg)"x,%es;"
37 #define SAVE_ALL(_reg) \
38 __SAVE_ALL_PRE \
39 SET_XEN_SEGMENTS(_reg) \
40 "1:"
42 #else
44 #define __SAVE_ALL_PRE \
45 cld; \
46 pushl %eax; \
47 pushl %ebp; \
48 pushl %edi; \
49 pushl %esi; \
50 pushl %edx; \
51 pushl %ecx; \
52 pushl %ebx; \
53 testl $X86_EFLAGS_VM,XREGS_eflags(%esp); \
54 jz 2f; \
55 call setup_vm86_frame; \
56 jmp 3f; \
57 2:testb $3,XREGS_cs(%esp); \
58 jz 1f; \
59 movl %ds,XREGS_ds(%esp); \
60 movl %es,XREGS_es(%esp); \
61 movl %fs,XREGS_fs(%esp); \
62 movl %gs,XREGS_gs(%esp); \
63 3:
65 #define SAVE_ALL_NOSEGREGS(_reg) \
66 __SAVE_ALL_PRE \
67 1:
69 #define SET_XEN_SEGMENTS(_reg) \
70 movl $(__HYPERVISOR_DS),%e ## _reg ## x; \
71 movl %e ## _reg ## x,%ds; \
72 movl %e ## _reg ## x,%es;
74 #define SAVE_ALL(_reg) \
75 __SAVE_ALL_PRE \
76 SET_XEN_SEGMENTS(_reg) \
77 1:
79 #endif
81 #endif /* __X86_32_ASM_DEFNS_H__ */