ia64/xen-unstable

changeset 18966:e0301796fce8

x86, vmx: Fix single step on debugger

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Dec 29 14:05:26 2008 +0000 (2008-12-29)
parents d0751463539a
children 5544a96572bf
files xen/arch/x86/hvm/vmx/vmx.c
line diff
     1.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Mon Dec 29 14:03:26 2008 +0000
     1.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Mon Dec 29 14:05:26 2008 +0000
     1.3 @@ -1314,8 +1314,29 @@ static void vmx_set_uc_mode(struct vcpu 
     1.4  
     1.5  static void vmx_set_info_guest(struct vcpu *v)
     1.6  {
     1.7 +    unsigned long intr_shadow;
     1.8 +
     1.9      vmx_vmcs_enter(v);
    1.10 +
    1.11      __vmwrite(GUEST_DR7, v->arch.guest_context.debugreg[7]);
    1.12 +
    1.13 +    /* 
    1.14 +     * If the interruptibility-state field indicates blocking by STI,
    1.15 +     * setting the TF flag in the EFLAGS may cause VM entry to fail
    1.16 +     * and crash the guest. See SDM 3B 22.3.1.5.
    1.17 +     * Resetting the VMX_INTR_SHADOW_STI flag looks hackish but
    1.18 +     * to set the GUEST_PENDING_DBG_EXCEPTIONS.BS here incurs
    1.19 +     * immediately vmexit and hence make no progress.
    1.20 +     */
    1.21 +    intr_shadow = __vmread(GUEST_INTERRUPTIBILITY_INFO);
    1.22 +    if ( v->domain->debugger_attached &&
    1.23 +         (v->arch.guest_context.user_regs.eflags & X86_EFLAGS_TF) &&
    1.24 +         (intr_shadow & VMX_INTR_SHADOW_STI) )
    1.25 +    {
    1.26 +        intr_shadow &= ~VMX_INTR_SHADOW_STI;
    1.27 +        __vmwrite(GUEST_INTERRUPTIBILITY_INFO, intr_shadow);
    1.28 +    }
    1.29 +
    1.30      vmx_vmcs_exit(v);
    1.31  }
    1.32