WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] vmx: set DR7 via DOMCTL_setvcpucontext

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] vmx: set DR7 via DOMCTL_setvcpucontext
From: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
Date: Thu, 16 Oct 2008 17:42:05 +0900
Delivery-date: Thu, 16 Oct 2008 01:42:42 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
This patch is needed for a guest domain debugger 
to support hardware watchpoint.

Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>

diff -r 22c89412fc8c xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     Wed Oct 15 15:58:09 2008 +0100
+++ b/xen/arch/x86/domain.c     Thu Oct 16 16:50:45 2008 +0900
@@ -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 22c89412fc8c xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Wed Oct 15 15:58:09 2008 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Thu Oct 16 16:50:45 2008 +0900
@@ -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 22c89412fc8c xen/include/asm-x86/hvm/hvm.h
--- a/xen/include/asm-x86/hvm/hvm.h     Wed Oct 15 15:58:09 2008 +0100
+++ b/xen/include/asm-x86/hvm/hvm.h     Thu Oct 16 16:50:45 2008 +0900
@@ -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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] vmx: set DR7 via DOMCTL_setvcpucontext, Kouya Shimura <=