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

[Xen-changelog] [xen-unstable] vmx: set DR7 via DOMCTL_setvcpucontext



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1224147160 -3600
# Node ID 98ff908a91b7e12d7ddc609853fa1237d1714dec
# Parent  819ab49deef1da3042d2c111d6c99c3de535dae0
vmx: set DR7 via DOMCTL_setvcpucontext

This patch is needed for a guest domain debugger
to support hardware watchpoint.

Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
---
 xen/arch/x86/domain.c         |    3 +++
 xen/arch/x86/hvm/vmx/vmx.c    |   10 +++++++++-
 xen/include/asm-x86/hvm/hvm.h |    7 +++++++
 3 files changed, 19 insertions(+), 1 deletion(-)

diff -r 819ab49deef1 -r 98ff908a91b7 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     Thu Oct 16 09:51:42 2008 +0100
+++ b/xen/arch/x86/domain.c     Thu Oct 16 09:52:40 2008 +0100
@@ -575,7 +575,10 @@ int arch_set_info_guest(
     v->arch.guest_context.user_regs.eflags |= 2;
 
     if ( is_hvm_vcpu(v) )
+    {
+        hvm_set_info_guest(v);
         goto out;
+    }
 
     /* Only CR0.TS is modifiable by guest or admin. */
     v->arch.guest_context.ctrlreg[0] &= X86_CR0_TS;
diff -r 819ab49deef1 -r 98ff908a91b7 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Thu Oct 16 09:51:42 2008 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Thu Oct 16 09:52:40 2008 +0100
@@ -1184,6 +1184,13 @@ static void vmx_set_uc_mode(struct vcpu 
     vpid_sync_all();
 }
 
+static void vmx_set_info_guest(struct vcpu *v)
+{
+    vmx_vmcs_enter(v);
+    __vmwrite(GUEST_DR7, v->arch.guest_context.debugreg[7]);
+    vmx_vmcs_exit(v);
+}
+
 static struct hvm_function_table vmx_function_table = {
     .name                 = "VMX",
     .domain_initialise    = vmx_domain_initialise,
@@ -1214,7 +1221,8 @@ static struct hvm_function_table vmx_fun
     .msr_read_intercept   = vmx_msr_read_intercept,
     .msr_write_intercept  = vmx_msr_write_intercept,
     .invlpg_intercept     = vmx_invlpg_intercept,
-    .set_uc_mode          = vmx_set_uc_mode
+    .set_uc_mode          = vmx_set_uc_mode,
+    .set_info_guest       = vmx_set_info_guest
 };
 
 static unsigned long *vpid_bitmap;
diff -r 819ab49deef1 -r 98ff908a91b7 xen/include/asm-x86/hvm/hvm.h
--- a/xen/include/asm-x86/hvm/hvm.h     Thu Oct 16 09:51:42 2008 +0100
+++ b/xen/include/asm-x86/hvm/hvm.h     Thu Oct 16 09:52:40 2008 +0100
@@ -128,6 +128,7 @@ struct hvm_function_table {
     int (*msr_write_intercept)(struct cpu_user_regs *regs);
     void (*invlpg_intercept)(unsigned long vaddr);
     void (*set_uc_mode)(struct vcpu *v);
+    void (*set_info_guest)(struct vcpu *v);
 };
 
 extern struct hvm_function_table hvm_funcs;
@@ -314,4 +315,10 @@ int hvm_virtual_to_linear_addr(
     unsigned int addr_size,
     unsigned long *linear_addr);
 
+static inline void hvm_set_info_guest(struct vcpu *v)
+{
+    if ( hvm_funcs.set_info_guest )
+        return hvm_funcs.set_info_guest(v);
+}
+
 #endif /* __ASM_X86_HVM_HVM_H__ */

_______________________________________________
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®.