aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-02-25 09:18:20 +0000
committerKeir Fraser <keir.fraser@citrix.com>2008-02-25 09:18:20 +0000
commit5f8a368f3b57b40a69615d9f5f9963d8ef6e89aa (patch)
treecb60687c02056662740000a52b5a2cf0a921fcc0
parentc3d370d2540764400875056e29c5221dff027748 (diff)
downloadxen-5f8a368f3b57b40a69615d9f5f9963d8ef6e89aa.tar.gz
xen-5f8a368f3b57b40a69615d9f5f9963d8ef6e89aa.tar.bz2
xen-5f8a368f3b57b40a69615d9f5f9963d8ef6e89aa.zip
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>
-rw-r--r--xen/arch/x86/oprofile/xenoprof.c25
-rw-r--r--xen/common/compat/xenoprof.c1
-rw-r--r--xen/include/asm-x86/xenoprof.h1
3 files changed, 27 insertions, 0 deletions
diff --git a/xen/arch/x86/oprofile/xenoprof.c b/xen/arch/x86/oprofile/xenoprof.c
index a15c8917ed..da62f991e9 100644
--- a/xen/arch/x86/oprofile/xenoprof.c
+++ b/xen/arch/x86/oprofile/xenoprof.c
@@ -11,6 +11,9 @@
#include <xen/guest_access.h>
#include <xen/sched.h>
#include <public/xenoprof.h>
+#ifdef CONFIG_COMPAT
+#include <compat/xenoprof.h>
+#endif
#include <asm/hvm/support.h>
#include "op_counter.h"
@@ -35,6 +38,28 @@ int xenoprof_arch_counter(XEN_GUEST_HANDLE(void) arg)
return 0;
}
+#ifdef CONFIG_COMPAT
+int compat_oprof_arch_counter(XEN_GUEST_HANDLE(void) arg)
+{
+ struct compat_oprof_counter counter;
+
+ if ( copy_from_guest(&counter, arg, 1) )
+ return -EFAULT;
+
+ if ( counter.ind > OP_MAX_COUNTER )
+ return -E2BIG;
+
+ counter_config[counter.ind].count = counter.count;
+ counter_config[counter.ind].enabled = counter.enabled;
+ counter_config[counter.ind].event = counter.event;
+ counter_config[counter.ind].kernel = counter.kernel;
+ counter_config[counter.ind].user = counter.user;
+ counter_config[counter.ind].unit_mask = counter.unit_mask;
+
+ return 0;
+}
+#endif
+
int xenoprofile_get_mode(struct vcpu *v, struct cpu_user_regs * const regs)
{
if ( !guest_mode(regs) )
diff --git a/xen/common/compat/xenoprof.c b/xen/common/compat/xenoprof.c
index e1cad00d2a..00baac859c 100644
--- a/xen/common/compat/xenoprof.c
+++ b/xen/common/compat/xenoprof.c
@@ -14,6 +14,7 @@ CHECK_oprof_init;
#define xenoprof_get_buffer compat_oprof_get_buffer
#define xenoprof_op_get_buffer compat_oprof_op_get_buffer
+#define xenoprof_arch_counter compat_oprof_arch_counter
#define xen_domid_t domid_t
#define compat_domid_t domid_compat_t
diff --git a/xen/include/asm-x86/xenoprof.h b/xen/include/asm-x86/xenoprof.h
index d0bc57b5b6..3e318eba69 100644
--- a/xen/include/asm-x86/xenoprof.h
+++ b/xen/include/asm-x86/xenoprof.h
@@ -41,6 +41,7 @@ int xenoprof_arch_init(int *num_events, char *cpu_type);
#define xenoprof_arch_release_counters() nmi_release_counters()
int xenoprof_arch_counter(XEN_GUEST_HANDLE(void) arg);
+int compat_oprof_arch_counter(XEN_GUEST_HANDLE(void) arg);
struct vcpu;
struct cpu_user_regs;