VirtualBox

Changeset 90622 in vbox


Ignore:
Timestamp:
Aug 11, 2021 9:05:03 AM (3 years ago)
Author:
vboxsync
Message:

VMM/HMSVMR0: Nested SVM: bugref:10080 Attempt to fix debug registers guru meditation with nested-guests.

File:
1 edited

Legend:

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

    r90379 r90622  
    19191919    PCCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    19201920
     1921    /** @todo Figure out stepping with nested-guest. */
     1922    if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx))
     1923    {
     1924        /*
     1925         * We don't want to always intercept DRx read/writes for nested-guests as it causes
     1926         * problems when the nested hypervisor isn't intercepting them, see @bugref{10080}.
     1927         * Instead, they are strictly only requested when the nested hypervisor intercepts
     1928         * them -- handled while merging VMCB controls.
     1929         *
     1930         * If neither the outer nor the nested-hypervisor is intercepting DRx read/writes,
     1931         * then the nested-guest debug state should be actively loaded on the host so that
     1932         * nested-guest reads/writes its own debug registers without causing VM-exits.
     1933         */
     1934        if (   (   pVmcb->ctrl.u16InterceptRdDRx != 0xffff
     1935                || pVmcb->ctrl.u16InterceptWrDRx != 0xffff)
     1936            && !CPUMIsGuestDebugStateActive(pVCpu))
     1937        {
     1938           CPUMR0LoadGuestDebugState(pVCpu, true /* include DR6 */);
     1939           STAM_COUNTER_INC(&pVCpu->hm.s.StatDRxArmed);
     1940           Assert(!CPUMIsHyperDebugStateActive(pVCpu));
     1941           Assert(CPUMIsGuestDebugStateActive(pVCpu));
     1942        }
     1943
     1944        pVmcb->guest.u64DR6 = pCtx->dr[6];
     1945        pVmcb->guest.u64DR7 = pCtx->dr[7];
     1946        return;
     1947    }
     1948
    19211949    /*
    19221950     * Anyone single stepping on the host side? If so, we'll have to use the
     
    22222250    }
    22232251
    2224     /** @todo Figure out debugging with nested-guests, till then just intercept
    2225      *        all DR[0-15] accesses. */
    2226     pVmcbNstGstCtrl->u16InterceptRdDRx |= 0xffff;
    2227     pVmcbNstGstCtrl->u16InterceptWrDRx |= 0xffff;
     2252    /* Merge the guest's DR intercepts into the nested-guest VMCB. */
     2253    pVmcbNstGstCtrl->u16InterceptRdDRx |= pVmcb->ctrl.u16InterceptRdDRx;
     2254    pVmcbNstGstCtrl->u16InterceptWrDRx |= pVmcb->ctrl.u16InterceptWrDRx;
    22282255
    22292256    /*
     
    26352662
    26362663    if (pVCpu->hm.s.fCtxChanged & HM_CHANGED_GUEST_DR_MASK)
    2637     {
    2638         /** @todo Figure out stepping with nested-guest. */
    2639         PCCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    2640         if (!CPUMIsGuestInSvmNestedHwVirtMode(pCtx))
    2641             hmR0SvmExportSharedDebugState(pVCpu, pVmcb);
    2642         else
    2643         {
    2644             pVmcb->guest.u64DR6 = pCtx->dr[6];
    2645             pVmcb->guest.u64DR7 = pCtx->dr[7];
    2646         }
    2647     }
     2664        hmR0SvmExportSharedDebugState(pVCpu, pVmcb);
    26482665
    26492666    pVCpu->hm.s.fCtxChanged &= ~HM_CHANGED_GUEST_DR_MASK;
     
    42134230    VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED_EXEC);            /* Indicate the start of guest execution. */
    42144231
    4215     PVMCC      pVM   = pVCpu->CTX_SUFF(pVM);
     4232    PVMCC      pVM = pVCpu->CTX_SUFF(pVM);
    42164233    PSVMVMCB pVmcb = pSvmTransient->pVmcb;
    42174234
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