ia64/xen-unstable

changeset 13310:b8eeb4537e09

Enable compatibility mode operation for kexec.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Emmanuel Ackaouy <ack@xensource.com>
date Fri Jan 05 17:34:41 2007 +0000 (2007-01-05)
parents 762cb69ce3be
children 96dacd72fdbe
files xen/arch/x86/x86_64/compat/entry.S xen/common/Makefile xen/common/compat/kexec.c xen/common/kexec.c xen/include/xlat.lst
line diff
     1.1 --- a/xen/arch/x86/x86_64/compat/entry.S	Fri Jan 05 17:34:40 2007 +0000
     1.2 +++ b/xen/arch/x86/x86_64/compat/entry.S	Fri Jan 05 17:34:41 2007 +0000
     1.3 @@ -316,6 +316,7 @@ ENTRY(compat_hypercall_table)
     1.4          .quad compat_ni_hypercall
     1.5          .quad compat_sysctl             /* 35 */
     1.6          .quad compat_domctl
     1.7 +        .quad compat_kexec_op
     1.8          .rept NR_hypercalls-((.-compat_hypercall_table)/8)
     1.9          .quad compat_ni_hypercall
    1.10          .endr
    1.11 @@ -358,6 +359,7 @@ ENTRY(compat_hypercall_args_table)
    1.12          .byte 0 /* compat_ni_hypercall      */
    1.13          .byte 1 /* compat_sysctl            */  /* 35 */
    1.14          .byte 1 /* compat_domctl            */
    1.15 +        .byte 2 /* compat_kexec_op          */
    1.16          .rept NR_hypercalls-(.-compat_hypercall_args_table)
    1.17          .byte 0 /* compat_ni_hypercall      */
    1.18          .endr
     2.1 --- a/xen/common/Makefile	Fri Jan 05 17:34:40 2007 +0000
     2.2 +++ b/xen/common/Makefile	Fri Jan 05 17:34:41 2007 +0000
     2.3 @@ -44,6 +44,7 @@ ifeq ($(CONFIG_COMPAT),y)
     2.4  # extra dependencies
     2.5  acm_ops.o: compat/acm_ops.c
     2.6  grant_table.o: compat/grant_table.c
     2.7 +kexec.o: compat/kexec.c
     2.8  schedule.o: compat/schedule.c
     2.9  xenoprof.o: compat/xenoprof.c
    2.10  endif
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/xen/common/compat/kexec.c	Fri Jan 05 17:34:41 2007 +0000
     3.3 @@ -0,0 +1,33 @@
     3.4 +/*
     3.5 + * compat/kexec.c
     3.6 + */
     3.7 +
     3.8 +#include <compat/kexec.h>
     3.9 +
    3.10 +#define COMPAT
    3.11 +#define ret_t int
    3.12 +
    3.13 +#define do_kexec_op compat_kexec_op
    3.14 +
    3.15 +#undef kexec_get
    3.16 +#define kexec_get(x)      compat_kexec_get_##x
    3.17 +#define xen_kexec_range   compat_kexec_range
    3.18 +#define xen_kexec_range_t compat_kexec_range_t
    3.19 +
    3.20 +#define kexec_load_unload compat_kexec_load_unload
    3.21 +#define xen_kexec_load    compat_kexec_load
    3.22 +#define xen_kexec_load_t  compat_kexec_load_t
    3.23 +
    3.24 +CHECK_kexec_exec;
    3.25 +
    3.26 +#include "../kexec.c"
    3.27 +
    3.28 +/*
    3.29 + * Local variables:
    3.30 + * mode: C
    3.31 + * c-set-style: "BSD"
    3.32 + * c-basic-offset: 4
    3.33 + * tab-width: 4
    3.34 + * indent-tabs-mode: nil
    3.35 + * End:
    3.36 + */
     4.1 --- a/xen/common/kexec.c	Fri Jan 05 17:34:40 2007 +0000
     4.2 +++ b/xen/common/kexec.c	Fri Jan 05 17:34:41 2007 +0000
     4.3 @@ -22,6 +22,10 @@
     4.4  #include <xen/version.h>
     4.5  #include <public/elfnote.h>
     4.6  
     4.7 +#ifndef COMPAT
     4.8 +
     4.9 +typedef long ret_t;
    4.10 +
    4.11  DEFINE_PER_CPU (crash_note_t, crash_notes);
    4.12  cpumask_t crash_saved_cpus;
    4.13  
    4.14 @@ -143,21 +147,25 @@ static __init int register_crashdump_tri
    4.15  }
    4.16  __initcall(register_crashdump_trigger);
    4.17  
    4.18 -static int kexec_get_reserve(xen_kexec_range_t *range)
    4.19 +#define kexec_get(x)      kexec_get_##x
    4.20 +
    4.21 +#endif
    4.22 +
    4.23 +static int kexec_get(reserve)(xen_kexec_range_t *range)
    4.24  {
    4.25      range->start = kexec_crash_area.start;
    4.26      range->size = kexec_crash_area.size;
    4.27      return 0;
    4.28  }
    4.29  
    4.30 -static int kexec_get_xen(xen_kexec_range_t *range)
    4.31 +static int kexec_get(xen)(xen_kexec_range_t *range)
    4.32  {
    4.33      range->start = virt_to_maddr(_start);
    4.34      range->size = (unsigned long)_end - (unsigned long)_start;
    4.35      return 0;
    4.36  }
    4.37  
    4.38 -static int kexec_get_cpu(xen_kexec_range_t *range)
    4.39 +static int kexec_get(cpu)(xen_kexec_range_t *range)
    4.40  {
    4.41      if ( range->nr < 0 || range->nr >= num_present_cpus() )
    4.42          return -EINVAL;
    4.43 @@ -167,7 +175,7 @@ static int kexec_get_cpu(xen_kexec_range
    4.44      return 0;
    4.45  }
    4.46  
    4.47 -static int kexec_get_range(XEN_GUEST_HANDLE(void) uarg)
    4.48 +static int kexec_get(range)(XEN_GUEST_HANDLE(void) uarg)
    4.49  {
    4.50      xen_kexec_range_t range;
    4.51      int ret = -EINVAL;
    4.52 @@ -178,13 +186,13 @@ static int kexec_get_range(XEN_GUEST_HAN
    4.53      switch ( range.range )
    4.54      {
    4.55      case KEXEC_RANGE_MA_CRASH:
    4.56 -        ret = kexec_get_reserve(&range);
    4.57 +        ret = kexec_get(reserve)(&range);
    4.58          break;
    4.59      case KEXEC_RANGE_MA_XEN:
    4.60 -        ret = kexec_get_xen(&range);
    4.61 +        ret = kexec_get(xen)(&range);
    4.62          break;
    4.63      case KEXEC_RANGE_MA_CPU:
    4.64 -        ret = kexec_get_cpu(&range);
    4.65 +        ret = kexec_get(cpu)(&range);
    4.66          break;
    4.67      }
    4.68  
    4.69 @@ -194,6 +202,8 @@ static int kexec_get_range(XEN_GUEST_HAN
    4.70      return ret;
    4.71  }
    4.72  
    4.73 +#ifndef COMPAT
    4.74 +
    4.75  static int kexec_load_get_bits(int type, int *base, int *bit)
    4.76  {
    4.77      switch ( type )
    4.78 @@ -212,6 +222,8 @@ static int kexec_load_get_bits(int type,
    4.79      return 0;
    4.80  }
    4.81  
    4.82 +#endif
    4.83 +
    4.84  static int kexec_load_unload(unsigned long op, XEN_GUEST_HANDLE(void) uarg)
    4.85  {
    4.86      xen_kexec_load_t load;
    4.87 @@ -234,7 +246,11 @@ static int kexec_load_unload(unsigned lo
    4.88  
    4.89          BUG_ON(test_bit((base + !pos), &kexec_flags)); /* must be free */
    4.90  
    4.91 +#ifndef COMPAT
    4.92          memcpy(image, &load.image, sizeof(*image));
    4.93 +#else
    4.94 +        XLAT_kexec_image(image, &load.image);
    4.95 +#endif
    4.96  
    4.97          if ( !(ret = machine_kexec_load(load.type, base + !pos, image)) )
    4.98          {
    4.99 @@ -259,6 +275,8 @@ static int kexec_load_unload(unsigned lo
   4.100      return ret;
   4.101  }
   4.102  
   4.103 +#ifndef COMPAT
   4.104 +
   4.105  static int kexec_exec(XEN_GUEST_HANDLE(void) uarg)
   4.106  {
   4.107      xen_kexec_exec_t exec;
   4.108 @@ -292,7 +310,9 @@ static int kexec_exec(XEN_GUEST_HANDLE(v
   4.109      return -EINVAL; /* never reached */
   4.110  }
   4.111  
   4.112 -long do_kexec_op(unsigned long op, XEN_GUEST_HANDLE(void) uarg)
   4.113 +#endif
   4.114 +
   4.115 +ret_t do_kexec_op(unsigned long op, XEN_GUEST_HANDLE(void) uarg)
   4.116  {
   4.117      unsigned long flags;
   4.118      int ret = -EINVAL;
   4.119 @@ -303,7 +323,7 @@ long do_kexec_op(unsigned long op, XEN_G
   4.120      switch ( op )
   4.121      {
   4.122      case KEXEC_CMD_kexec_get_range:
   4.123 -        ret = kexec_get_range(uarg);
   4.124 +        ret = kexec_get(range)(uarg);
   4.125          break;
   4.126      case KEXEC_CMD_kexec_load:
   4.127      case KEXEC_CMD_kexec_unload:
   4.128 @@ -322,6 +342,10 @@ long do_kexec_op(unsigned long op, XEN_G
   4.129      return ret;
   4.130  }
   4.131  
   4.132 +#if defined(CONFIG_COMPAT) && !defined(COMPAT)
   4.133 +#include "compat/kexec.c"
   4.134 +#endif
   4.135 +
   4.136  /*
   4.137   * Local variables:
   4.138   * mode: C
     5.1 --- a/xen/include/xlat.lst	Fri Jan 05 17:34:40 2007 +0000
     5.2 +++ b/xen/include/xlat.lst	Fri Jan 05 17:34:41 2007 +0000
     5.3 @@ -32,6 +32,8 @@
     5.4  !	gnttab_transfer			grant_table.h
     5.5  ?	gnttab_unmap_grant_ref		grant_table.h
     5.6  ?	grant_entry			grant_table.h
     5.7 +?	kexec_exec			kexec.h
     5.8 +!	kexec_image			kexec.h
     5.9  !	add_to_physmap			memory.h
    5.10  !	foreign_memory_map		memory.h
    5.11  !	memory_exchange			memory.h