[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Enable compatibility mode operation for HYPERVISOR_multicall.



# HG changeset patch
# User Emmanuel Ackaouy <ack@xxxxxxxxxxxxx>
# Date 1168018474 0
# Node ID c2a82e026497733a315a46a3a39c69a58850b8bf
# Parent  e5f24d5f71acbe0fe52ffbbab3817a189dc57ed6
Enable compatibility mode operation for HYPERVISOR_multicall.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 xen/arch/x86/x86_64/asm-offsets.c  |   12 ++++++++++++
 xen/arch/x86/x86_64/compat/entry.S |    1 -
 xen/common/compat/Makefile         |    2 ++
 xen/common/compat/multicall.c      |   31 +++++++++++++++++++++++++++++++
 xen/common/multicall.c             |    5 ++++-
 xen/include/asm-x86/multicall.h    |   25 +++++++++++++++++++++++++
 xen/include/xen/multicall.h        |   10 +++++++++-
 7 files changed, 83 insertions(+), 3 deletions(-)

diff -r e5f24d5f71ac -r c2a82e026497 xen/arch/x86/x86_64/asm-offsets.c
--- a/xen/arch/x86/x86_64/asm-offsets.c Fri Jan 05 17:34:34 2007 +0000
+++ b/xen/arch/x86/x86_64/asm-offsets.c Fri Jan 05 17:34:34 2007 +0000
@@ -135,5 +135,17 @@ void __dummy__(void)
     OFFSET(MULTICALL_result, struct multicall_entry, result);
     BLANK();
 
+#ifdef CONFIG_COMPAT
+    OFFSET(COMPAT_MULTICALL_op, struct compat_multicall_entry, op);
+    OFFSET(COMPAT_MULTICALL_arg0, struct compat_multicall_entry, args[0]);
+    OFFSET(COMPAT_MULTICALL_arg1, struct compat_multicall_entry, args[1]);
+    OFFSET(COMPAT_MULTICALL_arg2, struct compat_multicall_entry, args[2]);
+    OFFSET(COMPAT_MULTICALL_arg3, struct compat_multicall_entry, args[3]);
+    OFFSET(COMPAT_MULTICALL_arg4, struct compat_multicall_entry, args[4]);
+    OFFSET(COMPAT_MULTICALL_arg5, struct compat_multicall_entry, args[5]);
+    OFFSET(COMPAT_MULTICALL_result, struct compat_multicall_entry, result);
+    BLANK();
+#endif
+
     DEFINE(IRQSTAT_shift, LOG_2(sizeof(irq_cpustat_t)));
 }
diff -r e5f24d5f71ac -r c2a82e026497 xen/arch/x86/x86_64/compat/entry.S
--- a/xen/arch/x86/x86_64/compat/entry.S        Fri Jan 05 17:34:34 2007 +0000
+++ b/xen/arch/x86/x86_64/compat/entry.S        Fri Jan 05 17:34:34 2007 +0000
@@ -279,7 +279,6 @@ CFIX14:
 .section .rodata, "a", @progbits
 
 #define compat_platform_op domain_crash_synchronous
-#define compat_multicall domain_crash_synchronous
 #define compat_set_timer_op domain_crash_synchronous
 #define compat_grant_table_op domain_crash_synchronous
 #define compat_acm_op domain_crash_synchronous
diff -r e5f24d5f71ac -r c2a82e026497 xen/common/compat/Makefile
--- a/xen/common/compat/Makefile        Fri Jan 05 17:34:34 2007 +0000
+++ b/xen/common/compat/Makefile        Fri Jan 05 17:34:34 2007 +0000
@@ -1,7 +1,9 @@ obj-y += domain.o
 obj-y += domain.o
 obj-y += kernel.o
 obj-y += memory.o
+obj-y += multicall.o
 obj-y += xlat.o
 
 # extra dependencies
 kernel.o:      ../kernel.c
+multicall.o:   ../multicall.c
diff -r e5f24d5f71ac -r c2a82e026497 xen/common/compat/multicall.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/compat/multicall.c     Fri Jan 05 17:34:34 2007 +0000
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * multicall.c
+ */
+
+#include <xen/config.h>
+#include <xen/types.h>
+#include <xen/multicall.h>
+
+#define COMPAT
+typedef int ret_t;
+#undef do_multicall_call
+
+DEFINE_XEN_GUEST_HANDLE(multicall_entry_compat_t);
+#define multicall_entry      compat_multicall_entry
+#define multicall_entry_t    multicall_entry_compat_t
+#define do_multicall_call    compat_multicall_call
+#define call                 compat_call
+#define do_multicall(l, n)   compat_multicall(_##l, n)
+#define _XEN_GUEST_HANDLE(t) XEN_GUEST_HANDLE(t)
+
+#include "../multicall.c"
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e5f24d5f71ac -r c2a82e026497 xen/common/multicall.c
--- a/xen/common/multicall.c    Fri Jan 05 17:34:34 2007 +0000
+++ b/xen/common/multicall.c    Fri Jan 05 17:34:34 2007 +0000
@@ -13,9 +13,12 @@
 #include <asm/current.h>
 #include <asm/hardirq.h>
 
+#ifndef COMPAT
 DEFINE_PER_CPU(struct mc_state, mc_state);
+typedef long ret_t;
+#endif
 
-long
+ret_t
 do_multicall(
     XEN_GUEST_HANDLE(multicall_entry_t) call_list, unsigned int nr_calls)
 {
diff -r e5f24d5f71ac -r c2a82e026497 xen/include/asm-x86/multicall.h
--- a/xen/include/asm-x86/multicall.h   Fri Jan 05 17:34:34 2007 +0000
+++ b/xen/include/asm-x86/multicall.h   Fri Jan 05 17:34:34 2007 +0000
@@ -35,6 +35,31 @@
               "r8",  "r9",  "r10", "r11" );                  \
     } while ( 0 )
 
+#define compat_multicall_call(_call)                              \
+    do {                                                          \
+        __asm__ __volatile__ (                                    \
+            "    movl  "STR(COMPAT_MULTICALL_op)"(%0),%%eax; "    \
+            "    leaq  compat_hypercall_table(%%rip),%%rdi; "     \
+            "    cmpl  $("STR(NR_hypercalls)"),%%eax; "           \
+            "    jae   2f; "                                      \
+            "    movq  (%%rdi,%%rax,8),%%rax; "                   \
+            "    movl  "STR(COMPAT_MULTICALL_arg0)"(%0),%%edi; "  \
+            "    movl  "STR(COMPAT_MULTICALL_arg1)"(%0),%%esi; "  \
+            "    movl  "STR(COMPAT_MULTICALL_arg2)"(%0),%%edx; "  \
+            "    movl  "STR(COMPAT_MULTICALL_arg3)"(%0),%%ecx; "  \
+            "    movl  "STR(COMPAT_MULTICALL_arg4)"(%0),%%r8d; "  \
+            "    callq *%%rax; "                                  \
+            "1:  movl  %%eax,"STR(COMPAT_MULTICALL_result)"(%0)\n"\
+            ".section .fixup,\"ax\"\n"                            \
+            "2:  movl  $-"STR(ENOSYS)",%%eax\n"                   \
+            "    jmp   1b\n"                                      \
+            ".previous\n"                                         \
+            : : "b" (_call)                                       \
+              /* all the caller-saves registers */                \
+            : "rax", "rcx", "rdx", "rsi", "rdi",                  \
+              "r8",  "r9",  "r10", "r11" );                       \
+    } while ( 0 )
+
 #else
 
 #define do_multicall_call(_call)                             \
diff -r e5f24d5f71ac -r c2a82e026497 xen/include/xen/multicall.h
--- a/xen/include/xen/multicall.h       Fri Jan 05 17:34:34 2007 +0000
+++ b/xen/include/xen/multicall.h       Fri Jan 05 17:34:34 2007 +0000
@@ -7,6 +7,9 @@
 
 #include <xen/percpu.h>
 #include <asm/multicall.h>
+#ifdef CONFIG_COMPAT
+#include <compat/xen.h>
+#endif
 
 #define _MCSF_in_multicall   0
 #define _MCSF_call_preempted 1
@@ -14,7 +17,12 @@
 #define MCSF_call_preempted  (1<<_MCSF_call_preempted)
 struct mc_state {
     unsigned long flags;
-    struct multicall_entry call;
+    union {
+        struct multicall_entry call;
+#ifdef CONFIG_COMPAT
+        struct compat_multicall_entry compat_call;
+#endif
+    };
 };
 
 DECLARE_PER_CPU(struct mc_state, mc_state);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.