direct-io.hg

changeset 13268:e82eda09ef41

Enable compatibility mode operation for HYPERVISOR_platformop.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Emmanuel Ackaouy <ack@xensource.com>
date Fri Jan 05 17:34:36 2007 +0000 (2007-01-05)
parents e1971b229e89
children 56cd6d669151
files xen/arch/x86/platform_hypercall.c xen/arch/x86/x86_64/Makefile xen/arch/x86/x86_64/compat/entry.S xen/arch/x86/x86_64/platform_hypercall.c
line diff
     1.1 --- a/xen/arch/x86/platform_hypercall.c	Fri Jan 05 17:34:35 2007 +0000
     1.2 +++ b/xen/arch/x86/platform_hypercall.c	Fri Jan 05 17:34:36 2007 +0000
     1.3 @@ -23,11 +23,17 @@
     1.4  #include <asm/mtrr.h>
     1.5  #include "cpu/mtrr/mtrr.h"
     1.6  
     1.7 -long do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op)
     1.8 +#ifndef COMPAT
     1.9 +typedef long ret_t;
    1.10 +DEFINE_SPINLOCK(xenpf_lock);
    1.11 +#else
    1.12 +extern spinlock_t xenpf_lock;
    1.13 +#endif
    1.14 +
    1.15 +ret_t do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op)
    1.16  {
    1.17 -    long ret = 0;
    1.18 +    ret_t ret = 0;
    1.19      struct xen_platform_op curop, *op = &curop;
    1.20 -    static DEFINE_SPINLOCK(xenpf_lock);
    1.21  
    1.22      if ( !IS_PRIV(current->domain) )
    1.23          return -EPERM;
    1.24 @@ -105,8 +111,15 @@ long do_platform_op(XEN_GUEST_HANDLE(xen
    1.25      case XENPF_microcode_update:
    1.26      {
    1.27          extern int microcode_update(XEN_GUEST_HANDLE(void), unsigned long len);
    1.28 +#ifndef COMPAT
    1.29          ret = microcode_update(op->u.microcode.data,
    1.30                                 op->u.microcode.length);
    1.31 +#else
    1.32 +        XEN_GUEST_HANDLE(void) data;
    1.33 +
    1.34 +        guest_from_compat_handle(data, op->u.microcode.data);
    1.35 +        ret = microcode_update(data, op->u.microcode.length);
    1.36 +#endif
    1.37      }
    1.38      break;
    1.39  
     2.1 --- a/xen/arch/x86/x86_64/Makefile	Fri Jan 05 17:34:35 2007 +0000
     2.2 +++ b/xen/arch/x86/x86_64/Makefile	Fri Jan 05 17:34:36 2007 +0000
     2.3 @@ -6,6 +6,7 @@ obj-y += traps.o
     2.4  obj-$(CONFIG_COMPAT) += compat.o
     2.5  obj-$(CONFIG_COMPAT) += domain.o
     2.6  obj-$(CONFIG_COMPAT) += physdev.o
     2.7 +obj-$(CONFIG_COMPAT) += platform_hypercall.o
     2.8  
     2.9  ifeq ($(CONFIG_COMPAT),y)
    2.10  # extra dependencies
    2.11 @@ -13,5 +14,6 @@ compat.o:	../compat.c
    2.12  entry.o:	compat/entry.S
    2.13  mm.o:		compat/mm.c
    2.14  physdev.o:	../physdev.c
    2.15 +platform_hypercall.o: ../platform_hypercall.c
    2.16  traps.o:	compat/traps.c
    2.17  endif
     3.1 --- a/xen/arch/x86/x86_64/compat/entry.S	Fri Jan 05 17:34:35 2007 +0000
     3.2 +++ b/xen/arch/x86/x86_64/compat/entry.S	Fri Jan 05 17:34:36 2007 +0000
     3.3 @@ -278,7 +278,6 @@ CFIX14:
     3.4  
     3.5  .section .rodata, "a", @progbits
     3.6  
     3.7 -#define compat_platform_op domain_crash_synchronous
     3.8  #define compat_acm_op domain_crash_synchronous
     3.9  #define compat_xenoprof_op domain_crash_synchronous
    3.10  #define compat_sysctl domain_crash_synchronous
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/xen/arch/x86/x86_64/platform_hypercall.c	Fri Jan 05 17:34:36 2007 +0000
     4.3 @@ -0,0 +1,29 @@
     4.4 +/******************************************************************************
     4.5 + * platform_hypercall.c
     4.6 + *
     4.7 + */
     4.8 +
     4.9 +#include <xen/config.h>
    4.10 +#include <xen/types.h>
    4.11 +#include <compat/platform.h>
    4.12 +
    4.13 +DEFINE_XEN_GUEST_HANDLE(compat_platform_op_t);
    4.14 +#define xen_platform_op     compat_platform_op
    4.15 +#define xen_platform_op_t   compat_platform_op_t
    4.16 +#define do_platform_op(x)   compat_platform_op(_##x)
    4.17 +
    4.18 +#define COMPAT
    4.19 +#define _XEN_GUEST_HANDLE(t) XEN_GUEST_HANDLE(t)
    4.20 +typedef int ret_t;
    4.21 +
    4.22 +#include "../platform_hypercall.c"
    4.23 +
    4.24 +/*
    4.25 + * Local variables:
    4.26 + * mode: C
    4.27 + * c-set-style: "BSD"
    4.28 + * c-basic-offset: 4
    4.29 + * tab-width: 4
    4.30 + * indent-tabs-mode: nil
    4.31 + * End:
    4.32 + */