[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xenoprof: Fix x86 32-on-64 xenoprof_arch_counter() implementation.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1203931100 0
# Node ID 44ec075760b62b5ed6a03817f5d8f8419c6a8716
# Parent  89ee92328720b13c5f70c6bea81027382a6ea682
xenoprof: Fix x86 32-on-64 xenoprof_arch_counter() implementation.
From: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/oprofile/xenoprof.c |   25 +++++++++++++++++++++++++
 xen/common/compat/xenoprof.c     |    1 +
 xen/include/asm-x86/xenoprof.h   |    1 +
 3 files changed, 27 insertions(+)

diff -r 89ee92328720 -r 44ec075760b6 xen/arch/x86/oprofile/xenoprof.c
--- a/xen/arch/x86/oprofile/xenoprof.c  Mon Feb 25 09:12:20 2008 +0000
+++ b/xen/arch/x86/oprofile/xenoprof.c  Mon Feb 25 09:18:20 2008 +0000
@@ -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_HAND
     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 -r 89ee92328720 -r 44ec075760b6 xen/common/compat/xenoprof.c
--- a/xen/common/compat/xenoprof.c      Mon Feb 25 09:12:20 2008 +0000
+++ b/xen/common/compat/xenoprof.c      Mon Feb 25 09:18:20 2008 +0000
@@ -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 -r 89ee92328720 -r 44ec075760b6 xen/include/asm-x86/xenoprof.h
--- a/xen/include/asm-x86/xenoprof.h    Mon Feb 25 09:12:20 2008 +0000
+++ b/xen/include/asm-x86/xenoprof.h    Mon Feb 25 09:18:20 2008 +0000
@@ -41,6 +41,7 @@ int xenoprof_arch_init(int *num_events, 
 #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;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.