]> xenbits.xensource.com Git - xen.git/commitdiff
vmx: fix debugctl handling
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 18 Mar 2008 13:10:57 +0000 (13:10 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 18 Mar 2008 13:10:57 +0000 (13:10 +0000)
I recently realized that the original way of dealing with the DebugCtl
MSR on VMX failed to make use of the dedicated guest VMCS field. This
is fixed by this patch.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
xen/arch/x86/hvm/vmx/vmcs.c
xen/arch/x86/hvm/vmx/vmx.c

index 3650abed64adb8b33341e043c4bfba3188bd877a..ac8cda22d4b97a6310c44b9437b5401dc9303e80 100644 (file)
@@ -870,7 +870,7 @@ void vmcs_dump_vcpu(struct vcpu *v)
     x  = (unsigned long long)vmr(TSC_OFFSET_HIGH) << 32;
     x |= (uint32_t)vmr(TSC_OFFSET);
     printk("TSC Offset = %016llx\n", x);
-    x  = (unsigned long long)vmr(GUEST_IA32_DEBUGCTL) << 32;
+    x  = (unsigned long long)vmr(GUEST_IA32_DEBUGCTL_HIGH) << 32;
     x |= (uint32_t)vmr(GUEST_IA32_DEBUGCTL);
     printk("DebugCtl=%016llx DebugExceptions=%016llx\n", x,
            (unsigned long long)vmr(GUEST_PENDING_DBG_EXCEPTIONS));
index bcb371ca556784ea08f23491d5c8bcc9d74b6c21..b78ca6451c7d5850da4a41834cc6c13fcaa79e48 100644 (file)
@@ -1512,8 +1512,10 @@ static int vmx_msr_read_intercept(struct cpu_user_regs *regs)
         msr_content = var_range_base[index];
         break;
     case MSR_IA32_DEBUGCTLMSR:
-        if ( vmx_read_guest_msr(v, ecx, &msr_content) != 0 )
-            msr_content = 0;
+        msr_content = __vmread(GUEST_IA32_DEBUGCTL);
+#ifdef __i386__
+        msr_content |= (u64)__vmread(GUEST_IA32_DEBUGCTL_HIGH) << 32;
+#endif
         break;
     case MSR_IA32_VMX_BASIC...MSR_IA32_VMX_PROCBASED_CTLS2:
         goto gp_fault;
@@ -1732,11 +1734,15 @@ static int vmx_msr_write_intercept(struct cpu_user_regs *regs)
         }
 
         if ( (rc < 0) ||
-             (vmx_add_guest_msr(v, ecx) < 0) ||
              (vmx_add_host_load_msr(v, ecx) < 0) )
             vmx_inject_hw_exception(v, TRAP_machine_check, 0);
         else
-            vmx_write_guest_msr(v, ecx, msr_content);
+        {
+            __vmwrite(GUEST_IA32_DEBUGCTL, msr_content);
+#ifdef __i386__
+            __vmwrite(GUEST_IA32_DEBUGCTL_HIGH, msr_content >> 32);
+#endif
+        }
 
         break;
     }