ia64/xen-unstable

changeset 13301:c2a82e026497

Enable compatibility mode operation for HYPERVISOR_multicall.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Emmanuel Ackaouy <ack@xensource.com>
date Fri Jan 05 17:34:34 2007 +0000 (2007-01-05)
parents e5f24d5f71ac
children 883c0080dd05
files xen/arch/x86/x86_64/asm-offsets.c xen/arch/x86/x86_64/compat/entry.S xen/common/compat/Makefile xen/common/compat/multicall.c xen/common/multicall.c xen/include/asm-x86/multicall.h xen/include/xen/multicall.h
line diff
     1.1 --- a/xen/arch/x86/x86_64/asm-offsets.c	Fri Jan 05 17:34:34 2007 +0000
     1.2 +++ b/xen/arch/x86/x86_64/asm-offsets.c	Fri Jan 05 17:34:34 2007 +0000
     1.3 @@ -135,5 +135,17 @@ void __dummy__(void)
     1.4      OFFSET(MULTICALL_result, struct multicall_entry, result);
     1.5      BLANK();
     1.6  
     1.7 +#ifdef CONFIG_COMPAT
     1.8 +    OFFSET(COMPAT_MULTICALL_op, struct compat_multicall_entry, op);
     1.9 +    OFFSET(COMPAT_MULTICALL_arg0, struct compat_multicall_entry, args[0]);
    1.10 +    OFFSET(COMPAT_MULTICALL_arg1, struct compat_multicall_entry, args[1]);
    1.11 +    OFFSET(COMPAT_MULTICALL_arg2, struct compat_multicall_entry, args[2]);
    1.12 +    OFFSET(COMPAT_MULTICALL_arg3, struct compat_multicall_entry, args[3]);
    1.13 +    OFFSET(COMPAT_MULTICALL_arg4, struct compat_multicall_entry, args[4]);
    1.14 +    OFFSET(COMPAT_MULTICALL_arg5, struct compat_multicall_entry, args[5]);
    1.15 +    OFFSET(COMPAT_MULTICALL_result, struct compat_multicall_entry, result);
    1.16 +    BLANK();
    1.17 +#endif
    1.18 +
    1.19      DEFINE(IRQSTAT_shift, LOG_2(sizeof(irq_cpustat_t)));
    1.20  }
     2.1 --- a/xen/arch/x86/x86_64/compat/entry.S	Fri Jan 05 17:34:34 2007 +0000
     2.2 +++ b/xen/arch/x86/x86_64/compat/entry.S	Fri Jan 05 17:34:34 2007 +0000
     2.3 @@ -279,7 +279,6 @@ CFIX14:
     2.4  .section .rodata, "a", @progbits
     2.5  
     2.6  #define compat_platform_op domain_crash_synchronous
     2.7 -#define compat_multicall domain_crash_synchronous
     2.8  #define compat_set_timer_op domain_crash_synchronous
     2.9  #define compat_grant_table_op domain_crash_synchronous
    2.10  #define compat_acm_op domain_crash_synchronous
     3.1 --- a/xen/common/compat/Makefile	Fri Jan 05 17:34:34 2007 +0000
     3.2 +++ b/xen/common/compat/Makefile	Fri Jan 05 17:34:34 2007 +0000
     3.3 @@ -1,7 +1,9 @@
     3.4  obj-y += domain.o
     3.5  obj-y += kernel.o
     3.6  obj-y += memory.o
     3.7 +obj-y += multicall.o
     3.8  obj-y += xlat.o
     3.9  
    3.10  # extra dependencies
    3.11  kernel.o:	../kernel.c
    3.12 +multicall.o:	../multicall.c
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/xen/common/compat/multicall.c	Fri Jan 05 17:34:34 2007 +0000
     4.3 @@ -0,0 +1,31 @@
     4.4 +/******************************************************************************
     4.5 + * multicall.c
     4.6 + */
     4.7 +
     4.8 +#include <xen/config.h>
     4.9 +#include <xen/types.h>
    4.10 +#include <xen/multicall.h>
    4.11 +
    4.12 +#define COMPAT
    4.13 +typedef int ret_t;
    4.14 +#undef do_multicall_call
    4.15 +
    4.16 +DEFINE_XEN_GUEST_HANDLE(multicall_entry_compat_t);
    4.17 +#define multicall_entry      compat_multicall_entry
    4.18 +#define multicall_entry_t    multicall_entry_compat_t
    4.19 +#define do_multicall_call    compat_multicall_call
    4.20 +#define call                 compat_call
    4.21 +#define do_multicall(l, n)   compat_multicall(_##l, n)
    4.22 +#define _XEN_GUEST_HANDLE(t) XEN_GUEST_HANDLE(t)
    4.23 +
    4.24 +#include "../multicall.c"
    4.25 +
    4.26 +/*
    4.27 + * Local variables:
    4.28 + * mode: C
    4.29 + * c-set-style: "BSD"
    4.30 + * c-basic-offset: 4
    4.31 + * tab-width: 4
    4.32 + * indent-tabs-mode: nil
    4.33 + * End:
    4.34 + */
     5.1 --- a/xen/common/multicall.c	Fri Jan 05 17:34:34 2007 +0000
     5.2 +++ b/xen/common/multicall.c	Fri Jan 05 17:34:34 2007 +0000
     5.3 @@ -13,9 +13,12 @@
     5.4  #include <asm/current.h>
     5.5  #include <asm/hardirq.h>
     5.6  
     5.7 +#ifndef COMPAT
     5.8  DEFINE_PER_CPU(struct mc_state, mc_state);
     5.9 +typedef long ret_t;
    5.10 +#endif
    5.11  
    5.12 -long
    5.13 +ret_t
    5.14  do_multicall(
    5.15      XEN_GUEST_HANDLE(multicall_entry_t) call_list, unsigned int nr_calls)
    5.16  {
     6.1 --- a/xen/include/asm-x86/multicall.h	Fri Jan 05 17:34:34 2007 +0000
     6.2 +++ b/xen/include/asm-x86/multicall.h	Fri Jan 05 17:34:34 2007 +0000
     6.3 @@ -35,6 +35,31 @@
     6.4                "r8",  "r9",  "r10", "r11" );                  \
     6.5      } while ( 0 )
     6.6  
     6.7 +#define compat_multicall_call(_call)                              \
     6.8 +    do {                                                          \
     6.9 +        __asm__ __volatile__ (                                    \
    6.10 +            "    movl  "STR(COMPAT_MULTICALL_op)"(%0),%%eax; "    \
    6.11 +            "    leaq  compat_hypercall_table(%%rip),%%rdi; "     \
    6.12 +            "    cmpl  $("STR(NR_hypercalls)"),%%eax; "           \
    6.13 +            "    jae   2f; "                                      \
    6.14 +            "    movq  (%%rdi,%%rax,8),%%rax; "                   \
    6.15 +            "    movl  "STR(COMPAT_MULTICALL_arg0)"(%0),%%edi; "  \
    6.16 +            "    movl  "STR(COMPAT_MULTICALL_arg1)"(%0),%%esi; "  \
    6.17 +            "    movl  "STR(COMPAT_MULTICALL_arg2)"(%0),%%edx; "  \
    6.18 +            "    movl  "STR(COMPAT_MULTICALL_arg3)"(%0),%%ecx; "  \
    6.19 +            "    movl  "STR(COMPAT_MULTICALL_arg4)"(%0),%%r8d; "  \
    6.20 +            "    callq *%%rax; "                                  \
    6.21 +            "1:  movl  %%eax,"STR(COMPAT_MULTICALL_result)"(%0)\n"\
    6.22 +            ".section .fixup,\"ax\"\n"                            \
    6.23 +            "2:  movl  $-"STR(ENOSYS)",%%eax\n"                   \
    6.24 +            "    jmp   1b\n"                                      \
    6.25 +            ".previous\n"                                         \
    6.26 +            : : "b" (_call)                                       \
    6.27 +              /* all the caller-saves registers */                \
    6.28 +            : "rax", "rcx", "rdx", "rsi", "rdi",                  \
    6.29 +              "r8",  "r9",  "r10", "r11" );                       \
    6.30 +    } while ( 0 )
    6.31 +
    6.32  #else
    6.33  
    6.34  #define do_multicall_call(_call)                             \
     7.1 --- a/xen/include/xen/multicall.h	Fri Jan 05 17:34:34 2007 +0000
     7.2 +++ b/xen/include/xen/multicall.h	Fri Jan 05 17:34:34 2007 +0000
     7.3 @@ -7,6 +7,9 @@
     7.4  
     7.5  #include <xen/percpu.h>
     7.6  #include <asm/multicall.h>
     7.7 +#ifdef CONFIG_COMPAT
     7.8 +#include <compat/xen.h>
     7.9 +#endif
    7.10  
    7.11  #define _MCSF_in_multicall   0
    7.12  #define _MCSF_call_preempted 1
    7.13 @@ -14,7 +17,12 @@
    7.14  #define MCSF_call_preempted  (1<<_MCSF_call_preempted)
    7.15  struct mc_state {
    7.16      unsigned long flags;
    7.17 -    struct multicall_entry call;
    7.18 +    union {
    7.19 +        struct multicall_entry call;
    7.20 +#ifdef CONFIG_COMPAT
    7.21 +        struct compat_multicall_entry compat_call;
    7.22 +#endif
    7.23 +    };
    7.24  };
    7.25  
    7.26  DECLARE_PER_CPU(struct mc_state, mc_state);