VirtualBox

Changeset 71834 in vbox


Ignore:
Timestamp:
Apr 12, 2018 7:21:00 AM (7 years ago)
Author:
vboxsync
Message:

VMM/IEM: Nested hw.virt: Implement SVM pause-filter and pause-filter threshold.

Location:
trunk/src/VBox/VMM/VMMAll
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAll.cpp

    r71092 r71834  
    456456
    457457/**
     458 * Get the SVM pause-filter count.
     459 */
     460# define IEM_GET_SVM_PAUSE_FILTER_COUNT(a_pVCpu)             (CPUMGetGuestSvmPauseFilterCount(a_pVCpu, IEM_GET_CTX(a_pVCpu)))
     461
     462/**
    458463 * Invokes the SVM \#VMEXIT handler for the nested-guest.
    459464 */
     
    490495# define IEM_IS_SVM_WRITE_DR_INTERCEPT_SET(a_pVCpu, a_uDr)                                (false)
    491496# define IEM_IS_SVM_XCPT_INTERCEPT_SET(a_pVCpu, a_uVector)                                (false)
     497# define IEM_GET_SVM_PAUSE_FILTER_COUNT(a_pVCpu)                                          (0)
    492498# define IEM_RETURN_SVM_VMEXIT(a_pVCpu, a_uExitCode, a_uExitInfo1, a_uExitInfo2)          do { return VERR_SVM_IPE_1; } while (0)
    493499# define IEM_RETURN_SVM_CRX_VMEXIT(a_pVCpu, a_uExitCode, a_enmAccessCrX, a_iGReg)         do { return VERR_SVM_IPE_1; } while (0)
  • trunk/src/VBox/VMM/VMMAll/IEMAllInstructionsOneByte.cpp.h

    r71092 r71834  
    44574457        IEMOP_MNEMONIC(pause, "pause");
    44584458#ifdef VBOX_WITH_NESTED_HWVIRT
    4459         /** @todo Pause filter count and threshold with SVM nested hardware virt. */
    4460         Assert(!IEM_GET_GUEST_CPU_FEATURES(pVCpu)->fSvmPauseFilter);
    4461         Assert(!IEM_GET_GUEST_CPU_FEATURES(pVCpu)->fSvmPauseFilterThreshold);
     4459        bool fCheckIntercept = true;
     4460        if (IEM_GET_GUEST_CPU_FEATURES(pVCpu)->fSvmPauseFilter)
     4461        {
     4462            /* TSC based pause-filter thresholding. */
     4463            PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
     4464            if (   IEM_GET_GUEST_CPU_FEATURES(pVCpu)->fSvmPauseFilterThreshold
     4465                && pCtx->hwvirt.svm.cPauseFilterThreshold > 0)
     4466            {
     4467                uint64_t const uTick = TMCpuTickGet(pVCpu);
     4468                if (uTick - pCtx->hwvirt.svm.uPrevPauseTick > pCtx->hwvirt.svm.cPauseFilterThreshold)
     4469                    pCtx->hwvirt.svm.cPauseFilter = IEM_GET_SVM_PAUSE_FILTER_COUNT(pVCpu);
     4470                pCtx->hwvirt.svm.uPrevPauseTick = uTick;
     4471            }
     4472
     4473            /* Simple pause-filter counter. */
     4474            if (pCtx->hwvirt.svm.cPauseFilter > 0)
     4475            {
     4476                --pCtx->hwvirt.svm.cPauseFilter;
     4477                fCheckIntercept = false;
     4478            }
     4479        }
     4480        if (fCheckIntercept)
     4481            IEMOP_HLP_SVM_INSTR_INTERCEPT_AND_NRIP(pVCpu, SVM_CTRL_INTERCEPT_PAUSE, SVM_EXIT_PAUSE, 0, 0);
    44624482#endif
    4463         IEMOP_HLP_SVM_INSTR_INTERCEPT_AND_NRIP(pVCpu, SVM_CTRL_INTERCEPT_PAUSE, SVM_EXIT_PAUSE, 0, 0);
    44644483    }
    44654484    else
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