VirtualBox

Changeset 97096 in vbox for trunk/include/VBox


Ignore:
Timestamp:
Oct 11, 2022 8:47:28 PM (2 years ago)
Author:
vboxsync
Message:

VMM/CPUM: Some code tweaking...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/cpum.h

    r97070 r97096  
    19591959DECLINLINE(bool) CPUMIsGuestInNestedHwvirtMode(PCCPUMCTX pCtx)
    19601960{
     1961#if 0
    19611962    return CPUMIsGuestInVmxNonRootMode(pCtx) || CPUMIsGuestInSvmNestedHwVirtMode(pCtx);
     1963#else
     1964    if (pCtx->hwvirt.enmHwvirt == CPUMHWVIRT_NONE)
     1965        return false;
     1966    if (pCtx->hwvirt.enmHwvirt == CPUMHWVIRT_VMX)
     1967    {
     1968        Assert(!pCtx->hwvirt.vmx.fInVmxNonRootMode || pCtx->hwvirt.vmx.fInVmxRootMode);
     1969        return pCtx->hwvirt.vmx.fInVmxNonRootMode;
     1970    }
     1971    Assert(pCtx->hwvirt.enmHwvirt == CPUMHWVIRT_SVM);
     1972    return RT_BOOL(pCtx->hwvirt.svm.Vmcb.ctrl.u64InterceptCtrl & SVM_CTRL_INTERCEPT_VMRUN);
     1973#endif
     1974}
     1975
     1976/**
     1977 * Checks if we are executing inside an SVM or VMX nested hardware-virtualized
     1978 * guest.
     1979 *
     1980 * @retval  CPUMHWVIRT_NONE if not in SVM or VMX non-root mode.
     1981 * @retval  CPUMHWVIRT_VMX if in VMX non-root mode.
     1982 * @retval  CPUMHWVIRT_SVM if in SVM non-root mode.
     1983 * @param   pCtx    Current CPU context.
     1984 */
     1985DECLINLINE(CPUMHWVIRT) CPUMGetGuestInNestedHwvirtMode(PCCPUMCTX pCtx)
     1986{
     1987    if (pCtx->hwvirt.enmHwvirt == CPUMHWVIRT_NONE)
     1988        return CPUMHWVIRT_NONE;
     1989    if (pCtx->hwvirt.enmHwvirt == CPUMHWVIRT_VMX)
     1990    {
     1991        Assert(!pCtx->hwvirt.vmx.fInVmxNonRootMode || pCtx->hwvirt.vmx.fInVmxRootMode);
     1992        return pCtx->hwvirt.vmx.fInVmxNonRootMode ? CPUMHWVIRT_VMX : CPUMHWVIRT_NONE;
     1993    }
     1994    Assert(pCtx->hwvirt.enmHwvirt == CPUMHWVIRT_SVM);
     1995    return pCtx->hwvirt.svm.Vmcb.ctrl.u64InterceptCtrl & SVM_CTRL_INTERCEPT_VMRUN ? CPUMHWVIRT_SVM : CPUMHWVIRT_NONE;
    19621996}
    19631997
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