xen/32on64-acmop.patch

148 lines
4.2 KiB
Diff

Enable compatibility mode operation for HYPERVISOR_acm_op.
Index: 2007-01-08/xen/arch/x86/x86_64/compat/entry.S
===================================================================
--- 2007-01-08.orig/xen/arch/x86/x86_64/compat/entry.S 2007-01-08 15:20:00.000000000 +0100
+++ 2007-01-08/xen/arch/x86/x86_64/compat/entry.S 2007-01-08 15:20:01.000000000 +0100
@@ -278,7 +278,6 @@ CFIX14:
.section .rodata, "a", @progbits
-#define compat_acm_op domain_crash_synchronous
#define compat_xenoprof_op domain_crash_synchronous
#define compat_sysctl domain_crash_synchronous
#define compat_domctl domain_crash_synchronous
Index: 2007-01-08/xen/common/Makefile
===================================================================
--- 2007-01-08.orig/xen/common/Makefile 2007-01-08 15:19:22.000000000 +0100
+++ 2007-01-08/xen/common/Makefile 2007-01-08 15:20:01.000000000 +0100
@@ -42,6 +42,7 @@ version.o: $(BASEDIR)/include/xen/compil
ifeq ($(CONFIG_COMPAT),y)
# extra dependencies
+acm_ops.o: compat/acm_ops.c
grant_table.o: compat/grant_table.c
schedule.o: compat/schedule.c
endif
Index: 2007-01-08/xen/common/acm_ops.c
===================================================================
--- 2007-01-08.orig/xen/common/acm_ops.c 2007-01-08 15:04:23.000000000 +0100
+++ 2007-01-08/xen/common/acm_ops.c 2007-01-08 15:20:01.000000000 +0100
@@ -15,6 +15,7 @@
*
*/
+#ifndef COMPAT
#include <xen/config.h>
#include <xen/types.h>
#include <xen/lib.h>
@@ -28,6 +29,10 @@
#include <xen/guest_access.h>
#include <acm/acm_hooks.h>
+typedef long ret_t;
+
+#endif /* !COMPAT */
+
#ifndef ACM_SECURITY
@@ -40,6 +45,7 @@ long do_acm_op(int cmd, XEN_GUEST_HANDLE
#else
+#ifndef COMPAT
int acm_authorize_acm_ops(struct domain *d)
{
/* currently, policy management functions are restricted to privileged domains */
@@ -47,11 +53,12 @@ int acm_authorize_acm_ops(struct domain
return -EPERM;
return 0;
}
+#endif
-long do_acm_op(int cmd, XEN_GUEST_HANDLE(void) arg)
+ret_t do_acm_op(int cmd, XEN_GUEST_HANDLE(void) arg)
{
- long rc = -EFAULT;
+ ret_t rc = -EFAULT;
if (acm_authorize_acm_ops(current->domain))
return -EPERM;
@@ -219,6 +226,10 @@ long do_acm_op(int cmd, XEN_GUEST_HANDLE
#endif
+#if defined(CONFIG_COMPAT) && !defined(COMPAT)
+#include "compat/acm_ops.c"
+#endif
+
/*
* Local variables:
* mode: C
Index: 2007-01-08/xen/common/compat/acm_ops.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ 2007-01-08/xen/common/compat/acm_ops.c 2007-01-08 15:20:01.000000000 +0100
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * compat/acm_ops.c
+ */
+
+#include <compat/acm.h>
+#include <compat/acm_ops.h>
+
+#define COMPAT
+#define ret_t int
+
+#define do_acm_op compat_acm_op
+
+static inline XEN_GUEST_HANDLE(void) acm_xlat_handle(COMPAT_HANDLE(void) cmp)
+{
+ XEN_GUEST_HANDLE(void) nat;
+
+ guest_from_compat_handle(nat, cmp);
+ return nat;
+}
+
+#define acm_setpolicy compat_acm_setpolicy
+#define acm_set_policy(h, sz) acm_set_policy(acm_xlat_handle(h), sz)
+
+#define acm_getpolicy compat_acm_getpolicy
+#define acm_get_policy(h, sz) acm_get_policy(acm_xlat_handle(h), sz)
+
+#define acm_dumpstats compat_acm_dumpstats
+#define acm_dump_statistics(h, sz) acm_dump_statistics(acm_xlat_handle(h), sz)
+
+#define acm_getssid compat_acm_getssid
+#define acm_get_ssid(r, h, sz) acm_get_ssid(r, acm_xlat_handle(h), sz)
+
+#define xen_acm_getdecision acm_getdecision
+CHECK_acm_getdecision;
+#undef xen_acm_getdecision
+
+#include "../acm_ops.c"
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
Index: 2007-01-08/xen/include/xlat.lst
===================================================================
--- 2007-01-08.orig/xen/include/xlat.lst 2007-01-08 15:19:22.000000000 +0100
+++ 2007-01-08/xen/include/xlat.lst 2007-01-08 15:20:24.000000000 +0100
@@ -9,6 +9,7 @@
! cpu_user_regs arch-@arch@/xen-@subarch@.h
! trap_info arch-@arch@/xen.h
! vcpu_guest_context arch-@arch@/xen.h
+? acm_getdecision acm_ops.h
? evtchn_alloc_unbound event_channel.h
? evtchn_bind_interdomain event_channel.h
? evtchn_bind_ipi event_channel.h