# HG changeset patch # User kaf24@freefall.cl.cam.ac.uk # Date 1099940043 0 # Node ID 4a610e420c0d58121c980615c43e19e3735e9018 # Parent 5974d9d97d89e2bb384c3585b960be0129ee61f5 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. diff -r 5974d9d97d89 -r 4a610e420c0d xen/arch/x86/x86_32/entry.S --- a/xen/arch/x86/x86_32/entry.S Mon Nov 08 18:37:51 2004 +0000 +++ b/xen/arch/x86/x86_32/entry.S Mon Nov 08 18:54:03 2004 +0000 @@ -181,7 +181,7 @@ 6: subl $4,%esp pushl %edx pushl %ecx pushl %ebx -7: SET_XEN_SEGMENTS +7: SET_XEN_SEGMENTS(a) jmp failsafe_callback .previous .section __ex_table,"a" @@ -239,7 +239,7 @@ restore_all_xen: ALIGN ENTRY(hypercall) pushl %eax # save orig_eax - SAVE_ALL + SAVE_ALL(b) sti GET_CURRENT(%ebx) andl $(NR_hypercalls-1),%eax @@ -351,7 +351,7 @@ FAULT12:movl %eax,%gs:8(%esi) .section .fixup,"ax" crash_domain_fixup1: subl $4,%esp - SAVE_ALL + SAVE_ALL(a) sti jmp domain_crash crash_domain_fixup2: @@ -410,7 +410,7 @@ error_code: movl %es,XREGS_es(%esp) movl %fs,XREGS_fs(%esp) movl %gs,XREGS_gs(%esp) -1: SET_XEN_SEGMENTS +1: SET_XEN_SEGMENTS(b) movl XREGS_orig_eax(%esp),%esi # get the error code movl XREGS_eax(%esp),%edi # get the function address movl %eax,XREGS_eax(%esp) @@ -508,7 +508,7 @@ ENTRY(nmi) # Save state but do not trash the segment registers! # We may otherwise be unable to reload them or copy them to ring 1. pushl %eax - SAVE_ALL_NOSEGREGS + SAVE_ALL_NOSEGREGS(a) # Check for hardware problems. inb $0x61,%al diff -r 5974d9d97d89 -r 4a610e420c0d xen/include/asm-x86/irq.h --- a/xen/include/asm-x86/irq.h Mon Nov 08 18:37:51 2004 +0000 +++ b/xen/include/asm-x86/irq.h Mon Nov 08 18:54:03 2004 +0000 @@ -92,7 +92,7 @@ asmlinkage void call_##x(void); \ "\n"__ALIGN_STR"\n" \ SYMBOL_NAME_STR(x) ":\n\t" \ "push"__OS" $"#v"\n\t" \ - SAVE_ALL \ + SAVE_ALL(a) \ SYMBOL_NAME_STR(call_##x)":\n\t" \ "call "SYMBOL_NAME_STR(smp_##x)"\n\t" \ "jmp ret_from_intr\n"); @@ -105,7 +105,7 @@ asmlinkage void call_##x(void); \ "\n"__ALIGN_STR"\n" \ SYMBOL_NAME_STR(x) ":\n\t" \ "push"__OS" $"#v"\n\t" \ - SAVE_ALL \ + SAVE_ALL(a) \ "mov %"__OP"sp,%"__OP"ax\n\t" \ "push %"__OP"ax\n\t" \ SYMBOL_NAME_STR(call_##x)":\n\t" \ @@ -118,7 +118,7 @@ asmlinkage void call_do_IRQ(void); \ __asm__( \ "\n" __ALIGN_STR"\n" \ "common_interrupt:\n\t" \ - SAVE_ALL \ + SAVE_ALL(a) \ SYMBOL_NAME_STR(call_do_IRQ)":\n\t" \ "call " SYMBOL_NAME_STR(do_IRQ) "\n\t" \ "jmp ret_from_intr\n"); diff -r 5974d9d97d89 -r 4a610e420c0d xen/include/asm-x86/x86_32/asm_defns.h --- a/xen/include/asm-x86/x86_32/asm_defns.h Mon Nov 08 18:37:51 2004 +0000 +++ b/xen/include/asm-x86/x86_32/asm_defns.h Mon Nov 08 18:54:03 2004 +0000 @@ -53,7 +53,7 @@ /* AUTO-GENERATE the following two cases (quoted vs. unquoted). */ #ifndef __ASSEMBLY__ -#define __SAVE_ALL_PRE \ +#define __SAVE_ALL_PRE(_reg) \ "cld;" \ "pushl %eax;" \ "pushl %ebp;" \ @@ -62,31 +62,31 @@ "pushl %edx;" \ "pushl %ecx;" \ "pushl %ebx;" \ - "movb "STR(XREGS_cs)"(%esp),%al;" \ - "testb $3,%al;" \ + "movb "STR(XREGS_cs)"(%esp),%"STR(_reg)"l;" \ + "testb $3,%"STR(_reg)"l;" \ "je 1f;" \ "movl %ds,"STR(XREGS_ds)"(%esp);" \ "movl %es,"STR(XREGS_es)"(%esp);" \ "movl %fs,"STR(XREGS_fs)"(%esp);" \ "movl %gs,"STR(XREGS_gs)"(%esp);" -#define SAVE_ALL_NOSEGREGS \ - __SAVE_ALL_PRE \ +#define SAVE_ALL_NOSEGREGS(_reg) \ + __SAVE_ALL_PRE(_reg) \ "1:" -#define SET_XEN_SEGMENTS \ - "movl $("STR(__HYPERVISOR_DS)"),%edx;" \ - "movl %edx,%ds;" \ - "movl %edx,%es;" +#define SET_XEN_SEGMENTS(_reg) \ + "movl $("STR(__HYPERVISOR_DS)"),%e"STR(_reg)"x;" \ + "movl %e"STR(_reg)"x,%ds;" \ + "movl %e"STR(_reg)"x,%es;" -#define SAVE_ALL \ - __SAVE_ALL_PRE \ - SET_XEN_SEGMENTS \ +#define SAVE_ALL(_reg) \ + __SAVE_ALL_PRE(_reg) \ + SET_XEN_SEGMENTS(_reg) \ "1:" #else -#define __SAVE_ALL_PRE \ +#define __SAVE_ALL_PRE(_reg) \ cld; \ pushl %eax; \ pushl %ebp; \ @@ -95,26 +95,26 @@ pushl %edx; \ pushl %ecx; \ pushl %ebx; \ - movb XREGS_cs(%esp),%dl; \ - testb $3,%dl; \ + movb XREGS_cs(%esp),% ## _reg ## l; \ + testb $3,% ## _reg ## l; \ je 1f; \ movl %ds,XREGS_ds(%esp); \ movl %es,XREGS_es(%esp); \ movl %fs,XREGS_fs(%esp); \ movl %gs,XREGS_gs(%esp); -#define SAVE_ALL_NOSEGREGS \ - __SAVE_ALL_PRE \ +#define SAVE_ALL_NOSEGREGS(_reg) \ + __SAVE_ALL_PRE(_reg) \ 1: -#define SET_XEN_SEGMENTS \ - movl $(__HYPERVISOR_DS),%edx; \ - movl %edx,%ds; \ - movl %edx,%es; +#define SET_XEN_SEGMENTS(_reg) \ + movl $(__HYPERVISOR_DS),%e ## _reg ## x; \ + movl %e ## _reg ## x,%ds; \ + movl %e ## _reg ## x,%es; -#define SAVE_ALL \ - __SAVE_ALL_PRE \ - SET_XEN_SEGMENTS \ +#define SAVE_ALL(_reg) \ + __SAVE_ALL_PRE(_reg) \ + SET_XEN_SEGMENTS(_reg) \ 1: #endif