From: Arun Sharma <arun.sharma@intel.com>
To: Ian Pratt <Ian.Pratt@cl.cam.ac.uk>,
Keir Fraser <Keir.Fraser@cl.cam.ac.uk>
Cc: xen-devel@lists.xensource.com
Subject: [PATCH] vmx-gdbserver-sstep.patch
Date: Wed, 18 May 2005 19:24:05 -0700 [thread overview]
Message-ID: <20050519022405.GA31028@intel.com> (raw)
This patch enables single stepping a VMX domain using the gdbserver.
Signed-Off-By: Leendert van Doorn <leendert@watson.ibm.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
--- 1.190/xen/arch/x86/domain.c 2005-05-12 06:58:45 -07:00
+++ edited/xen/arch/x86/domain.c 2005-05-17 15:55:28 -07:00
@@ -417,6 +417,12 @@
/* Ensure real hardware interrupts are enabled. */
ed->arch.guest_context.user_regs.eflags |= EF_IE;
+ } else {
+ __vmwrite(GUEST_EFLAGS, ed->arch.guest_context.user_regs.eflags);
+ if (ed->arch.guest_context.user_regs.eflags & EF_TF)
+ __vm_set_bit(EXCEPTION_BITMAP, EXCEPTION_BITMAP_DB);
+ else
+ __vm_clear_bit(EXCEPTION_BITMAP, EXCEPTION_BITMAP_DB);
}
if ( test_bit(_VCPUF_initialised, &ed->vcpu_flags) )
===== xen/arch/x86/vmx.c 1.50 vs edited =====
--- 1.50/xen/arch/x86/vmx.c 2005-05-12 06:58:45 -07:00
+++ edited/xen/arch/x86/vmx.c 2005-05-17 15:29:07 -07:00
@@ -166,7 +166,7 @@
cr0 &= ~X86_CR0_TS;
__vmwrite(GUEST_CR0, cr0);
}
- __vmwrite(EXCEPTION_BITMAP, MONITOR_DEFAULT_EXCEPTION_BITMAP);
+ __vm_clear_bit(EXCEPTION_BITMAP, EXCEPTION_BITMAP_NM);
}
static void vmx_do_general_protection_fault(struct cpu_user_regs *regs)
@@ -1108,6 +1108,21 @@
save_cpu_user_regs(®s);
pdb_handle_exception(3, ®s, 1);
restore_cpu_user_regs(®s);
+ break;
+ }
+#else
+ case TRAP_debug:
+ {
+ void store_cpu_user_regs(struct cpu_user_regs *regs);
+ long do_sched_op(unsigned long op);
+
+
+ store_cpu_user_regs(®s);
+ __vm_clear_bit(GUEST_PENDING_DBG_EXCEPTIONS, PENDING_DEBUG_EXC_BS);
+
+ set_bit(_VCPUF_ctrl_pause, ¤t->vcpu_flags);
+ do_sched_op(SCHEDOP_yield);
+
break;
}
#endif
===== xen/arch/x86/vmx_platform.c 1.15 vs edited =====
--- 1.15/xen/arch/x86/vmx_platform.c 2005-04-28 07:04:10 -07:00
+++ edited/xen/arch/x86/vmx_platform.c 2005-05-17 15:15:24 -07:00
@@ -49,7 +49,7 @@
return 0;
}
#elif defined (__i386__)
-static void store_cpu_user_regs(struct cpu_user_regs *regs)
+void store_cpu_user_regs(struct cpu_user_regs *regs)
{
__vmread(GUEST_SS_SELECTOR, ®s->ss);
__vmread(GUEST_ESP, ®s->esp);
===== xen/include/asm-x86/vmx.h 1.7 vs edited =====
--- 1.7/xen/include/asm-x86/vmx.h 2005-05-11 13:20:21 -07:00
+++ edited/xen/include/asm-x86/vmx.h 2005-05-17 15:28:11 -07:00
@@ -131,6 +131,11 @@
#define EXCEPTION_BITMAP_MC (1 << 18) /* Machine Check */
#define EXCEPTION_BITMAP_XF (1 << 19) /* SIMD Floating-Point Exception */
+/* Pending Debug exceptions */
+
+#define PENDING_DEBUG_EXC_BP (1 << 12) /* break point */
+#define PENDING_DEBUG_EXC_BS (1 << 14) /* Single step */
+
#ifdef XEN_DEBUGGER
#define MONITOR_DEFAULT_EXCEPTION_BITMAP \
( EXCEPTION_BITMAP_PG | \
@@ -231,6 +236,30 @@
return 0;
}
+static inline int __vm_set_bit(unsigned long field, unsigned long mask)
+{
+ unsigned long tmp;
+ int err = 0;
+
+ err |= __vmread(field, &tmp);
+ tmp |= mask;
+ err |= __vmwrite(field, tmp);
+
+ return err;
+}
+
+static inline int __vm_clear_bit(unsigned long field, unsigned long mask)
+{
+ unsigned long tmp;
+ int err = 0;
+
+ err |= __vmread(field, &tmp);
+ tmp &= ~mask;
+ err |= __vmwrite(field, tmp);
+
+ return err;
+}
+
static inline void __vmxoff (void)
{
__asm__ __volatile__ ( VMXOFF_OPCODE
@@ -263,8 +292,7 @@
__vmread(CR0_READ_SHADOW, &cr0);
if (!(cr0 & X86_CR0_TS))
- __vmwrite(EXCEPTION_BITMAP, MONITOR_DEFAULT_EXCEPTION_BITMAP |
- EXCEPTION_BITMAP_NM);
+ __vm_set_bit(EXCEPTION_BITMAP, EXCEPTION_BITMAP_NM);
}
next reply other threads:[~2005-05-19 2:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-19 2:24 Arun Sharma [this message]
2005-05-19 18:59 ` [PATCH] vmx-gdbserver-sstep.patch David Hopwood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050519022405.GA31028@intel.com \
--to=arun.sharma@intel.com \
--cc=Ian.Pratt@cl.cam.ac.uk \
--cc=Keir.Fraser@cl.cam.ac.uk \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.