32-on-64 multicalls
RFC PATCH 14/17 32-on-64 multicalls
xen/arch/x86/x86_64/asm-offsets.c +12 -0
@@ -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))); }
xen/arch/x86/x86_64/compat/entry.S +0 -1
@@ -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
xen/common/compat/Makefile +2 -0
@@ -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
xen/common/compat/multicall.c new file +31 -0
@@ -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: +*/
xen/common/multicall.c +4 -1
@@ -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) {
xen/include/asm-x86/multicall.h +25 -0
@@ -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) \
xen/include/xen/multicall.h +9 -1
@@ -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);