# HG changeset patch
# User yamahata@xxxxxxxxxxxxx
# Date 1197360897 -32400
# Node ID cbff581a8cf8362b1e58b97377c299ab235ac371
# Parent c9623eb65ac2fe2c718767555d96043ef931f921
make xenoprofile_get_mode() VTi domain aware.
PATCHNAME: make_xenoprofile_get_mode_vti_domain_aware
Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
diff -r c9623eb65ac2 -r cbff581a8cf8 xen/arch/ia64/xen/oprofile/xenoprof.c
--- a/xen/arch/ia64/xen/oprofile/xenoprof.c Fri Dec 07 12:02:12 2007 +0900
+++ b/xen/arch/ia64/xen/oprofile/xenoprof.c Tue Dec 11 17:14:57 2007 +0900
@@ -24,29 +24,58 @@
#include <xen/sched.h>
#include <public/xen.h>
#include <xen/xenoprof.h>
+#include <asm/vmx.h> /* for vmx_user_mode() */
int
xenoprofile_get_mode(struct vcpu *v, struct cpu_user_regs * const regs)
{
int mode;
- // mode
- // 0: user, 1: kernel, 2: xen
- switch (ring(regs))
- {
+ /*
+ * mode
+ * 0: user, 1: kernel, 2: xen
+ * see linux/driver/oprofile/cpu_buffer.h
+ */
+#define CPU_MODE_USER 0
+#define CPU_MODE_KERNEL 1
+#define CPU_MODE_XEN 2
+ if (VMX_DOMAIN(v)) {
+ if (vmx_user_mode(regs)) {
+ switch (ring(regs)) {
+ case 3:
+ mode = CPU_MODE_USER;
+ break;
+ case 0:
+ mode = CPU_MODE_KERNEL;
+ break;
+ /* case 0: case 1: */
+ default:
+ gdprintk(XENLOG_ERR, "%s:%d ring%d in vmx is used!\n",
+ __func__, __LINE__, ring(regs));
+ mode = CPU_MODE_KERNEL; /* fall back to kernel mode. */
+ break;
+ }
+ } else {
+ mode = CPU_MODE_XEN;
+ BUG_ON(ring(regs) != 0);
+ }
+ } else {
+ switch (ring(regs)) {
case 3:
- mode = 0;
- break;
+ mode = CPU_MODE_USER;
+ break;
case CONFIG_CPL0_EMUL:
- mode = 1;
- break;
+ mode = CPU_MODE_KERNEL;
+ break;
case 0:
- mode = 2;
- break;
+ mode = CPU_MODE_XEN;
+ break;
default:
- gdprintk(XENLOG_ERR, "%s:%d ring%d is used!\n", __func__,
- __LINE__, 3 - CONFIG_CPL0_EMUL);
- mode = 1; /* fall back to kernel mode. */
+ gdprintk(XENLOG_ERR, "%s:%d ring%d in pv is used!\n", __func__,
+ __LINE__, 3 - CONFIG_CPL0_EMUL);
+ mode = CPU_MODE_KERNEL; /* fall back to kernel mode. */
+ break;
+ }
}
return mode;
}
16580_cbff581a8cf8_make_xenoprofile_get_mode_vti_domain_aware.patch
Description: Text Data
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel
|