debuggers.hg

view xen/include/asm-x86/x86_32/asm_defns.h @ 3659:bf2c38625b39

bitkeeper revision 1.1159.212.72 (42011b79Y7C9nEKFZ5pdQXwp8jC9hw)

More x86/64. Now boot secondary CPUs, but I seem to have problems
executing IRET, so interrupts are fatal.
Signed-off-by: keir.fraser@cl.cam.ac.uk
author kaf24@scramble.cl.cam.ac.uk
date Wed Feb 02 18:27:05 2005 +0000 (2005-02-02)
parents dda5ab69e74a
children 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 #define BUILD_SMP_INTERRUPT(x,v) XBUILD_SMP_INTERRUPT(x,v)
82 #define XBUILD_SMP_INTERRUPT(x,v)\
83 asmlinkage void x(void); \
84 __asm__( \
85 "\n"__ALIGN_STR"\n" \
86 SYMBOL_NAME_STR(x) ":\n\t" \
87 "pushl $"#v"<<16\n\t" \
88 SAVE_ALL(a) \
89 "call "SYMBOL_NAME_STR(smp_##x)"\n\t" \
90 "jmp ret_from_intr\n");
92 #define BUILD_SMP_TIMER_INTERRUPT(x,v) XBUILD_SMP_TIMER_INTERRUPT(x,v)
93 #define XBUILD_SMP_TIMER_INTERRUPT(x,v) \
94 asmlinkage void x(struct xen_regs * regs); \
95 __asm__( \
96 "\n"__ALIGN_STR"\n" \
97 SYMBOL_NAME_STR(x) ":\n\t" \
98 "pushl $"#v"<<16\n\t" \
99 SAVE_ALL(a) \
100 "movl %esp,%eax\n\t" \
101 "pushl %eax\n\t" \
102 "call "SYMBOL_NAME_STR(smp_##x)"\n\t" \
103 "addl $4,%esp\n\t" \
104 "jmp ret_from_intr\n");
106 #define BUILD_COMMON_IRQ() \
107 __asm__( \
108 "\n" __ALIGN_STR"\n" \
109 "common_interrupt:\n\t" \
110 SAVE_ALL(a) \
111 "movl %esp,%eax\n\t" \
112 "pushl %eax\n\t" \
113 "call " SYMBOL_NAME_STR(do_IRQ) "\n\t" \
114 "addl $4,%esp\n\t" \
115 "jmp ret_from_intr\n");
117 #define IRQ_NAME2(nr) nr##_interrupt(void)
118 #define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr)
120 #define BUILD_IRQ(nr) \
121 asmlinkage void IRQ_NAME(nr); \
122 __asm__( \
123 "\n"__ALIGN_STR"\n" \
124 SYMBOL_NAME_STR(IRQ) #nr "_interrupt:\n\t" \
125 "pushl $"#nr"<<16\n\t" \
126 "jmp common_interrupt");
128 #endif /* __X86_32_ASM_DEFNS_H__ */