169 lines
6.6 KiB
Diff
169 lines
6.6 KiB
Diff
|
Enable compatibility mode operation for HYPERVISOR_multicall.
|
||
|
|
||
|
Index: 2006-12-11/xen/arch/x86/x86_64/asm-offsets.c
|
||
|
===================================================================
|
||
|
--- 2006-12-11.orig/xen/arch/x86/x86_64/asm-offsets.c 2006-12-15 15:28:41.000000000 +0100
|
||
|
+++ 2006-12-11/xen/arch/x86/x86_64/asm-offsets.c 2006-12-15 15:33:03.000000000 +0100
|
||
|
@@ -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)));
|
||
|
}
|
||
|
Index: 2006-12-11/xen/arch/x86/x86_64/compat/entry.S
|
||
|
===================================================================
|
||
|
--- 2006-12-11.orig/xen/arch/x86/x86_64/compat/entry.S 2006-12-15 15:32:58.000000000 +0100
|
||
|
+++ 2006-12-11/xen/arch/x86/x86_64/compat/entry.S 2006-12-15 15:33:03.000000000 +0100
|
||
|
@@ -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-12-11/xen/common/compat/Makefile
|
||
|
===================================================================
|
||
|
--- 2006-12-11.orig/xen/common/compat/Makefile 2006-12-15 15:32:56.000000000 +0100
|
||
|
+++ 2006-12-11/xen/common/compat/Makefile 2006-12-15 15:33:03.000000000 +0100
|
||
|
@@ -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-12-11/xen/common/compat/multicall.c
|
||
|
===================================================================
|
||
|
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||
|
+++ 2006-12-11/xen/common/compat/multicall.c 2006-12-15 15:33:03.000000000 +0100
|
||
|
@@ -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-12-11/xen/common/multicall.c
|
||
|
===================================================================
|
||
|
--- 2006-12-11.orig/xen/common/multicall.c 2006-12-15 15:20:37.000000000 +0100
|
||
|
+++ 2006-12-11/xen/common/multicall.c 2006-12-15 15:33:03.000000000 +0100
|
||
|
@@ -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-12-11/xen/include/asm-x86/multicall.h
|
||
|
===================================================================
|
||
|
--- 2006-12-11.orig/xen/include/asm-x86/multicall.h 2006-12-15 15:20:34.000000000 +0100
|
||
|
+++ 2006-12-11/xen/include/asm-x86/multicall.h 2006-12-15 15:33:03.000000000 +0100
|
||
|
@@ -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-12-11/xen/include/xen/multicall.h
|
||
|
===================================================================
|
||
|
--- 2006-12-11.orig/xen/include/xen/multicall.h 2006-12-15 15:20:37.000000000 +0100
|
||
|
+++ 2006-12-11/xen/include/xen/multicall.h 2006-12-15 15:33:42.000000000 +0100
|
||
|
@@ -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);
|