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

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



# HG changeset patch
# User Emmanuel Ackaouy <ack@xxxxxxxxxxxxx>
# Date 1168018481 0
# Node ID b8eeb4537e095e3f7cb556947427054e934d7b29
# Parent  762cb69ce3be132461498271f720812fe00ac463
Enable compatibility mode operation for kexec.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 xen/arch/x86/x86_64/compat/entry.S |    2 +
 xen/common/Makefile                |    1 
 xen/common/compat/kexec.c          |   33 +++++++++++++++++++++++++++++
 xen/common/kexec.c                 |   42 +++++++++++++++++++++++++++++--------
 xen/include/xlat.lst               |    2 +
 5 files changed, 71 insertions(+), 9 deletions(-)

diff -r 762cb69ce3be -r b8eeb4537e09 xen/arch/x86/x86_64/compat/entry.S
--- a/xen/arch/x86/x86_64/compat/entry.S        Fri Jan 05 17:34:40 2007 +0000
+++ b/xen/arch/x86/x86_64/compat/entry.S        Fri Jan 05 17:34:41 2007 +0000
@@ -316,6 +316,7 @@ ENTRY(compat_hypercall_table)
         .quad compat_ni_hypercall
         .quad compat_sysctl             /* 35 */
         .quad compat_domctl
+        .quad compat_kexec_op
         .rept NR_hypercalls-((.-compat_hypercall_table)/8)
         .quad compat_ni_hypercall
         .endr
@@ -358,6 +359,7 @@ ENTRY(compat_hypercall_args_table)
         .byte 0 /* compat_ni_hypercall      */
         .byte 1 /* compat_sysctl            */  /* 35 */
         .byte 1 /* compat_domctl            */
+        .byte 2 /* compat_kexec_op          */
         .rept NR_hypercalls-(.-compat_hypercall_args_table)
         .byte 0 /* compat_ni_hypercall      */
         .endr
diff -r 762cb69ce3be -r b8eeb4537e09 xen/common/Makefile
--- a/xen/common/Makefile       Fri Jan 05 17:34:40 2007 +0000
+++ b/xen/common/Makefile       Fri Jan 05 17:34:41 2007 +0000
@@ -44,6 +44,7 @@ ifeq ($(CONFIG_COMPAT),y)
 # extra dependencies
 acm_ops.o: compat/acm_ops.c
 grant_table.o: compat/grant_table.c
+kexec.o: compat/kexec.c
 schedule.o: compat/schedule.c
 xenoprof.o: compat/xenoprof.c
 endif
diff -r 762cb69ce3be -r b8eeb4537e09 xen/common/compat/kexec.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/compat/kexec.c Fri Jan 05 17:34:41 2007 +0000
@@ -0,0 +1,33 @@
+/*
+ * compat/kexec.c
+ */
+
+#include <compat/kexec.h>
+
+#define COMPAT
+#define ret_t int
+
+#define do_kexec_op compat_kexec_op
+
+#undef kexec_get
+#define kexec_get(x)      compat_kexec_get_##x
+#define xen_kexec_range   compat_kexec_range
+#define xen_kexec_range_t compat_kexec_range_t
+
+#define kexec_load_unload compat_kexec_load_unload
+#define xen_kexec_load    compat_kexec_load
+#define xen_kexec_load_t  compat_kexec_load_t
+
+CHECK_kexec_exec;
+
+#include "../kexec.c"
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 762cb69ce3be -r b8eeb4537e09 xen/common/kexec.c
--- a/xen/common/kexec.c        Fri Jan 05 17:34:40 2007 +0000
+++ b/xen/common/kexec.c        Fri Jan 05 17:34:41 2007 +0000
@@ -22,6 +22,10 @@
 #include <xen/version.h>
 #include <public/elfnote.h>
 
+#ifndef COMPAT
+
+typedef long ret_t;
+
 DEFINE_PER_CPU (crash_note_t, crash_notes);
 cpumask_t crash_saved_cpus;
 
@@ -143,21 +147,25 @@ static __init int register_crashdump_tri
 }
 __initcall(register_crashdump_trigger);
 
-static int kexec_get_reserve(xen_kexec_range_t *range)
+#define kexec_get(x)      kexec_get_##x
+
+#endif
+
+static int kexec_get(reserve)(xen_kexec_range_t *range)
 {
     range->start = kexec_crash_area.start;
     range->size = kexec_crash_area.size;
     return 0;
 }
 
-static int kexec_get_xen(xen_kexec_range_t *range)
+static int kexec_get(xen)(xen_kexec_range_t *range)
 {
     range->start = virt_to_maddr(_start);
     range->size = (unsigned long)_end - (unsigned long)_start;
     return 0;
 }
 
-static int kexec_get_cpu(xen_kexec_range_t *range)
+static int kexec_get(cpu)(xen_kexec_range_t *range)
 {
     if ( range->nr < 0 || range->nr >= num_present_cpus() )
         return -EINVAL;
@@ -167,7 +175,7 @@ static int kexec_get_cpu(xen_kexec_range
     return 0;
 }
 
-static int kexec_get_range(XEN_GUEST_HANDLE(void) uarg)
+static int kexec_get(range)(XEN_GUEST_HANDLE(void) uarg)
 {
     xen_kexec_range_t range;
     int ret = -EINVAL;
@@ -178,13 +186,13 @@ static int kexec_get_range(XEN_GUEST_HAN
     switch ( range.range )
     {
     case KEXEC_RANGE_MA_CRASH:
-        ret = kexec_get_reserve(&range);
+        ret = kexec_get(reserve)(&range);
         break;
     case KEXEC_RANGE_MA_XEN:
-        ret = kexec_get_xen(&range);
+        ret = kexec_get(xen)(&range);
         break;
     case KEXEC_RANGE_MA_CPU:
-        ret = kexec_get_cpu(&range);
+        ret = kexec_get(cpu)(&range);
         break;
     }
 
@@ -193,6 +201,8 @@ static int kexec_get_range(XEN_GUEST_HAN
 
     return ret;
 }
+
+#ifndef COMPAT
 
 static int kexec_load_get_bits(int type, int *base, int *bit)
 {
@@ -211,6 +221,8 @@ static int kexec_load_get_bits(int type,
     }
     return 0;
 }
+
+#endif
 
 static int kexec_load_unload(unsigned long op, XEN_GUEST_HANDLE(void) uarg)
 {
@@ -234,7 +246,11 @@ static int kexec_load_unload(unsigned lo
 
         BUG_ON(test_bit((base + !pos), &kexec_flags)); /* must be free */
 
+#ifndef COMPAT
         memcpy(image, &load.image, sizeof(*image));
+#else
+        XLAT_kexec_image(image, &load.image);
+#endif
 
         if ( !(ret = machine_kexec_load(load.type, base + !pos, image)) )
         {
@@ -259,6 +275,8 @@ static int kexec_load_unload(unsigned lo
     return ret;
 }
 
+#ifndef COMPAT
+
 static int kexec_exec(XEN_GUEST_HANDLE(void) uarg)
 {
     xen_kexec_exec_t exec;
@@ -292,7 +310,9 @@ static int kexec_exec(XEN_GUEST_HANDLE(v
     return -EINVAL; /* never reached */
 }
 
-long do_kexec_op(unsigned long op, XEN_GUEST_HANDLE(void) uarg)
+#endif
+
+ret_t do_kexec_op(unsigned long op, XEN_GUEST_HANDLE(void) uarg)
 {
     unsigned long flags;
     int ret = -EINVAL;
@@ -303,7 +323,7 @@ long do_kexec_op(unsigned long op, XEN_G
     switch ( op )
     {
     case KEXEC_CMD_kexec_get_range:
-        ret = kexec_get_range(uarg);
+        ret = kexec_get(range)(uarg);
         break;
     case KEXEC_CMD_kexec_load:
     case KEXEC_CMD_kexec_unload:
@@ -321,6 +341,10 @@ long do_kexec_op(unsigned long op, XEN_G
 
     return ret;
 }
+
+#if defined(CONFIG_COMPAT) && !defined(COMPAT)
+#include "compat/kexec.c"
+#endif
 
 /*
  * Local variables:
diff -r 762cb69ce3be -r b8eeb4537e09 xen/include/xlat.lst
--- a/xen/include/xlat.lst      Fri Jan 05 17:34:40 2007 +0000
+++ b/xen/include/xlat.lst      Fri Jan 05 17:34:41 2007 +0000
@@ -32,6 +32,8 @@
 !      gnttab_transfer                 grant_table.h
 ?      gnttab_unmap_grant_ref          grant_table.h
 ?      grant_entry                     grant_table.h
+?      kexec_exec                      kexec.h
+!      kexec_image                     kexec.h
 !      add_to_physmap                  memory.h
 !      foreign_memory_map              memory.h
 !      memory_exchange                 memory.h

_______________________________________________
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®.