ia64/xen-unstable

changeset 17244:2b3ab5377dbb

vmx: fix debugctl handling

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>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Mar 18 13:10:57 2008 +0000 (2008-03-18)
parents 8cc1ed987d5f
children fe339d30e2e1
files xen/arch/x86/hvm/vmx/vmcs.c xen/arch/x86/hvm/vmx/vmx.c
line diff
     1.1 --- a/xen/arch/x86/hvm/vmx/vmcs.c	Tue Mar 18 13:08:30 2008 +0000
     1.2 +++ b/xen/arch/x86/hvm/vmx/vmcs.c	Tue Mar 18 13:10:57 2008 +0000
     1.3 @@ -870,7 +870,7 @@ void vmcs_dump_vcpu(struct vcpu *v)
     1.4      x  = (unsigned long long)vmr(TSC_OFFSET_HIGH) << 32;
     1.5      x |= (uint32_t)vmr(TSC_OFFSET);
     1.6      printk("TSC Offset = %016llx\n", x);
     1.7 -    x  = (unsigned long long)vmr(GUEST_IA32_DEBUGCTL) << 32;
     1.8 +    x  = (unsigned long long)vmr(GUEST_IA32_DEBUGCTL_HIGH) << 32;
     1.9      x |= (uint32_t)vmr(GUEST_IA32_DEBUGCTL);
    1.10      printk("DebugCtl=%016llx DebugExceptions=%016llx\n", x,
    1.11             (unsigned long long)vmr(GUEST_PENDING_DBG_EXCEPTIONS));
     2.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Tue Mar 18 13:08:30 2008 +0000
     2.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Tue Mar 18 13:10:57 2008 +0000
     2.3 @@ -1512,8 +1512,10 @@ static int vmx_msr_read_intercept(struct
     2.4          msr_content = var_range_base[index];
     2.5          break;
     2.6      case MSR_IA32_DEBUGCTLMSR:
     2.7 -        if ( vmx_read_guest_msr(v, ecx, &msr_content) != 0 )
     2.8 -            msr_content = 0;
     2.9 +        msr_content = __vmread(GUEST_IA32_DEBUGCTL);
    2.10 +#ifdef __i386__
    2.11 +        msr_content |= (u64)__vmread(GUEST_IA32_DEBUGCTL_HIGH) << 32;
    2.12 +#endif
    2.13          break;
    2.14      case MSR_IA32_VMX_BASIC...MSR_IA32_VMX_PROCBASED_CTLS2:
    2.15          goto gp_fault;
    2.16 @@ -1732,11 +1734,15 @@ static int vmx_msr_write_intercept(struc
    2.17          }
    2.18  
    2.19          if ( (rc < 0) ||
    2.20 -             (vmx_add_guest_msr(v, ecx) < 0) ||
    2.21               (vmx_add_host_load_msr(v, ecx) < 0) )
    2.22              vmx_inject_hw_exception(v, TRAP_machine_check, 0);
    2.23          else
    2.24 -            vmx_write_guest_msr(v, ecx, msr_content);
    2.25 +        {
    2.26 +            __vmwrite(GUEST_IA32_DEBUGCTL, msr_content);
    2.27 +#ifdef __i386__
    2.28 +            __vmwrite(GUEST_IA32_DEBUGCTL_HIGH, msr_content >> 32);
    2.29 +#endif
    2.30 +        }
    2.31  
    2.32          break;
    2.33      }