VirtualBox

Changeset 92642 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 30, 2021 9:19:01 AM (3 years ago)
Author:
vboxsync
Message:

VMM: Nested VMX: bugref:10092 Avoid RT_ZERO'ing multiple times, also just use passed in pWalk rather than construct another copy on the stack. Assert basic assumptions when Walk succeeds.

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

Legend:

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

    r92639 r92642  
    17331733    VMCPU_ASSERT_EMT(pVCpu);
    17341734    Assert(pWalk);
    1735     RT_BZERO(pWalk, sizeof(*pWalk));
    17361735    uintptr_t idx = pVCpu->pgm.s.idxGuestModeData;
    17371736    AssertReturn(idx < RT_ELEMENTS(g_aPgmGuestModeData), VERR_PGM_MODE_IPE);
  • trunk/src/VBox/VMM/VMMAll/PGMAllGst.h

    r92626 r92642  
    380380   || PGM_GST_TYPE == PGM_TYPE_AMD64
    381381
    382     PGMPTWALK Walk;
    383382    GSTPTWALK GstWalk;
    384     RT_ZERO(Walk);
    385     RT_ZERO(GstWalk);
    386     int rc = PGM_GST_NAME(Walk)(pVCpu, GCPtr, &Walk, &GstWalk);
     383    int rc = PGM_GST_NAME(Walk)(pVCpu, GCPtr, pWalk, &GstWalk);
    387384    if (RT_FAILURE(rc))
    388385        return rc;
    389386
    390     uint64_t fFlags;
    391     if (!Walk.fBigPage)
     387    Assert(pWalk->fSucceeded);
     388    Assert(pWalk->GCPtr == GCPtr);
     389
     390    PGMPTATTRS fFlags;
     391    if (!pWalk->fBigPage)
    392392        fFlags = (GstWalk.Pte.u & ~(GST_PTE_PG_MASK | X86_PTE_RW | X86_PTE_US))                      /* NX not needed */
    393                | (Walk.fEffective & (PGM_PTATTRS_W_MASK | PGM_PTATTRS_US_MASK))
     393               | (pWalk->fEffective & (PGM_PTATTRS_W_MASK | PGM_PTATTRS_US_MASK))
    394394# if PGM_WITH_NX(PGM_GST_TYPE, PGM_GST_TYPE)
    395                | (Walk.fEffective & PGM_PTATTRS_NX_MASK)
     395               | (pWalk->fEffective & PGM_PTATTRS_NX_MASK)
    396396# endif
    397397                 ;
     
    399399    {
    400400        fFlags = (GstWalk.Pde.u & ~(GST_PTE_PG_MASK | X86_PDE4M_RW | X86_PDE4M_US | X86_PDE4M_PS))   /* NX not needed */
    401                | (Walk.fEffective & (PGM_PTATTRS_W_MASK | PGM_PTATTRS_US_MASK | PGM_PTATTRS_PAT_MASK))
     401               | (pWalk->fEffective & (PGM_PTATTRS_W_MASK | PGM_PTATTRS_US_MASK | PGM_PTATTRS_PAT_MASK))
    402402# if PGM_WITH_NX(PGM_GST_TYPE, PGM_GST_TYPE)
    403                | (Walk.fEffective & PGM_PTATTRS_NX_MASK)
     403               | (pWalk->fEffective & PGM_PTATTRS_NX_MASK)
    404404# endif
    405405               ;
    406406    }
    407407
    408     pWalk->fSucceeded = true;
    409     pWalk->GCPtr      = GCPtr;
    410     pWalk->GCPhys     = Walk.GCPhys & ~(RTGCPHYS)PAGE_OFFSET_MASK;
     408    pWalk->GCPhys    &= ~(RTGCPHYS)PAGE_OFFSET_MASK;
    411409    pWalk->fEffective = fFlags;
    412410    return VINF_SUCCESS;
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