ia64/xen-unstable

changeset 2917: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 764b406523af
files xen/arch/x86/x86_32/entry.S xen/include/asm-x86/irq.h xen/include/asm-x86/x86_32/asm_defns.h
line diff
     1.1 --- a/xen/arch/x86/x86_32/entry.S	Mon Nov 08 18:37:51 2004 +0000
     1.2 +++ b/xen/arch/x86/x86_32/entry.S	Mon Nov 08 18:54:03 2004 +0000
     1.3 @@ -181,7 +181,7 @@ 6:      subl $4,%esp
     1.4  	pushl %edx
     1.5  	pushl %ecx
     1.6  	pushl %ebx
     1.7 -7:      SET_XEN_SEGMENTS
     1.8 +7:      SET_XEN_SEGMENTS(a)
     1.9          jmp failsafe_callback
    1.10  .previous
    1.11  .section __ex_table,"a"
    1.12 @@ -239,7 +239,7 @@ restore_all_xen:
    1.13          ALIGN
    1.14  ENTRY(hypercall)
    1.15          pushl %eax			# save orig_eax
    1.16 -	SAVE_ALL
    1.17 +	SAVE_ALL(b)
    1.18          sti
    1.19          GET_CURRENT(%ebx)
    1.20  	andl $(NR_hypercalls-1),%eax
    1.21 @@ -351,7 +351,7 @@ FAULT12:movl %eax,%gs:8(%esi)
    1.22  .section .fixup,"ax"
    1.23  crash_domain_fixup1:
    1.24          subl  $4,%esp
    1.25 -        SAVE_ALL
    1.26 +        SAVE_ALL(a)
    1.27          sti
    1.28          jmp   domain_crash
    1.29  crash_domain_fixup2:
    1.30 @@ -410,7 +410,7 @@ error_code:
    1.31          movl %es,XREGS_es(%esp)
    1.32          movl %fs,XREGS_fs(%esp)
    1.33          movl %gs,XREGS_gs(%esp)
    1.34 -1:      SET_XEN_SEGMENTS
    1.35 +1:      SET_XEN_SEGMENTS(b)
    1.36  	movl  XREGS_orig_eax(%esp),%esi		# get the error code
    1.37  	movl  XREGS_eax(%esp),%edi		# get the function address
    1.38  	movl  %eax,XREGS_eax(%esp)
    1.39 @@ -508,7 +508,7 @@ ENTRY(nmi)
    1.40          # Save state but do not trash the segment registers!
    1.41          # We may otherwise be unable to reload them or copy them to ring 1. 
    1.42  	pushl %eax
    1.43 -	SAVE_ALL_NOSEGREGS
    1.44 +	SAVE_ALL_NOSEGREGS(a)
    1.45  
    1.46          # Check for hardware problems.
    1.47          inb   $0x61,%al
     2.1 --- a/xen/include/asm-x86/irq.h	Mon Nov 08 18:37:51 2004 +0000
     2.2 +++ b/xen/include/asm-x86/irq.h	Mon Nov 08 18:54:03 2004 +0000
     2.3 @@ -92,7 +92,7 @@ asmlinkage void call_##x(void); \
     2.4  "\n"__ALIGN_STR"\n" \
     2.5  SYMBOL_NAME_STR(x) ":\n\t" \
     2.6  	"push"__OS" $"#v"\n\t" \
     2.7 -	SAVE_ALL \
     2.8 +	SAVE_ALL(a) \
     2.9  	SYMBOL_NAME_STR(call_##x)":\n\t" \
    2.10  	"call "SYMBOL_NAME_STR(smp_##x)"\n\t" \
    2.11  	"jmp ret_from_intr\n");
    2.12 @@ -105,7 +105,7 @@ asmlinkage void call_##x(void); \
    2.13  "\n"__ALIGN_STR"\n" \
    2.14  SYMBOL_NAME_STR(x) ":\n\t" \
    2.15  	"push"__OS" $"#v"\n\t" \
    2.16 -	SAVE_ALL \
    2.17 +	SAVE_ALL(a) \
    2.18  	"mov %"__OP"sp,%"__OP"ax\n\t" \
    2.19  	"push %"__OP"ax\n\t" \
    2.20  	SYMBOL_NAME_STR(call_##x)":\n\t" \
    2.21 @@ -118,7 +118,7 @@ asmlinkage void call_do_IRQ(void); \
    2.22  __asm__( \
    2.23  	"\n" __ALIGN_STR"\n" \
    2.24  	"common_interrupt:\n\t" \
    2.25 -	SAVE_ALL \
    2.26 +	SAVE_ALL(a) \
    2.27  	SYMBOL_NAME_STR(call_do_IRQ)":\n\t" \
    2.28  	"call " SYMBOL_NAME_STR(do_IRQ) "\n\t" \
    2.29  	"jmp ret_from_intr\n");
     3.1 --- a/xen/include/asm-x86/x86_32/asm_defns.h	Mon Nov 08 18:37:51 2004 +0000
     3.2 +++ b/xen/include/asm-x86/x86_32/asm_defns.h	Mon Nov 08 18:54:03 2004 +0000
     3.3 @@ -53,7 +53,7 @@
     3.4  /* AUTO-GENERATE the following two cases (quoted vs. unquoted). */
     3.5  #ifndef __ASSEMBLY__
     3.6  
     3.7 -#define __SAVE_ALL_PRE \
     3.8 +#define __SAVE_ALL_PRE(_reg) \
     3.9          "cld;" \
    3.10          "pushl %eax;" \
    3.11          "pushl %ebp;" \
    3.12 @@ -62,31 +62,31 @@
    3.13          "pushl %edx;" \
    3.14          "pushl %ecx;" \
    3.15          "pushl %ebx;" \
    3.16 -        "movb "STR(XREGS_cs)"(%esp),%al;" \
    3.17 -        "testb $3,%al;" \
    3.18 +        "movb "STR(XREGS_cs)"(%esp),%"STR(_reg)"l;" \
    3.19 +        "testb $3,%"STR(_reg)"l;" \
    3.20          "je 1f;" \
    3.21          "movl %ds,"STR(XREGS_ds)"(%esp);" \
    3.22          "movl %es,"STR(XREGS_es)"(%esp);" \
    3.23          "movl %fs,"STR(XREGS_fs)"(%esp);" \
    3.24          "movl %gs,"STR(XREGS_gs)"(%esp);"
    3.25  
    3.26 -#define SAVE_ALL_NOSEGREGS \
    3.27 -        __SAVE_ALL_PRE \
    3.28 +#define SAVE_ALL_NOSEGREGS(_reg) \
    3.29 +        __SAVE_ALL_PRE(_reg) \
    3.30          "1:"
    3.31  
    3.32 -#define SET_XEN_SEGMENTS \
    3.33 -        "movl $("STR(__HYPERVISOR_DS)"),%edx;" \
    3.34 -        "movl %edx,%ds;" \
    3.35 -        "movl %edx,%es;"
    3.36 +#define SET_XEN_SEGMENTS(_reg) \
    3.37 +        "movl $("STR(__HYPERVISOR_DS)"),%e"STR(_reg)"x;" \
    3.38 +        "movl %e"STR(_reg)"x,%ds;" \
    3.39 +        "movl %e"STR(_reg)"x,%es;"
    3.40  
    3.41 -#define SAVE_ALL \
    3.42 -        __SAVE_ALL_PRE \
    3.43 -        SET_XEN_SEGMENTS \
    3.44 +#define SAVE_ALL(_reg) \
    3.45 +        __SAVE_ALL_PRE(_reg) \
    3.46 +        SET_XEN_SEGMENTS(_reg) \
    3.47          "1:"
    3.48  
    3.49  #else
    3.50  
    3.51 -#define __SAVE_ALL_PRE \
    3.52 +#define __SAVE_ALL_PRE(_reg) \
    3.53          cld; \
    3.54          pushl %eax; \
    3.55          pushl %ebp; \
    3.56 @@ -95,26 +95,26 @@
    3.57          pushl %edx; \
    3.58          pushl %ecx; \
    3.59          pushl %ebx; \
    3.60 -        movb XREGS_cs(%esp),%dl; \
    3.61 -        testb $3,%dl; \
    3.62 +        movb XREGS_cs(%esp),% ## _reg ## l; \
    3.63 +        testb $3,% ## _reg ## l; \
    3.64          je 1f; \
    3.65          movl %ds,XREGS_ds(%esp); \
    3.66          movl %es,XREGS_es(%esp); \
    3.67          movl %fs,XREGS_fs(%esp); \
    3.68          movl %gs,XREGS_gs(%esp);
    3.69  
    3.70 -#define SAVE_ALL_NOSEGREGS \
    3.71 -        __SAVE_ALL_PRE \
    3.72 +#define SAVE_ALL_NOSEGREGS(_reg) \
    3.73 +        __SAVE_ALL_PRE(_reg) \
    3.74          1:
    3.75  
    3.76 -#define SET_XEN_SEGMENTS \
    3.77 -        movl $(__HYPERVISOR_DS),%edx; \
    3.78 -        movl %edx,%ds; \
    3.79 -        movl %edx,%es;
    3.80 +#define SET_XEN_SEGMENTS(_reg) \
    3.81 +        movl $(__HYPERVISOR_DS),%e ## _reg ## x; \
    3.82 +        movl %e ## _reg ## x,%ds; \
    3.83 +        movl %e ## _reg ## x,%es;
    3.84  
    3.85 -#define SAVE_ALL \
    3.86 -        __SAVE_ALL_PRE \
    3.87 -        SET_XEN_SEGMENTS \
    3.88 +#define SAVE_ALL(_reg) \
    3.89 +        __SAVE_ALL_PRE(_reg) \
    3.90 +        SET_XEN_SEGMENTS(_reg) \
    3.91          1:
    3.92  
    3.93  #endif