VirtualBox

Changeset 92458 in vbox


Ignore:
Timestamp:
Nov 16, 2021 12:21:48 PM (3 years ago)
Author:
vboxsync
Message:

VMM: Nested VMX: bugref:10092 Translate nested-guest physical address at CR3 through EPT second-level translation when PAE is used.

File:
1 edited

Legend:

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

    r92426 r92458  
    5353static int pgmGstSlatWalk(PVMCPUCC pVCpu, RTGCPHYS GCPhysNested, bool fIsLinearAddrValid, RTGCPTR GCPtrNested, PPGMPTWALK pWalk,
    5454                          PPGMPTWALKGST pGstWalk);
     55static int pgmGstSlatWalkPhys(PVMCPUCC pVCpu, PGMSLAT enmSlatMode, RTGCPHYS GCPhysNested, PPGMPTWALK pWalk, PPGMPTWALKGST pGstWalk);
    5556#endif
    5657static int pgmShwSyncLongModePDPtr(PVMCPUCC pVCpu, RTGCPTR64 GCPtr, X86PGPAEUINT uGstPml4e, X86PGPAEUINT uGstPdpe, PX86PDPAE *ppPD);
     
    18351836    }
    18361837}
    1837 #endif
     1838
     1839
     1840/**
     1841 * Performs a guest second-level address translation (SLAT) for a nested-guest
     1842 * physical address.
     1843 *
     1844 * This version requires the SLAT mode to be provided by the caller because we could
     1845 * be in the process of switching paging modes (MOV CRX) and cannot presume control
     1846 * register values.
     1847 *
     1848 * @returns VBox status code.
     1849 * @param   pVCpu           The cross context virtual CPU structure of the calling EMT.
     1850 * @param   enmSlatMode     The second-level paging mode to use.
     1851 * @param   GCPhysNested    The nested-guest physical address to translate.
     1852 * @param   pWalk           Where to store the walk result.
     1853 * @param   pGstWalk        Where to store the second-level paging-mode specific
     1854 *                          walk information.
     1855 */
     1856static int pgmGstSlatWalkPhys(PVMCPUCC pVCpu, PGMSLAT enmSlatMode, RTGCPHYS GCPhysNested, PPGMPTWALK pWalk,
     1857                              PPGMPTWALKGST pGstWalk)
     1858{
     1859    switch (enmSlatMode)
     1860    {
     1861        case PGMSLAT_EPT:
     1862            pGstWalk->enmType = PGMPTWALKGSTTYPE_EPT;
     1863            return PGM_GST_SLAT_NAME_EPT(Walk)(pVCpu, GCPhysNested, false /* fIsLinearaddrValid */, NIL_RTGCPTR, pWalk,
     1864                                               &pGstWalk->u.Ept);
     1865
     1866        default:
     1867            AssertFailed();
     1868            return VERR_PGM_NOT_USED_IN_MODE;
     1869    }
     1870}
     1871#endif /* VBOX_WITH_NESTED_HWVIRT_VMX_EPT */
    18381872
    18391873
     
    26722706    PGM_A20_APPLY_TO_VAR(pVCpu, GCPhysCR3);
    26732707
     2708#ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT
     2709    if (   CPUMIsGuestVmxEptPagingEnabled(pVCpu)
     2710        && CPUMIsGuestInPAEMode(pVCpu))
     2711    {
     2712        PGMPTWALK    Walk;
     2713        PGMPTWALKGST GstWalk;
     2714        int const rc = pgmGstSlatWalkPhys(pVCpu, PGMSLAT_EPT, GCPhysCR3, &Walk, &GstWalk);
     2715        if (RT_SUCCESS(rc))
     2716            GCPhysCR3 = Walk.GCPhys;
     2717        else
     2718        {
     2719            /** @todo Raise EPT violation VM-exit. */
     2720            return VERR_NOT_IMPLEMENTED;
     2721        }
     2722    }
     2723#endif
     2724
    26742725    PGM_LOCK_VOID(pVM);
    26752726    PPGMPAGE pPageCR3  = pgmPhysGetPage(pVM, GCPhysCR3);
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