ia64/xen-unstable

changeset 13305:56cd6d669151

Enable compatibility mode operation for HYPERVISOR_acm_op.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Emmanuel Ackaouy <ack@xensource.com>
date Fri Jan 05 17:34:37 2007 +0000 (2007-01-05)
parents e82eda09ef41
children 62f3df867d0e
files xen/arch/x86/x86_64/compat/entry.S xen/common/Makefile xen/common/acm_ops.c xen/common/compat/acm_ops.c xen/include/xlat.lst
line diff
     1.1 --- a/xen/arch/x86/x86_64/compat/entry.S	Fri Jan 05 17:34:36 2007 +0000
     1.2 +++ b/xen/arch/x86/x86_64/compat/entry.S	Fri Jan 05 17:34:37 2007 +0000
     1.3 @@ -278,7 +278,6 @@ CFIX14:
     1.4  
     1.5  .section .rodata, "a", @progbits
     1.6  
     1.7 -#define compat_acm_op domain_crash_synchronous
     1.8  #define compat_xenoprof_op domain_crash_synchronous
     1.9  #define compat_sysctl domain_crash_synchronous
    1.10  #define compat_domctl domain_crash_synchronous
     2.1 --- a/xen/common/Makefile	Fri Jan 05 17:34:36 2007 +0000
     2.2 +++ b/xen/common/Makefile	Fri Jan 05 17:34:37 2007 +0000
     2.3 @@ -42,6 +42,7 @@ version.o: $(BASEDIR)/include/xen/compil
     2.4  
     2.5  ifeq ($(CONFIG_COMPAT),y)
     2.6  # extra dependencies
     2.7 +acm_ops.o: compat/acm_ops.c
     2.8  grant_table.o: compat/grant_table.c
     2.9  schedule.o: compat/schedule.c
    2.10  endif
     3.1 --- a/xen/common/acm_ops.c	Fri Jan 05 17:34:36 2007 +0000
     3.2 +++ b/xen/common/acm_ops.c	Fri Jan 05 17:34:37 2007 +0000
     3.3 @@ -15,6 +15,7 @@
     3.4   *
     3.5   */
     3.6  
     3.7 +#ifndef COMPAT
     3.8  #include <xen/config.h>
     3.9  #include <xen/types.h>
    3.10  #include <xen/lib.h>
    3.11 @@ -28,6 +29,10 @@
    3.12  #include <xen/guest_access.h>
    3.13  #include <acm/acm_hooks.h>
    3.14  
    3.15 +typedef long ret_t;
    3.16 +
    3.17 +#endif /* !COMPAT */
    3.18 +
    3.19  #ifndef ACM_SECURITY
    3.20  
    3.21  
    3.22 @@ -40,6 +45,7 @@ long do_acm_op(int cmd, XEN_GUEST_HANDLE
    3.23  #else
    3.24  
    3.25  
    3.26 +#ifndef COMPAT
    3.27  int acm_authorize_acm_ops(struct domain *d)
    3.28  {
    3.29      /* currently, policy management functions are restricted to privileged domains */
    3.30 @@ -47,11 +53,12 @@ int acm_authorize_acm_ops(struct domain 
    3.31          return -EPERM;
    3.32      return 0;
    3.33  }
    3.34 +#endif
    3.35  
    3.36  
    3.37 -long do_acm_op(int cmd, XEN_GUEST_HANDLE(void) arg)
    3.38 +ret_t do_acm_op(int cmd, XEN_GUEST_HANDLE(void) arg)
    3.39  {
    3.40 -    long rc = -EFAULT;
    3.41 +    ret_t rc = -EFAULT;
    3.42  
    3.43      if (acm_authorize_acm_ops(current->domain))
    3.44          return -EPERM;
    3.45 @@ -219,6 +226,10 @@ long do_acm_op(int cmd, XEN_GUEST_HANDLE
    3.46  
    3.47  #endif
    3.48  
    3.49 +#if defined(CONFIG_COMPAT) && !defined(COMPAT)
    3.50 +#include "compat/acm_ops.c"
    3.51 +#endif
    3.52 +
    3.53  /*
    3.54   * Local variables:
    3.55   * mode: C
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/xen/common/compat/acm_ops.c	Fri Jan 05 17:34:37 2007 +0000
     4.3 @@ -0,0 +1,47 @@
     4.4 +/******************************************************************************
     4.5 + * compat/acm_ops.c
     4.6 + */
     4.7 +
     4.8 +#include <compat/acm.h>
     4.9 +#include <compat/acm_ops.h>
    4.10 +
    4.11 +#define COMPAT
    4.12 +#define ret_t int
    4.13 +
    4.14 +#define do_acm_op compat_acm_op
    4.15 +
    4.16 +static inline XEN_GUEST_HANDLE(void) acm_xlat_handle(COMPAT_HANDLE(void) cmp)
    4.17 +{
    4.18 +    XEN_GUEST_HANDLE(void) nat;
    4.19 +
    4.20 +    guest_from_compat_handle(nat, cmp);
    4.21 +    return nat;
    4.22 +}
    4.23 +
    4.24 +#define acm_setpolicy compat_acm_setpolicy
    4.25 +#define acm_set_policy(h, sz) acm_set_policy(acm_xlat_handle(h), sz)
    4.26 +
    4.27 +#define acm_getpolicy compat_acm_getpolicy
    4.28 +#define acm_get_policy(h, sz) acm_get_policy(acm_xlat_handle(h), sz)
    4.29 +
    4.30 +#define acm_dumpstats compat_acm_dumpstats
    4.31 +#define acm_dump_statistics(h, sz) acm_dump_statistics(acm_xlat_handle(h), sz)
    4.32 +
    4.33 +#define acm_getssid compat_acm_getssid
    4.34 +#define acm_get_ssid(r, h, sz) acm_get_ssid(r, acm_xlat_handle(h), sz)
    4.35 +
    4.36 +#define xen_acm_getdecision acm_getdecision
    4.37 +CHECK_acm_getdecision;
    4.38 +#undef xen_acm_getdecision
    4.39 +
    4.40 +#include "../acm_ops.c"
    4.41 +
    4.42 +/*
    4.43 + * Local variables:
    4.44 + * mode: C
    4.45 + * c-set-style: "BSD"
    4.46 + * c-basic-offset: 4
    4.47 + * tab-width: 4
    4.48 + * indent-tabs-mode: nil
    4.49 + * End:
    4.50 + */
     5.1 --- a/xen/include/xlat.lst	Fri Jan 05 17:34:36 2007 +0000
     5.2 +++ b/xen/include/xlat.lst	Fri Jan 05 17:34:37 2007 +0000
     5.3 @@ -9,6 +9,7 @@
     5.4  !	cpu_user_regs			arch-x86/xen-@arch@.h
     5.5  !	trap_info			arch-x86/xen.h
     5.6  !	vcpu_guest_context		arch-x86/xen.h
     5.7 +?	acm_getdecision			acm_ops.h
     5.8  ?	evtchn_alloc_unbound		event_channel.h
     5.9  ?	evtchn_bind_interdomain		event_channel.h
    5.10  ?	evtchn_bind_ipi			event_channel.h