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-changelog

[Xen-changelog] [xen-unstable] [HVM][VMX] On a VMEXIT, 'dirty' the DR.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [HVM][VMX] On a VMEXIT, 'dirty' the DR. Restore DR from vcpu struct,
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 27 Jun 2006 10:02:02 +0000
Delivery-date: Tue, 27 Jun 2006 03:04:25 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 9158ecb9045fd533f602378adb4abe41947ef781
# Parent  5610d916ad1be231bd6b6c7ae26665374623a90c
[HVM][VMX] On a VMEXIT, 'dirty' the DR.  Restore DR from vcpu struct, 
disable DR exiting (i.e., enable guest DR access), set VCPUF_dr_dirtied.

Remove "emulated" DR access, which only read and wrote to the debug register
values of the context, but not to the actual hardware values themselves.

Signed-off-by: George Dunlap <dunlapg@xxxxxxxxx>
---
 xen/arch/x86/hvm/vmx/vmx.c |   61 +++++++++------------------------------------
 1 files changed, 13 insertions(+), 48 deletions(-)

diff -r 5610d916ad1b -r 9158ecb9045f xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Tue Jun 27 09:51:18 2006 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Tue Jun 27 09:54:05 2006 +0100
@@ -926,55 +926,20 @@ static void vmx_vmexit_do_cpuid(struct c
     CASE_GET_REG_P(R15, r15)
 #endif
 
-static void vmx_dr_access (unsigned long exit_qualification, struct 
cpu_user_regs *regs)
-{
-    unsigned int reg;
-    unsigned long *reg_p = 0;
+static void vmx_dr_access(unsigned long exit_qualification,
+                          struct cpu_user_regs *regs)
+{
     struct vcpu *v = current;
-    unsigned long eip;
-
-    __vmread(GUEST_RIP, &eip);
-
-    reg = exit_qualification & DEBUG_REG_ACCESS_NUM;
-
-    HVM_DBG_LOG(DBG_LEVEL_1,
-                "vmx_dr_access : eip=%lx, reg=%d, exit_qualification = %lx",
-                eip, reg, exit_qualification);
-
-    switch ( exit_qualification & DEBUG_REG_ACCESS_REG ) {
-    CASE_GET_REG_P(EAX, eax);
-    CASE_GET_REG_P(ECX, ecx);
-    CASE_GET_REG_P(EDX, edx);
-    CASE_GET_REG_P(EBX, ebx);
-    CASE_GET_REG_P(EBP, ebp);
-    CASE_GET_REG_P(ESI, esi);
-    CASE_GET_REG_P(EDI, edi);
-    CASE_EXTEND_GET_REG_P;
-    case REG_ESP:
-        break;
-    default:
-        __hvm_bug(regs);
-    }
-
-    switch (exit_qualification & DEBUG_REG_ACCESS_TYPE) {
-    case TYPE_MOV_TO_DR:
-        /* don't need to check the range */
-        if (reg != REG_ESP)
-            v->arch.guest_context.debugreg[reg] = *reg_p;
-        else {
-            unsigned long value;
-            __vmread(GUEST_RSP, &value);
-            v->arch.guest_context.debugreg[reg] = value;
-        }
-        break;
-    case TYPE_MOV_FROM_DR:
-        if (reg != REG_ESP)
-            *reg_p = v->arch.guest_context.debugreg[reg];
-        else {
-            __vmwrite(GUEST_RSP, v->arch.guest_context.debugreg[reg]);
-        }
-        break;
-    }
+
+    v->arch.hvm_vcpu.flag_dr_dirty = 1;
+
+    /* We could probably be smarter about this */
+    __restore_debug_registers(v);
+
+    /* Allow guest direct access to DR registers */
+    v->arch.hvm_vcpu.u.vmx.exec_control &= ~CPU_BASED_MOV_DR_EXITING;
+    __vmwrite(CPU_BASED_VM_EXEC_CONTROL,
+              v->arch.hvm_vcpu.u.vmx.exec_control);
 }
 
 /*

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [HVM][VMX] On a VMEXIT, 'dirty' the DR. Restore DR from vcpu struct,, Xen patchbot-unstable <=