WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH,RFC 14/17] 32-on-64 multicalls

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH,RFC 14/17] 32-on-64 multicalls
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Wed, 04 Oct 2006 16:44:04 +0100
Delivery-date: Wed, 04 Oct 2006 08:44:02 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Index: 2006-10-04/xen/arch/x86/x86_64/asm-offsets.c
===================================================================
--- 2006-10-04.orig/xen/arch/x86/x86_64/asm-offsets.c   2006-10-04 
15:11:03.000000000 +0200
+++ 2006-10-04/xen/arch/x86/x86_64/asm-offsets.c        2006-10-04 
15:20:16.000000000 +0200
@@ -134,5 +134,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)));
 }
Index: 2006-10-04/xen/arch/x86/x86_64/compat/entry.S
===================================================================
--- 2006-10-04.orig/xen/arch/x86/x86_64/compat/entry.S  2006-10-04 
15:20:14.000000000 +0200
+++ 2006-10-04/xen/arch/x86/x86_64/compat/entry.S       2006-10-04 
15:20:16.000000000 +0200
@@ -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
Index: 2006-10-04/xen/common/compat/Makefile
===================================================================
--- 2006-10-04.orig/xen/common/compat/Makefile  2006-10-04 15:20:09.000000000 
+0200
+++ 2006-10-04/xen/common/compat/Makefile       2006-10-04 15:20:16.000000000 
+0200
@@ -1,7 +1,9 @@
 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
Index: 2006-10-04/xen/common/compat/multicall.c
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ 2006-10-04/xen/common/compat/multicall.c    2006-10-04 15:20:16.000000000 
+0200
@@ -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:
+ */
Index: 2006-10-04/xen/common/multicall.c
===================================================================
--- 2006-10-04.orig/xen/common/multicall.c      2006-08-25 15:36:10.000000000 
+0200
+++ 2006-10-04/xen/common/multicall.c   2006-10-04 15:20:16.000000000 +0200
@@ -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)
 {
Index: 2006-10-04/xen/include/asm-x86/multicall.h
===================================================================
--- 2006-10-04.orig/xen/include/asm-x86/multicall.h     2006-09-25 
15:00:39.000000000 +0200
+++ 2006-10-04/xen/include/asm-x86/multicall.h  2006-10-04 15:20:16.000000000 
+0200
@@ -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)                             \
Index: 2006-10-04/xen/include/xen/multicall.h
===================================================================
--- 2006-10-04.orig/xen/include/xen/multicall.h 2006-08-14 14:44:40.000000000 
+0200
+++ 2006-10-04/xen/include/xen/multicall.h      2006-10-04 15:20:16.000000000 
+0200
@@ -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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH,RFC 14/17] 32-on-64 multicalls, Jan Beulich <=