VirtualBox

Changeset 47673 in vbox for trunk


Ignore:
Timestamp:
Aug 12, 2013 2:03:08 PM (11 years ago)
Author:
vboxsync
Message:

HMVMXR0: Fixed copy&past from SVM code with fDr6=false in CPUMR0DebugStateMaybeSaveGuestAndRestoreHost call, causing DR6 to be lost upon ring-3 returns. I also think we must intercept #DB when doing lazy DRx loading, otherwise the #DB will update the host DR6 and the guess will be missing the debug event.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r47671 r47673  
    33803380        }
    33813381        /*
    3382          * If no debugging enabled, we'll lazy load DR0-3.
     3382         * If no debugging enabled, we'll lazy load DR0-3.  Unlike on AMD-V, we
     3383         * must intercept #DB in order to maintain a correct DR6 guest value.
    33833384         */
    33843385        else if (!CPUMIsGuestDebugStateActive(pVCpu))
     3386        {
    33853387            fInterceptMovDRx = true;
     3388            fInterceptDB = true;
     3389        }
    33863390
    33873391        rc = VMXWriteVmcs32(VMX_VMCS_GUEST_DR7, pMixedCtx->dr[7]);
     
    60376041
    60386042    /* Restore host debug registers if necessary and resync on next R0 reentry. */
    6039     if (CPUMIsGuestDebugStateActive(pVCpu))
    6040     {
    6041         CPUMR0DebugStateMaybeSaveGuestAndRestoreHost(pVCpu, false /* save DR6 */);
     6043#ifdef VBOX_STRICT
     6044    if (CPUMIsHyperDebugStateActive(pVCpu))
     6045        Assert(pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_MOV_DR_EXIT);
     6046#endif
     6047    if (CPUMR0DebugStateMaybeSaveGuestAndRestoreHost(pVCpu, true /* save DR6 */))
    60426048        pVCpu->hm.s.fContextUseFlags |= HM_CHANGED_GUEST_DEBUG;
    6043     }
    6044     else if (CPUMIsHyperDebugStateActive(pVCpu))
    6045     {
    6046         CPUMR0DebugStateMaybeSaveGuestAndRestoreHost(pVCpu, false /* save DR6 */);
    6047         Assert(pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_MOV_DR_EXIT);
    6048     }
    60496049    Assert(!CPUMIsGuestDebugStateActive(pVCpu));
    60506050    Assert(!CPUMIsHyperDebugStateActive(pVCpu));
     
    93739373        && !CPUMIsHyperDebugStateActive(pVCpu))
    93749374    {
    9375         /* Don't intercept MOV DRx. */
     9375        /* Don't intercept MOV DRx and #DB any more. */
    93769376        pVCpu->hm.s.vmx.u32ProcCtls &= ~VMX_VMCS_CTRL_PROC_EXEC_MOV_DR_EXIT;
    93779377        rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_PROC_EXEC, pVCpu->hm.s.vmx.u32ProcCtls);
    93789378        AssertRCReturn(rc, rc);
     9379
     9380        if (!pVCpu->hm.s.vmx.RealMode.fRealOnV86Active)
     9381        {
     9382#ifndef HMVMX_ALWAYS_TRAP_ALL_XCPTS
     9383            pVCpu->hm.s.vmx.u32XcptBitmap &= ~RT_BIT(X86_XCPT_DB);
     9384            rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_EXCEPTION_BITMAP, pVCpu->hm.s.vmx.u32XcptBitmap);
     9385            AssertRCReturn(rc, rc);
     9386#endif
     9387        }
    93799388
    93809389        /* Save the host & load the guest debug state, restart execution of the MOV DRx instruction. */
     
    96219630    HMVMX_VALIDATE_EXIT_XCPT_HANDLER_PARAMS();
    96229631    STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestDB);
     9632    Log6(("XcptDB\n"));
    96239633
    96249634    /*
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette