Enable compatibility mode operation for HYPERVISOR_acm_op.
authorEmmanuel Ackaouy <ack@xensource.com>
Fri, 5 Jan 2007 17:34:37 +0000 (17:34 +0000)
committerEmmanuel Ackaouy <ack@xensource.com>
Fri, 5 Jan 2007 17:34:37 +0000 (17:34 +0000)
Signed-off-by: Jan Beulich <jbeulich@novell.com>
xen/arch/x86/x86_64/compat/entry.S
xen/common/Makefile
xen/common/acm_ops.c
xen/common/compat/acm_ops.c [new file with mode: 0644]
xen/include/xlat.lst

index 792854eb832d4e00a8aa3d50a280648c148f4948..c0c900cbb7e17065e881c7234c6ca393dc158c67 100644 (file)
@@ -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 625d5a122ac4dba01126013581448e33fcdde84d..ac4683bb82600191c8d262c757056943081b8602 100644 (file)
@@ -42,6 +42,7 @@ version.o: $(BASEDIR)/include/xen/compile.h
 
 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 d6ed6293982e1180bb9787155495575cac128126..f9d8a72da63400ea2571c30e33fab2cf96e8c870 100644 (file)
@@ -15,6 +15,7 @@
  *
  */
 
+#ifndef COMPAT
 #include <xen/config.h>
 #include <xen/types.h>
 #include <xen/lib.h>
 #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(void) arg)
 #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 *d)
         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(void) arg)
 
 #endif
 
+#if defined(CONFIG_COMPAT) && !defined(COMPAT)
+#include "compat/acm_ops.c"
+#endif
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/common/compat/acm_ops.c b/xen/common/compat/acm_ops.c
new file mode 100644 (file)
index 0000000..28af1a8
--- /dev/null
@@ -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 c3152f239b65e8136d2decf081ae717164791498..540bbd7de1a7bd6e65649be6493a9f381f6479ff 100644 (file)
@@ -9,6 +9,7 @@
 !      cpu_user_regs                   arch-x86/xen-@arch@.h
 !      trap_info                       arch-x86/xen.h
 !      vcpu_guest_context              arch-x86/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