ia64/xen-unstable

changeset 17112:44ec075760b6

xenoprof: Fix x86 32-on-64 xenoprof_arch_counter() implementation.
From: George Dunlap <George.Dunlap@eu.citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Feb 25 09:18:20 2008 +0000 (2008-02-25)
parents 89ee92328720
children 746fc8fe9d75
files xen/arch/x86/oprofile/xenoprof.c xen/common/compat/xenoprof.c xen/include/asm-x86/xenoprof.h
line diff
     1.1 --- a/xen/arch/x86/oprofile/xenoprof.c	Mon Feb 25 09:12:20 2008 +0000
     1.2 +++ b/xen/arch/x86/oprofile/xenoprof.c	Mon Feb 25 09:18:20 2008 +0000
     1.3 @@ -11,6 +11,9 @@
     1.4  #include <xen/guest_access.h>
     1.5  #include <xen/sched.h>
     1.6  #include <public/xenoprof.h>
     1.7 +#ifdef CONFIG_COMPAT
     1.8 +#include <compat/xenoprof.h>
     1.9 +#endif
    1.10  #include <asm/hvm/support.h>
    1.11  
    1.12  #include "op_counter.h"
    1.13 @@ -35,6 +38,28 @@ int xenoprof_arch_counter(XEN_GUEST_HAND
    1.14      return 0;
    1.15  }
    1.16  
    1.17 +#ifdef CONFIG_COMPAT
    1.18 +int compat_oprof_arch_counter(XEN_GUEST_HANDLE(void) arg)
    1.19 +{
    1.20 +    struct compat_oprof_counter counter;
    1.21 +
    1.22 +    if ( copy_from_guest(&counter, arg, 1) )
    1.23 +        return -EFAULT;
    1.24 +
    1.25 +    if ( counter.ind > OP_MAX_COUNTER )
    1.26 +        return -E2BIG;
    1.27 +
    1.28 +    counter_config[counter.ind].count     = counter.count;
    1.29 +    counter_config[counter.ind].enabled   = counter.enabled;
    1.30 +    counter_config[counter.ind].event     = counter.event;
    1.31 +    counter_config[counter.ind].kernel    = counter.kernel;
    1.32 +    counter_config[counter.ind].user      = counter.user;
    1.33 +    counter_config[counter.ind].unit_mask = counter.unit_mask;
    1.34 +
    1.35 +    return 0;
    1.36 +}
    1.37 +#endif
    1.38 +
    1.39  int xenoprofile_get_mode(struct vcpu *v, struct cpu_user_regs * const regs)
    1.40  {
    1.41      if ( !guest_mode(regs) )
     2.1 --- a/xen/common/compat/xenoprof.c	Mon Feb 25 09:12:20 2008 +0000
     2.2 +++ b/xen/common/compat/xenoprof.c	Mon Feb 25 09:18:20 2008 +0000
     2.3 @@ -14,6 +14,7 @@ CHECK_oprof_init;
     2.4  
     2.5  #define xenoprof_get_buffer compat_oprof_get_buffer
     2.6  #define xenoprof_op_get_buffer compat_oprof_op_get_buffer
     2.7 +#define xenoprof_arch_counter compat_oprof_arch_counter
     2.8  
     2.9  #define xen_domid_t domid_t
    2.10  #define compat_domid_t domid_compat_t
     3.1 --- a/xen/include/asm-x86/xenoprof.h	Mon Feb 25 09:12:20 2008 +0000
     3.2 +++ b/xen/include/asm-x86/xenoprof.h	Mon Feb 25 09:18:20 2008 +0000
     3.3 @@ -41,6 +41,7 @@ int xenoprof_arch_init(int *num_events, 
     3.4  #define xenoprof_arch_release_counters()        nmi_release_counters()
     3.5  
     3.6  int xenoprof_arch_counter(XEN_GUEST_HANDLE(void) arg);
     3.7 +int compat_oprof_arch_counter(XEN_GUEST_HANDLE(void) arg);
     3.8  
     3.9  struct vcpu;
    3.10  struct cpu_user_regs;