VirtualBox

Changeset 79880 in vbox


Ignore:
Timestamp:
Jul 19, 2019 10:08:07 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
132282
Message:

VMM/HMVMXR0: Nested VMX: bugref:9180 Always intercept Mov DRx accesses for the nested-guests for now.

File:
1 edited

Legend:

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

    r79875 r79880  
    61496149        int rc = VMXWriteVmcs32(VMX_VMCS_GUEST_DR7, CPUMGetGuestDR7(pVCpu));
    61506150        AssertRCReturn(rc, rc);
     6151
     6152        /* Always intercept Mov DRx accesses for the nested-guest for now. */
     6153        pVmcsInfo->u32ProcCtls |= VMX_PROC_CTLS_MOV_DR_EXIT;
     6154        rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_PROC_EXEC, pVmcsInfo->u32ProcCtls);
     6155        AssertRCReturn(rc, rc);
    61516156        return VINF_SUCCESS;
    61526157    }
     
    1091110916     */
    1091210917    PVMXVMCSINFO pVmcsInfoNstGst = &pVCpu->hm.s.vmx.VmcsInfoNstGst;
    10913     RTHCPHYS HCPhysVirtApic;
    10914     uint32_t u32TprThreshold;
     10918    RTHCPHYS     HCPhysVirtApic;
     10919    uint32_t     u32TprThreshold;
    1091510920    if (u32ProcCtls & VMX_PROC_CTLS_USE_TPR_SHADOW)
    1091610921    {
     
    1632016325{
    1632116326    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
    16322 
    16323     /* We should -not- get this VM-exit if the guest's debug registers were active. */
    16324     if (pVmxTransient->fWasGuestDebugStateActive)
    16325     {
    16326         AssertMsgFailed(("Unexpected MOV DRx exit\n"));
    16327         HMVMX_UNEXPECTED_EXIT_RET(pVCpu, pVmxTransient->uExitReason);
    16328     }
    16329 
    1633016327    PVMXVMCSINFO pVmcsInfo = pVmxTransient->pVmcsInfo;
    16331     if (   !pVCpu->hm.s.fSingleInstruction
    16332         && !pVmxTransient->fWasHyperDebugStateActive)
    16333     {
    16334         Assert(!DBGFIsStepping(pVCpu));
    16335         Assert(pVmcsInfo->u32XcptBitmap & RT_BIT(X86_XCPT_DB));
    16336 
    16337         /* Don't intercept MOV DRx any more. */
    16338         pVmcsInfo->u32ProcCtls &= ~VMX_PROC_CTLS_MOV_DR_EXIT;
    16339         int rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_PROC_EXEC, pVmcsInfo->u32ProcCtls);
    16340         AssertRCReturn(rc, rc);
    16341 
    16342         /* We're playing with the host CPU state here, make sure we can't preempt or longjmp. */
    16343         VMMRZCallRing3Disable(pVCpu);
    16344         HM_DISABLE_PREEMPT(pVCpu);
    16345 
    16346         /* Save the host & load the guest debug state, restart execution of the MOV DRx instruction. */
    16347         CPUMR0LoadGuestDebugState(pVCpu, true /* include DR6 */);
    16348         Assert(CPUMIsGuestDebugStateActive(pVCpu) || HC_ARCH_BITS == 32);
    16349 
    16350         HM_RESTORE_PREEMPT();
    16351         VMMRZCallRing3Enable(pVCpu);
     16328
     16329    /* We might get this VM-exit if the nested-guest is not intercepting MOV DRx accesses. */
     16330    if (!pVmxTransient->fIsNestedGuest)
     16331    {
     16332        /* We should -not- get this VM-exit if the guest's debug registers were active. */
     16333        if (pVmxTransient->fWasGuestDebugStateActive)
     16334        {
     16335            AssertMsgFailed(("Unexpected MOV DRx exit\n"));
     16336            HMVMX_UNEXPECTED_EXIT_RET(pVCpu, pVmxTransient->uExitReason);
     16337        }
     16338
     16339        if (   !pVCpu->hm.s.fSingleInstruction
     16340            && !pVmxTransient->fWasHyperDebugStateActive)
     16341        {
     16342            Assert(!DBGFIsStepping(pVCpu));
     16343            Assert(pVmcsInfo->u32XcptBitmap & RT_BIT(X86_XCPT_DB));
     16344
     16345            /* Don't intercept MOV DRx any more. */
     16346            pVmcsInfo->u32ProcCtls &= ~VMX_PROC_CTLS_MOV_DR_EXIT;
     16347            int rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_PROC_EXEC, pVmcsInfo->u32ProcCtls);
     16348            AssertRCReturn(rc, rc);
     16349
     16350            /* We're playing with the host CPU state here, make sure we can't preempt or longjmp. */
     16351            VMMRZCallRing3Disable(pVCpu);
     16352            HM_DISABLE_PREEMPT(pVCpu);
     16353
     16354            /* Save the host & load the guest debug state, restart execution of the MOV DRx instruction. */
     16355            CPUMR0LoadGuestDebugState(pVCpu, true /* include DR6 */);
     16356            Assert(CPUMIsGuestDebugStateActive(pVCpu) || HC_ARCH_BITS == 32);
     16357
     16358            HM_RESTORE_PREEMPT();
     16359            VMMRZCallRing3Enable(pVCpu);
    1635216360
    1635316361#ifdef VBOX_WITH_STATISTICS
    16354         rc = hmR0VmxReadExitQualVmcs(pVCpu, pVmxTransient);
    16355         AssertRCReturn(rc, rc);
    16356         if (VMX_EXIT_QUAL_DRX_DIRECTION(pVmxTransient->uExitQual) == VMX_EXIT_QUAL_DRX_DIRECTION_WRITE)
    16357             STAM_COUNTER_INC(&pVCpu->hm.s.StatExitDRxWrite);
    16358         else
    16359             STAM_COUNTER_INC(&pVCpu->hm.s.StatExitDRxRead);
     16362            rc = hmR0VmxReadExitQualVmcs(pVCpu, pVmxTransient);
     16363            AssertRCReturn(rc, rc);
     16364            if (VMX_EXIT_QUAL_DRX_DIRECTION(pVmxTransient->uExitQual) == VMX_EXIT_QUAL_DRX_DIRECTION_WRITE)
     16365                STAM_COUNTER_INC(&pVCpu->hm.s.StatExitDRxWrite);
     16366            else
     16367                STAM_COUNTER_INC(&pVCpu->hm.s.StatExitDRxRead);
    1636016368#endif
    16361         STAM_COUNTER_INC(&pVCpu->hm.s.StatDRxContextSwitch);
    16362         return VINF_SUCCESS;
     16369            STAM_COUNTER_INC(&pVCpu->hm.s.StatDRxContextSwitch);
     16370            return VINF_SUCCESS;
     16371        }
    1636316372    }
    1636416373
Note: See TracChangeset for help on using the changeset viewer.

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