[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Enable compatibility mode operation for HYPERVISOR_platformop.



# HG changeset patch
# User Emmanuel Ackaouy <ack@xxxxxxxxxxxxx>
# Date 1168018476 0
# Node ID e82eda09ef417750be45d8cffe36d72de5ad806e
# Parent  e1971b229e89883f42ff783e8865306477c59180
Enable compatibility mode operation for HYPERVISOR_platformop.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 xen/arch/x86/platform_hypercall.c        |   19 ++++++++++++++++---
 xen/arch/x86/x86_64/Makefile             |    2 ++
 xen/arch/x86/x86_64/compat/entry.S       |    1 -
 xen/arch/x86/x86_64/platform_hypercall.c |   29 +++++++++++++++++++++++++++++
 4 files changed, 47 insertions(+), 4 deletions(-)

diff -r e1971b229e89 -r e82eda09ef41 xen/arch/x86/platform_hypercall.c
--- a/xen/arch/x86/platform_hypercall.c Fri Jan 05 17:34:35 2007 +0000
+++ b/xen/arch/x86/platform_hypercall.c Fri Jan 05 17:34:36 2007 +0000
@@ -23,11 +23,17 @@
 #include <asm/mtrr.h>
 #include "cpu/mtrr/mtrr.h"
 
-long do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op)
+#ifndef COMPAT
+typedef long ret_t;
+DEFINE_SPINLOCK(xenpf_lock);
+#else
+extern spinlock_t xenpf_lock;
+#endif
+
+ret_t do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op)
 {
-    long ret = 0;
+    ret_t ret = 0;
     struct xen_platform_op curop, *op = &curop;
-    static DEFINE_SPINLOCK(xenpf_lock);
 
     if ( !IS_PRIV(current->domain) )
         return -EPERM;
@@ -105,8 +111,15 @@ long do_platform_op(XEN_GUEST_HANDLE(xen
     case XENPF_microcode_update:
     {
         extern int microcode_update(XEN_GUEST_HANDLE(void), unsigned long len);
+#ifndef COMPAT
         ret = microcode_update(op->u.microcode.data,
                                op->u.microcode.length);
+#else
+        XEN_GUEST_HANDLE(void) data;
+
+        guest_from_compat_handle(data, op->u.microcode.data);
+        ret = microcode_update(data, op->u.microcode.length);
+#endif
     }
     break;
 
diff -r e1971b229e89 -r e82eda09ef41 xen/arch/x86/x86_64/Makefile
--- a/xen/arch/x86/x86_64/Makefile      Fri Jan 05 17:34:35 2007 +0000
+++ b/xen/arch/x86/x86_64/Makefile      Fri Jan 05 17:34:36 2007 +0000
@@ -6,6 +6,7 @@ obj-$(CONFIG_COMPAT) += compat.o
 obj-$(CONFIG_COMPAT) += compat.o
 obj-$(CONFIG_COMPAT) += domain.o
 obj-$(CONFIG_COMPAT) += physdev.o
+obj-$(CONFIG_COMPAT) += platform_hypercall.o
 
 ifeq ($(CONFIG_COMPAT),y)
 # extra dependencies
@@ -13,5 +14,6 @@ entry.o:      compat/entry.S
 entry.o:       compat/entry.S
 mm.o:          compat/mm.c
 physdev.o:     ../physdev.c
+platform_hypercall.o: ../platform_hypercall.c
 traps.o:       compat/traps.c
 endif
diff -r e1971b229e89 -r e82eda09ef41 xen/arch/x86/x86_64/compat/entry.S
--- a/xen/arch/x86/x86_64/compat/entry.S        Fri Jan 05 17:34:35 2007 +0000
+++ b/xen/arch/x86/x86_64/compat/entry.S        Fri Jan 05 17:34:36 2007 +0000
@@ -278,7 +278,6 @@ CFIX14:
 
 .section .rodata, "a", @progbits
 
-#define compat_platform_op domain_crash_synchronous
 #define compat_acm_op domain_crash_synchronous
 #define compat_xenoprof_op domain_crash_synchronous
 #define compat_sysctl domain_crash_synchronous
diff -r e1971b229e89 -r e82eda09ef41 xen/arch/x86/x86_64/platform_hypercall.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/x86/x86_64/platform_hypercall.c  Fri Jan 05 17:34:36 2007 +0000
@@ -0,0 +1,29 @@
+/******************************************************************************
+ * platform_hypercall.c
+ *
+ */
+
+#include <xen/config.h>
+#include <xen/types.h>
+#include <compat/platform.h>
+
+DEFINE_XEN_GUEST_HANDLE(compat_platform_op_t);
+#define xen_platform_op     compat_platform_op
+#define xen_platform_op_t   compat_platform_op_t
+#define do_platform_op(x)   compat_platform_op(_##x)
+
+#define COMPAT
+#define _XEN_GUEST_HANDLE(t) XEN_GUEST_HANDLE(t)
+typedef int ret_t;
+
+#include "../platform_hypercall.c"
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.