VirtualBox

Changeset 90439 in vbox for trunk


Ignore:
Timestamp:
Jul 30, 2021 4:41:49 PM (4 years ago)
Author:
vboxsync
Message:

VMM/PGM: Check PGMCritSectEnter status code when we don't return it. bugref:6695

Location:
trunk/src/VBox/VMM
Files:
17 edited

Legend:

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

    r90346 r90439  
    947947    {
    948948        PGM_LOCK_ASSERT_OWNER(pVM);
    949         pgmUnlock(pVM);
     949        PGM_UNLOCK(pVM);
    950950    }
    951951    LogFlow(("PGMTrap0eHandler: uErr=%RGx pvFault=%RGv rc=%Rrc\n", uErr, pvFault, rc));
     
    12251225     */
    12261226    STAM_PROFILE_START(&pVCpu->pgm.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,InvalidatePage), a);
    1227     pgmLock(pVM);
     1227    PGM_LOCK_VOID(pVM);
    12281228
    12291229    uintptr_t const idxBth = pVCpu->pgm.s.idxBothModeData;
    1230     AssertReturnStmt(idxBth < RT_ELEMENTS(g_aPgmBothModeData), pgmUnlock(pVM), VERR_PGM_MODE_IPE);
    1231     AssertReturnStmt(g_aPgmBothModeData[idxBth].pfnInvalidatePage, pgmUnlock(pVM), VERR_PGM_MODE_IPE);
     1230    AssertReturnStmt(idxBth < RT_ELEMENTS(g_aPgmBothModeData), PGM_UNLOCK(pVM), VERR_PGM_MODE_IPE);
     1231    AssertReturnStmt(g_aPgmBothModeData[idxBth].pfnInvalidatePage, PGM_UNLOCK(pVM), VERR_PGM_MODE_IPE);
    12321232    rc = g_aPgmBothModeData[idxBth].pfnInvalidatePage(pVCpu, GCPtrPage);
    12331233
    1234     pgmUnlock(pVM);
     1234    PGM_UNLOCK(pVM);
    12351235    STAM_PROFILE_STOP(&pVCpu->pgm.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,InvalidatePage), a);
    12361236
     
    12931293{
    12941294    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    1295     pgmLock(pVM);
     1295    PGM_LOCK_VOID(pVM);
    12961296
    12971297    uintptr_t idxShw = pVCpu->pgm.s.idxShadowModeData;
     
    13001300    int rc = g_aPgmShadowModeData[idxShw].pfnGetPage(pVCpu, GCPtr, pfFlags, pHCPhys);
    13011301
    1302     pgmUnlock(pVM);
     1302    PGM_UNLOCK(pVM);
    13031303    return rc;
    13041304}
     
    13271327
    13281328    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    1329     pgmLock(pVM);
     1329    PGM_LOCK_VOID(pVM);
    13301330
    13311331    uintptr_t idxShw = pVCpu->pgm.s.idxShadowModeData;
     
    13341334    int rc = g_aPgmShadowModeData[idxShw].pfnModifyPage(pVCpu, GCPtr, PAGE_SIZE, fFlags, fMask, fOpFlags);
    13351335
    1336     pgmUnlock(pVM);
     1336    PGM_UNLOCK(pVM);
    13371337    return rc;
    13381338}
     
    21972197{
    21982198    PVMCC       pVM = pVCpu->CTX_SUFF(pVM);
    2199     pgmLock(pVM);
     2199    PGM_LOCK_VOID(pVM);
    22002200
    22012201    Assert(!pVCpu->pgm.s.CTX_SUFF(pGst32BitPd));
     
    22172217            pVCpu->pgm.s.pGst32BitPdR0 = *ppPd;
    22182218#  endif
    2219             pgmUnlock(pVM);
     2219            PGM_UNLOCK(pVM);
    22202220            return VINF_SUCCESS;
    22212221        }
     
    22312231            *ppPd = (PX86PD)HCPtrGuestCR3;
    22322232
    2233             pgmUnlock(pVM);
     2233            PGM_UNLOCK(pVM);
    22342234            return VINF_SUCCESS;
    22352235        }
     
    22372237        AssertRC(rc);
    22382238    }
    2239     pgmUnlock(pVM);
     2239    PGM_UNLOCK(pVM);
    22402240
    22412241    *ppPd = NULL;
     
    22562256    Assert(!pVCpu->pgm.s.CTX_SUFF(pGstPaePdpt));
    22572257    PVMCC       pVM = pVCpu->CTX_SUFF(pVM);
    2258     pgmLock(pVM);
     2258    PGM_LOCK_VOID(pVM);
    22592259
    22602260    RTGCPHYS    GCPhysCR3 = pVCpu->pgm.s.GCPhysCR3 & X86_CR3_PAE_PAGE_MASK;
     
    22742274            pVCpu->pgm.s.pGstPaePdptR0 = *ppPdpt;
    22752275#  endif
    2276             pgmUnlock(pVM);
     2276            PGM_UNLOCK(pVM);
    22772277            return VINF_SUCCESS;
    22782278        }
     
    22882288            *ppPdpt = (PX86PDPT)HCPtrGuestCR3;
    22892289
    2290             pgmUnlock(pVM);
     2290            PGM_UNLOCK(pVM);
    22912291            return VINF_SUCCESS;
    22922292        }
     
    22952295    }
    22962296
    2297     pgmUnlock(pVM);
     2297    PGM_UNLOCK(pVM);
    22982298    *ppPdpt = NULL;
    22992299    return rc;
     
    23142314{
    23152315    PVMCC           pVM         = pVCpu->CTX_SUFF(pVM);
    2316     pgmLock(pVM);
     2316    PGM_LOCK_VOID(pVM);
    23172317
    23182318    PX86PDPT        pGuestPDPT  = pVCpu->pgm.s.CTX_SUFF(pGstPaePdpt);
     
    23402340            if (fChanged)
    23412341                pVCpu->pgm.s.aGCPhysGstPaePDs[iPdpt]   = GCPhys;
    2342             pgmUnlock(pVM);
     2342            PGM_UNLOCK(pVM);
    23432343            return VINF_SUCCESS;
    23442344        }
     
    23572357
    23582358            *ppPd = pVCpu->pgm.s.CTX_SUFF(apGstPaePDs)[iPdpt];
    2359             pgmUnlock(pVM);
     2359            PGM_UNLOCK(pVM);
    23602360            return VINF_SUCCESS;
    23612361        }
     
    23702370# endif
    23712371
    2372     pgmUnlock(pVM);
     2372    PGM_UNLOCK(pVM);
    23732373    return rc;
    23742374}
     
    23872387    Assert(!pVCpu->pgm.s.CTX_SUFF(pGstAmd64Pml4));
    23882388    PVMCC       pVM = pVCpu->CTX_SUFF(pVM);
    2389     pgmLock(pVM);
     2389    PGM_LOCK_VOID(pVM);
    23902390
    23912391    RTGCPHYS    GCPhysCR3 = pVCpu->pgm.s.GCPhysCR3 & X86_CR3_AMD64_PAGE_MASK;
     
    24052405            pVCpu->pgm.s.pGstAmd64Pml4R0 = *ppPml4;
    24062406#  endif
    2407             pgmUnlock(pVM);
     2407            PGM_UNLOCK(pVM);
    24082408            return VINF_SUCCESS;
    24092409        }
     
    24192419            *ppPml4 = (PX86PML4)HCPtrGuestCR3;
    24202420
    2421             pgmUnlock(pVM);
     2421            PGM_UNLOCK(pVM);
    24222422            return VINF_SUCCESS;
    24232423        }
     
    24252425    }
    24262426
    2427     pgmUnlock(pVM);
     2427    PGM_UNLOCK(pVM);
    24282428    *ppPml4 = NULL;
    24292429    return rc;
     
    25822582        if (pPool->cDirtyPages)
    25832583        {
    2584             pgmLock(pVM);
     2584            PGM_LOCK_VOID(pVM);
    25852585            pgmPoolResetDirtyPages(pVM);
    2586             pgmUnlock(pVM);
     2586            PGM_UNLOCK(pVM);
    25872587        }
    25882588#endif
     
    35173517 * @returns VBox status code
    35183518 * @param   pVM         The cross context VM structure.
     3519 * @param   fVoid       Set if the caller cannot handle failure returns.
    35193520 * @param   SRC_POS     The source position of the caller (RT_SRC_POS).
    35203521 */
    3521 #if (defined(VBOX_STRICT) && defined(IN_RING3)) || defined(DOXYGEN_RUNNING)
    3522 int pgmLockDebug(PVMCC pVM, RT_SRC_POS_DECL)
     3522#if defined(VBOX_STRICT) || defined(DOXYGEN_RUNNING)
     3523int pgmLockDebug(PVMCC pVM, bool fVoid, RT_SRC_POS_DECL)
    35233524#else
    3524 int pgmLock(PVMCC pVM)
     3525int pgmLock(PVMCC pVM, bool fVoid)
    35253526#endif
    35263527{
    3527 #if defined(VBOX_STRICT) && defined(IN_RING3)
     3528#if defined(VBOX_STRICT)
    35283529    int rc = PDMCritSectEnterDebug(pVM, &pVM->pgm.s.CritSectX, VERR_SEM_BUSY, (uintptr_t)ASMReturnAddress(), RT_SRC_POS_ARGS);
    35293530#else
    35303531    int rc = PDMCritSectEnter(pVM, &pVM->pgm.s.CritSectX, VERR_SEM_BUSY);
    35313532#endif
     3533    if (RT_SUCCESS(rc))
     3534        return rc;
     3535
    35323536#ifdef IN_RING0
    35333537    if (rc == VERR_SEM_BUSY)
     3538    {
    35343539        rc = VMMRZCallRing3NoCpu(pVM, VMMCALLRING3_PGM_LOCK, 0);
     3540        if (RT_SUCCESS(rc))
     3541            return rc;
     3542    }
    35353543#endif
    3536     AssertMsg(rc == VINF_SUCCESS, ("%Rrc\n", rc));
     3544    if (fVoid)
     3545        PDM_CRITSECT_RELEASE_ASSERT_RC(pVM, &pVM->pgm.s.CritSectX, rc);
     3546    else
     3547        AssertRC(rc);
    35373548    return rc;
    35383549}
     
    37713782    AssertReturn(g_aPgmBothModeData[idxBth].pfnAssertCR3, -VERR_PGM_MODE_IPE);
    37723783
    3773     pgmLock(pVM);
     3784    PGM_LOCK_VOID(pVM);
    37743785    unsigned cErrors = g_aPgmBothModeData[idxBth].pfnAssertCR3(pVCpu, cr3, cr4, 0, ~(RTGCPTR)0);
    3775     pgmUnlock(pVM);
     3786    PGM_UNLOCK(pVM);
    37763787
    37773788    STAM_PROFILE_STOP(&pVCpu->pgm.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,SyncCR3), a);
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r87141 r90439  
    114114    Assert(!pVM->pgm.s.fNestedPaging);
    115115
    116     pgmLock(pVM);
     116    PGM_LOCK_VOID(pVM);
    117117    /* Note: we only really need shadow paging in real and protected mode for VT-x and AMD-V (excluding nested paging/EPT modes),
    118118     *       but any calls to GC need a proper shadow page setup as well.
     
    160160# endif
    161161
    162     pgmUnlock(pVM);
     162    PGM_UNLOCK(pVM);
    163163    return rc;
    164164#else
     
    346346                if (pCur->hType != pPool->hAccessHandlerType)
    347347                {
    348                     pgmUnlock(pVM);
     348                    PGM_UNLOCK(pVM);
    349349                    *pfLockTaken = false;
    350350                }
     
    353353
    354354#  ifdef VBOX_WITH_STATISTICS
    355                 pgmLock(pVM);
     355                PGM_LOCK_VOID(pVM);
    356356                pCur = pgmHandlerPhysicalLookup(pVM, GCPhysFault);
    357357                if (pCur)
    358358                    STAM_PROFILE_STOP(&pCur->Stat, h);
    359                 pgmUnlock(pVM);
     359                PGM_UNLOCK(pVM);
    360360#  endif
    361361            }
     
    466466    /* Take the big lock now before we update flags. */
    467467    *pfLockTaken = true;
    468     pgmLock(pVM);
     468    PGM_LOCK_VOID(pVM);
    469469
    470470    /*
     
    546546    /* Take the big lock now. */
    547547    *pfLockTaken = true;
    548     pgmLock(pVM);
     548    PGM_LOCK_VOID(pVM);
    549549#  endif /* !PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) */
    550550
     
    31853185    {
    31863186        PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    3187         pgmLock(pVM);
     3187        PGM_LOCK_VOID(pVM);
    31883188
    31893189# if PGM_SHW_TYPE == PGM_TYPE_32BIT
     
    32023202        if (rc != VINF_SUCCESS)
    32033203        {
    3204             pgmUnlock(pVM);
     3204            PGM_UNLOCK(pVM);
    32053205            AssertRC(rc);
    32063206            return rc;
     
    32283228        if (rc != VINF_SUCCESS)
    32293229        {
    3230             pgmUnlock(pVM);
     3230            PGM_UNLOCK(pVM);
    32313231            AssertRC(rc);
    32323232            return rc;
     
    32563256            }
    32573257        }
    3258         pgmUnlock(pVM);
     3258        PGM_UNLOCK(pVM);
    32593259    }
    32603260    return rc;
     
    33363336    int             rc = VINF_SUCCESS;
    33373337
    3338     pgmLock(pVM);
     3338    PGM_LOCK_VOID(pVM);
    33393339
    33403340    /*
     
    33563356    if (rc != VINF_SUCCESS)
    33573357    {
    3358         pgmUnlock(pVM);
     3358        PGM_UNLOCK(pVM);
    33593359        AssertRC(rc);
    33603360        return rc;
     
    33803380    if (rc != VINF_SUCCESS)
    33813381    {
    3382         pgmUnlock(pVM);
     3382        PGM_UNLOCK(pVM);
    33833383        AssertRC(rc);
    33843384        return rc;
     
    33943394        {
    33953395            PGM_DYNMAP_UNUSED_HINT(pVCpu, pPdeDst);
    3396             pgmUnlock(pVM);
     3396            PGM_UNLOCK(pVM);
    33973397            AssertRC(rc);
    33983398            return rc;
     
    34343434    }
    34353435    PGM_DYNMAP_UNUSED_HINT(pVCpu, pPdeDst);
    3436     pgmUnlock(pVM);
     3436    PGM_UNLOCK(pVM);
    34373437    return rc;
    34383438
     
    34683468#if !PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) && PGM_SHW_TYPE != PGM_TYPE_NONE
    34693469# ifdef PGMPOOL_WITH_OPTIMIZED_DIRTY_PT
    3470     pgmLock(pVM);
     3470    PGM_LOCK_VOID(pVM);
    34713471    PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool);
    34723472    if (pPool->cDirtyPages)
    34733473        pgmPoolResetDirtyPages(pVM);
    3474     pgmUnlock(pVM);
     3474    PGM_UNLOCK(pVM);
    34753475# endif
    34763476#endif /* !NESTED && !EPT */
     
    43144314     */
    43154315    RTHCPTR     HCPtrGuestCR3;
    4316     pgmLock(pVM);
     4316    PGM_LOCK_VOID(pVM);
    43174317    PPGMPAGE    pPageCR3 = pgmPhysGetPage(pVM, GCPhysCR3);
    43184318    AssertReturn(pPageCR3, VERR_PGM_INVALID_CR3_ADDR);
    43194319    /** @todo this needs some reworking wrt. locking?  */
    43204320    int rc = pgmPhysGCPhys2CCPtrInternalDepr(pVM, pPageCR3, GCPhysCR3 & GST_CR3_PAGE_MASK, (void **)&HCPtrGuestCR3); /** @todo r=bird: This GCPhysCR3 masking isn't necessary. */
    4321     pgmUnlock(pVM);
     4321    PGM_UNLOCK(pVM);
    43224322    if (RT_SUCCESS(rc))
    43234323    {
     
    43654365                RTHCPTR     HCPtr;
    43664366                RTGCPHYS    GCPhys = PGM_A20_APPLY(pVCpu, pGuestPDPT->a[i].u & X86_PDPE_PG_MASK);
    4367                 pgmLock(pVM);
     4367                PGM_LOCK_VOID(pVM);
    43684368                PPGMPAGE    pPage  = pgmPhysGetPage(pVM, GCPhys);
    43694369                AssertReturn(pPage, VERR_PGM_INVALID_PDPE_ADDR);
    43704370                int rc2 = pgmPhysGCPhys2CCPtrInternalDepr(pVM, pPage, GCPhys, (void **)&HCPtr);
    4371                 pgmUnlock(pVM);
     4371                PGM_UNLOCK(pVM);
    43724372                if (RT_SUCCESS(rc2))
    43734373                {
     
    44424442    PPGMPOOLPAGE pNewShwPageCR3;
    44434443
    4444     pgmLock(pVM);
     4444    PGM_LOCK_VOID(pVM);
    44454445
    44464446# ifdef PGMPOOL_WITH_OPTIMIZED_DIRTY_PT
     
    44934493        pgmPoolFreeByPage(pPool, pOldShwPageCR3, NIL_PGMPOOL_IDX, UINT32_MAX);
    44944494    }
    4495     pgmUnlock(pVM);
     4495    PGM_UNLOCK(pVM);
    44964496# else
    44974497    NOREF(GCPhysCR3);
     
    45564556    Assert(!pVM->pgm.s.fNestedPaging);
    45574557# endif
    4558     pgmLock(pVM);
     4558    PGM_LOCK_VOID(pVM);
    45594559
    45604560# ifndef PGM_WITHOUT_MAPPINGS
     
    45814581    }
    45824582
    4583     pgmUnlock(pVM);
     4583    PGM_UNLOCK(pVM);
    45844584#endif
    45854585
  • trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp

    r90346 r90439  
    6767    if (cRefs == 0)
    6868    {
    69         pgmLock(pVM);
     69        PGM_LOCK_VOID(pVM);
    7070        pType->u32Magic = PGMPHYSHANDLERTYPEINT_MAGIC_DEAD;
    7171        RTListOff32NodeRemove(&pType->ListNode);
    72         pgmUnlock(pVM);
     72        PGM_UNLOCK(pVM);
    7373        MMHyperFree(pVM, pType);
    7474    }
     
    279279    pPhysHandler->cPages       = (GCPhysLast - (GCPhys & X86_PTE_PAE_PG_MASK) + PAGE_SIZE) >> PAGE_SHIFT;
    280280
    281     pgmLock(pVM);
     281    PGM_LOCK_VOID(pVM);
    282282    if (RTAvlroGCPhysInsert(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, &pPhysHandler->Core))
    283283    {
     
    289289        NEMHCNotifyHandlerPhysicalRegister(pVM, pType->enmKind, GCPhys, GCPhysLast - GCPhys + 1);
    290290#endif
    291         pgmUnlock(pVM);
     291        PGM_UNLOCK(pVM);
    292292
    293293        if (rc != VINF_SUCCESS)
     
    295295        return rc;
    296296    }
    297     pgmUnlock(pVM);
     297    PGM_UNLOCK(pVM);
    298298
    299299    pPhysHandler->Core.Key     = NIL_RTGCPHYS;
     
    441441     * Remove the handler from the tree.
    442442     */
    443     pgmLock(pVM);
     443    PGM_LOCK_VOID(pVM);
    444444    PPGMPHYSHANDLER pRemoved = (PPGMPHYSHANDLER)RTAvlroGCPhysRemove(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers,
    445445                                                                    pPhysHandler->Core.Key);
     
    458458        pPhysHandler->Core.KeyLast = NIL_RTGCPHYS;
    459459
    460         pgmUnlock(pVM);
     460        PGM_UNLOCK(pVM);
    461461
    462462        return VINF_SUCCESS;
     
    472472        RTAvlroGCPhysInsert(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, &pRemoved->Core);
    473473
    474     pgmUnlock(pVM);
     474    PGM_UNLOCK(pVM);
    475475
    476476    if (!pRemoved)
     
    517517     * Find the handler.
    518518     */
    519     pgmLock(pVM);
     519    PGM_LOCK_VOID(pVM);
    520520    PPGMPHYSHANDLER pRemoved = (PPGMPHYSHANDLER)RTAvlroGCPhysRemove(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys);
    521521    if (pRemoved)
     
    533533        pVM->pgm.s.pLastPhysHandlerR3 = 0;
    534534
    535         pgmUnlock(pVM);
     535        PGM_UNLOCK(pVM);
    536536
    537537        pRemoved->Core.Key = NIL_RTGCPHYS;
     
    540540    }
    541541
    542     pgmUnlock(pVM);
     542    PGM_UNLOCK(pVM);
    543543
    544544    AssertMsgFailed(("Didn't find range starting at %RGp\n", GCPhys));
     
    837837     */
    838838    int rc;
    839     pgmLock(pVM);
     839    PGM_LOCK_VOID(pVM);
    840840    PPGMPHYSHANDLER pCur = (PPGMPHYSHANDLER)RTAvlroGCPhysRemove(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhysCurrent);
    841841    if (pCur)
     
    880880                    NEMHCNotifyHandlerPhysicalModify(pVM, enmKind, GCPhysCurrent, GCPhys, cb, fRestoreAsRAM);
    881881
    882                     pgmUnlock(pVM);
     882                    PGM_UNLOCK(pVM);
    883883
    884884                    PGM_INVL_ALL_VCPU_TLBS(pVM);
     
    919919    }
    920920
    921     pgmUnlock(pVM);
     921    PGM_UNLOCK(pVM);
    922922    return rc;
    923923}
     
    939939     */
    940940    int rc = VINF_SUCCESS;
    941     pgmLock(pVM);
     941    PGM_LOCK_VOID(pVM);
    942942    PPGMPHYSHANDLER pCur = (PPGMPHYSHANDLER)RTAvlroGCPhysGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys);
    943943    if (pCur)
     
    955955    }
    956956
    957     pgmUnlock(pVM);
     957    PGM_UNLOCK(pVM);
    958958    return rc;
    959959}
     
    983983     * Get the handler.
    984984     */
    985     pgmLock(pVM);
     985    PGM_LOCK_VOID(pVM);
    986986    PPGMPHYSHANDLER pCur = (PPGMPHYSHANDLER)RTAvlroGCPhysGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys);
    987987    if (RT_LIKELY(pCur))
     
    10031003                LogFlow(("PGMHandlerPhysicalSplit: %RGp-%RGp and %RGp-%RGp\n",
    10041004                         pCur->Core.Key, pCur->Core.KeyLast, pNew->Core.Key, pNew->Core.KeyLast));
    1005                 pgmUnlock(pVM);
     1005                PGM_UNLOCK(pVM);
    10061006                return VINF_SUCCESS;
    10071007            }
     
    10201020        rc = VERR_PGM_HANDLER_NOT_FOUND;
    10211021    }
    1022     pgmUnlock(pVM);
     1022    PGM_UNLOCK(pVM);
    10231023    MMHyperFree(pVM, pNew);
    10241024    return rc;
     
    10401040     */
    10411041    int rc;
    1042     pgmLock(pVM);
     1042    PGM_LOCK_VOID(pVM);
    10431043    PPGMPHYSHANDLER pCur1 = (PPGMPHYSHANDLER)RTAvlroGCPhysGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys1);
    10441044    if (RT_LIKELY(pCur1))
     
    10651065                        PGMHandlerPhysicalTypeRelease(pVM, pCur2->hType);
    10661066                        MMHyperFree(pVM, pCur2);
    1067                         pgmUnlock(pVM);
     1067                        PGM_UNLOCK(pVM);
    10681068                        return VINF_SUCCESS;
    10691069                    }
     
    10961096        rc = VERR_PGM_HANDLER_NOT_FOUND;
    10971097    }
    1098     pgmUnlock(pVM);
     1098    PGM_UNLOCK(pVM);
    10991099    return rc;
    11001100
     
    11191119{
    11201120    LogFlow(("PGMHandlerPhysicalReset GCPhys=%RGp\n", GCPhys));
    1121     pgmLock(pVM);
     1121    PGM_LOCK_VOID(pVM);
    11221122
    11231123    /*
     
    12051205    }
    12061206
    1207     pgmUnlock(pVM);
     1207    PGM_UNLOCK(pVM);
    12081208    return rc;
    12091209}
     
    12321232{
    12331233    LogFlow(("PGMHandlerPhysicalPageTempOff GCPhysPage=%RGp\n", GCPhysPage));
    1234 
    1235     pgmLock(pVM);
     1234    PGM_LOCK_VOID(pVM);
     1235
    12361236    /*
    12371237     * Validate the range.
     
    12491249            AssertReturnStmt(   pCurType->enmKind == PGMPHYSHANDLERKIND_WRITE
    12501250                             || pCurType->enmKind == PGMPHYSHANDLERKIND_ALL,
    1251                              pgmUnlock(pVM), VERR_ACCESS_DENIED);
     1251                             PGM_UNLOCK(pVM), VERR_ACCESS_DENIED);
    12521252
    12531253            /*
     
    12561256            PPGMPAGE pPage;
    12571257            int rc = pgmPhysGetPageEx(pVM, GCPhysPage, &pPage);
    1258             AssertReturnStmt(RT_SUCCESS_NP(rc), pgmUnlock(pVM), rc);
     1258            AssertReturnStmt(RT_SUCCESS_NP(rc), PGM_UNLOCK(pVM), rc);
    12591259            if (PGM_PAGE_GET_HNDL_PHYS_STATE(pPage) != PGM_PAGE_HNDL_PHYS_STATE_DISABLED)
    12601260            {
     
    12721272                }
    12731273            }
    1274             pgmUnlock(pVM);
     1274            PGM_UNLOCK(pVM);
    12751275            return VINF_SUCCESS;
    12761276        }
    1277         pgmUnlock(pVM);
     1277        PGM_UNLOCK(pVM);
    12781278        AssertMsgFailed(("The page %#x is outside the range %#x-%#x\n",
    12791279                         GCPhysPage, pCur->Core.Key, pCur->Core.KeyLast));
    12801280        return VERR_INVALID_PARAMETER;
    12811281    }
    1282     pgmUnlock(pVM);
     1282    PGM_UNLOCK(pVM);
    12831283    AssertMsgFailed(("Specified physical handler start address %#x is invalid.\n", GCPhys));
    12841284    return VERR_PGM_HANDLER_NOT_FOUND;
     
    13811381                                               PPDMDEVINS pDevIns, PGMMMIO2HANDLE hMmio2, RTGCPHYS offMmio2PageRemap)
    13821382{
    1383     pgmLock(pVM);
     1383    PGM_LOCK_VOID(pVM);
    13841384
    13851385    /*
     
    13901390        AssertMsgReturnStmt(PGM_PAGE_GET_TYPE(pPageRemap) == PGMPAGETYPE_MMIO2,
    13911391                            ("hMmio2=%RU64 offMmio2PageRemap=%RGp %R[pgmpage]\n", hMmio2, offMmio2PageRemap, pPageRemap),
    1392                             pgmUnlock(pVM), VERR_PGM_PHYS_NOT_MMIO2);
     1392                            PGM_UNLOCK(pVM), VERR_PGM_PHYS_NOT_MMIO2);
    13931393    else
    13941394    {
    1395         pgmUnlock(pVM);
     1395        PGM_UNLOCK(pVM);
    13961396        return VERR_OUT_OF_RANGE;
    13971397    }
     
    14071407        {
    14081408            PPGMPHYSHANDLERTYPEINT pCurType = PGMPHYSHANDLER_GET_TYPE(pVM, pCur);
    1409             AssertReturnStmt(pCurType->enmKind == PGMPHYSHANDLERKIND_MMIO, pgmUnlock(pVM), VERR_ACCESS_DENIED);
    1410             AssertReturnStmt(!(pCur->Core.Key & PAGE_OFFSET_MASK), pgmUnlock(pVM), VERR_INVALID_PARAMETER);
    1411             AssertReturnStmt((pCur->Core.KeyLast & PAGE_OFFSET_MASK) == PAGE_OFFSET_MASK, pgmUnlock(pVM), VERR_INVALID_PARAMETER);
     1409            AssertReturnStmt(pCurType->enmKind == PGMPHYSHANDLERKIND_MMIO, PGM_UNLOCK(pVM), VERR_ACCESS_DENIED);
     1410            AssertReturnStmt(!(pCur->Core.Key & PAGE_OFFSET_MASK), PGM_UNLOCK(pVM), VERR_INVALID_PARAMETER);
     1411            AssertReturnStmt((pCur->Core.KeyLast & PAGE_OFFSET_MASK) == PAGE_OFFSET_MASK, PGM_UNLOCK(pVM), VERR_INVALID_PARAMETER);
    14121412
    14131413            /*
     
    14161416            PPGMPAGE pPage;
    14171417            int rc = pgmPhysGetPageEx(pVM, GCPhysPage, &pPage);
    1418             AssertReturnStmt(RT_SUCCESS_NP(rc), pgmUnlock(pVM), rc);
     1418            AssertReturnStmt(RT_SUCCESS_NP(rc), PGM_UNLOCK(pVM), rc);
    14191419            if (PGM_PAGE_GET_TYPE(pPage) != PGMPAGETYPE_MMIO)
    14201420            {
     
    14241424                if (PGM_PAGE_GET_HCPHYS(pPage) == PGM_PAGE_GET_HCPHYS(pPageRemap))
    14251425                {
    1426                     pgmUnlock(pVM);
     1426                    PGM_UNLOCK(pVM);
    14271427                    return VINF_PGM_HANDLER_ALREADY_ALIASED;
    14281428                }
     
    14661466            }
    14671467            LogFlow(("PGMHandlerPhysicalPageAliasMmio2: => %R[pgmpage]\n", pPage));
    1468             pgmUnlock(pVM);
     1468            PGM_UNLOCK(pVM);
    14691469            return VINF_SUCCESS;
    14701470        }
    14711471
    1472         pgmUnlock(pVM);
     1472        PGM_UNLOCK(pVM);
    14731473        AssertMsgFailed(("The page %#x is outside the range %#x-%#x\n",
    14741474                         GCPhysPage, pCur->Core.Key, pCur->Core.KeyLast));
     
    14761476    }
    14771477
    1478     pgmUnlock(pVM);
     1478    PGM_UNLOCK(pVM);
    14791479    AssertMsgFailed(("Specified physical handler start address %#x is invalid.\n", GCPhys));
    14801480    return VERR_PGM_HANDLER_NOT_FOUND;
     
    15161516{
    15171517///    Assert(!IOMIsLockOwner(pVM)); /* We mustn't own any other locks when calling this */
    1518     pgmLock(pVM);
     1518    PGM_LOCK_VOID(pVM);
    15191519
    15201520    /*
     
    15281528        {
    15291529            PPGMPHYSHANDLERTYPEINT pCurType = PGMPHYSHANDLER_GET_TYPE(pVM, pCur);
    1530             AssertReturnStmt(pCurType->enmKind == PGMPHYSHANDLERKIND_MMIO, pgmUnlock(pVM), VERR_ACCESS_DENIED);
    1531             AssertReturnStmt(!(pCur->Core.Key & PAGE_OFFSET_MASK), pgmUnlock(pVM), VERR_INVALID_PARAMETER);
    1532             AssertReturnStmt((pCur->Core.KeyLast & PAGE_OFFSET_MASK) == PAGE_OFFSET_MASK, pgmUnlock(pVM), VERR_INVALID_PARAMETER);
     1530            AssertReturnStmt(pCurType->enmKind == PGMPHYSHANDLERKIND_MMIO, PGM_UNLOCK(pVM), VERR_ACCESS_DENIED);
     1531            AssertReturnStmt(!(pCur->Core.Key & PAGE_OFFSET_MASK), PGM_UNLOCK(pVM), VERR_INVALID_PARAMETER);
     1532            AssertReturnStmt((pCur->Core.KeyLast & PAGE_OFFSET_MASK) == PAGE_OFFSET_MASK, PGM_UNLOCK(pVM), VERR_INVALID_PARAMETER);
    15331533
    15341534            /*
     
    15371537            PPGMPAGE pPage;
    15381538            int rc = pgmPhysGetPageEx(pVM, GCPhysPage, &pPage);
    1539             AssertReturnStmt(RT_SUCCESS_NP(rc), pgmUnlock(pVM), rc);
     1539            AssertReturnStmt(RT_SUCCESS_NP(rc), PGM_UNLOCK(pVM), rc);
    15401540            if (PGM_PAGE_GET_TYPE(pPage) != PGMPAGETYPE_MMIO)
    15411541            {
    1542                 pgmUnlock(pVM);
     1542                PGM_UNLOCK(pVM);
    15431543                AssertMsgReturn(PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_SPECIAL_ALIAS_MMIO,
    15441544                                ("GCPhysPage=%RGp %R[pgmpage]\n", GCPhysPage, pPage),
     
    15761576            }
    15771577            LogFlow(("PGMHandlerPhysicalPageAliasHC: => %R[pgmpage]\n", pPage));
    1578             pgmUnlock(pVM);
     1578            PGM_UNLOCK(pVM);
    15791579            return VINF_SUCCESS;
    15801580        }
    1581         pgmUnlock(pVM);
     1581        PGM_UNLOCK(pVM);
    15821582        AssertMsgFailed(("The page %#x is outside the range %#x-%#x\n",
    15831583                         GCPhysPage, pCur->Core.Key, pCur->Core.KeyLast));
    15841584        return VERR_INVALID_PARAMETER;
    15851585    }
    1586     pgmUnlock(pVM);
     1586    PGM_UNLOCK(pVM);
    15871587
    15881588    AssertMsgFailed(("Specified physical handler start address %#x is invalid.\n", GCPhys));
     
    16051605     * Find the handler.
    16061606     */
    1607     pgmLock(pVM);
     1607    PGM_LOCK_VOID(pVM);
    16081608    PPGMPHYSHANDLER pCur = pgmHandlerPhysicalLookup(pVM, GCPhys);
    16091609    if (pCur)
     
    16161616               || pCurType->enmKind == PGMPHYSHANDLERKIND_MMIO);
    16171617#endif
    1618         pgmUnlock(pVM);
     1618        PGM_UNLOCK(pVM);
    16191619        return true;
    16201620    }
    1621     pgmUnlock(pVM);
     1621    PGM_UNLOCK(pVM);
    16221622    return false;
    16231623}
     
    16371637bool pgmHandlerPhysicalIsAll(PVMCC pVM, RTGCPHYS GCPhys)
    16381638{
    1639     pgmLock(pVM);
     1639    PGM_LOCK_VOID(pVM);
    16401640    PPGMPHYSHANDLER pCur = pgmHandlerPhysicalLookup(pVM, GCPhys);
    16411641    if (!pCur)
    16421642    {
    1643         pgmUnlock(pVM);
     1643        PGM_UNLOCK(pVM);
    16441644        AssertFailed();
    16451645        return true;
     
    16541654
    16551655    bool bRet = pCurType->enmKind != PGMPHYSHANDLERKIND_WRITE;
    1656     pgmUnlock(pVM);
     1656    PGM_UNLOCK(pVM);
    16571657    return bRet;
    16581658}
  • trunk/src/VBox/VMM/VMMAll/PGMAllMap.cpp

    r82968 r90439  
    645645     * Iterate mappings.
    646646     */
    647     pgmLock(pVM);                           /* to avoid assertions */
     647    PGM_LOCK_VOID(pVM);                     /* to avoid assertions */
    648648    for (PPGMMAPPING pCur = pVM->pgm.s.CTX_SUFF(pMappings); pCur; pCur = pCur->CTX_SUFF(pNext))
    649649    {
     
    651651        pgmMapCheckShadowPDEs(pVM, pVCpu, pVCpu->pgm.s.CTX_SUFF(pShwPageCR3), pCur, iPDE);
    652652    }
    653     pgmUnlock(pVM);
     653    PGM_UNLOCK(pVM);
    654654}
    655655
  • trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp

    r90346 r90439  
    276276                 * kind of screw things up...
    277277                 */
    278                 int rc = pgmLock(pVM);
    279                 AssertRC(rc);
     278                PGM_LOCK_VOID(pVM);
    280279
    281280                PPGMPAGE pShadowPage = &pRomPage->Shadow;
     
    287286
    288287                void *pvDstPage;
    289                 rc = pgmPhysPageMakeWritableAndMap(pVM, pShadowPage, GCPhys & X86_PTE_PG_MASK, &pvDstPage);
     288                int rc = pgmPhysPageMakeWritableAndMap(pVM, pShadowPage, GCPhys & X86_PTE_PG_MASK, &pvDstPage);
    290289                if (RT_SUCCESS(rc))
    291290                {
     
    300299                }
    301300
    302                 pgmUnlock(pVM);
     301                PGM_UNLOCK(pVM);
    303302                return rc;
    304303            }
     
    320319void pgmPhysInvalidRamRangeTlbs(PVMCC pVM)
    321320{
    322     pgmLock(pVM);
     321    PGM_LOCK_VOID(pVM);
    323322    RT_ZERO(pVM->pgm.s.apRamRangesTlbR3);
    324323    RT_ZERO(pVM->pgm.s.apRamRangesTlbR0);
    325     pgmUnlock(pVM);
     324    PGM_UNLOCK(pVM);
    326325}
    327326
     
    549548VMM_INT_DECL(int) PGMPhysGCPhys2HCPhys(PVMCC pVM, RTGCPHYS GCPhys, PRTHCPHYS pHCPhys)
    550549{
    551     pgmLock(pVM);
     550    PGM_LOCK_VOID(pVM);
    552551    PPGMPAGE pPage;
    553552    int rc = pgmPhysGetPageEx(pVM, GCPhys, &pPage);
    554553    if (RT_SUCCESS(rc))
    555554        *pHCPhys = PGM_PAGE_GET_HCPHYS(pPage) | (GCPhys & PAGE_OFFSET_MASK);
    556     pgmUnlock(pVM);
     555    PGM_UNLOCK(pVM);
    557556    return rc;
    558557}
     
    566565void pgmPhysInvalidatePageMapTLB(PVMCC pVM)
    567566{
    568     pgmLock(pVM);
     567    PGM_LOCK_VOID(pVM);
    569568    STAM_COUNTER_INC(&pVM->pgm.s.CTX_SUFF(pStats)->StatPageMapTlbFlushes);
    570569
     
    588587    }
    589588
    590     pgmUnlock(pVM);
     589    PGM_UNLOCK(pVM);
    591590}
    592591
     
    17781777VMM_INT_DECL(int) PGMPhysGCPhys2CCPtr(PVMCC pVM, RTGCPHYS GCPhys, void **ppv, PPGMPAGEMAPLOCK pLock)
    17791778{
    1780     int rc = pgmLock(pVM);
     1779    int rc = PGM_LOCK(pVM);
    17811780    AssertRCReturn(rc, rc);
    17821781
     
    18121811    }
    18131812
    1814     pgmUnlock(pVM);
     1813    PGM_UNLOCK(pVM);
    18151814    return rc;
    18161815}
     
    18471846VMM_INT_DECL(int) PGMPhysGCPhys2CCPtrReadOnly(PVMCC pVM, RTGCPHYS GCPhys, void const **ppv, PPGMPAGEMAPLOCK pLock)
    18481847{
    1849     int rc = pgmLock(pVM);
     1848    int rc = PGM_LOCK(pVM);
    18501849    AssertRCReturn(rc, rc);
    18511850
     
    18711870    }
    18721871
    1873     pgmUnlock(pVM);
     1872    PGM_UNLOCK(pVM);
    18741873    return rc;
    18751874}
     
    19701969    pLock->pvMap = NULL;
    19711970
    1972     pgmLock(pVM);
     1971    PGM_LOCK_VOID(pVM);
    19731972    if (fWriteLock)
    19741973    {
     
    20122011    }
    20132012# endif
    2014     pgmUnlock(pVM);
     2013    PGM_UNLOCK(pVM);
    20152014}
    20162015
     
    20402039#endif
    20412040
    2042     pgmLock(pVM);
     2041    PGM_LOCK_VOID(pVM);
    20432042    if (fWriteLock)
    20442043    {
     
    20762075            if ((i & 1023) == 1023 && i + 1 < cPages)
    20772076            {
    2078                 pgmUnlock(pVM);
    2079                 pgmLock(pVM);
     2077                PGM_UNLOCK(pVM);
     2078                PGM_LOCK_VOID(pVM);
    20802079            }
    20812080        }
     
    21112110            if ((i & 1023) == 1023 && i + 1 < cPages)
    21122111            {
    2113                 pgmUnlock(pVM);
    2114                 pgmLock(pVM);
     2112                PGM_UNLOCK(pVM);
     2113                PGM_LOCK_VOID(pVM);
    21152114            }
    21162115        }
    21172116    }
    2118     pgmUnlock(pVM);
     2117    PGM_UNLOCK(pVM);
    21192118
    21202119    RT_BZERO(paLocks, sizeof(paLocks[0]) * cPages);
     
    21662165
    21672166    Log(("pgmPhysGCPhys2R3Ptr(,%RGp,): dont use this API!\n", GCPhys)); /** @todo eliminate this API! */
    2168     pgmLock(pVM);
     2167    PGM_LOCK_VOID(pVM);
    21692168
    21702169    PPGMRAMRANGE pRam;
     
    21742173        rc = pgmPhysGCPhys2CCPtrInternalDepr(pVM, pPage, GCPhys, (void **)pR3Ptr);
    21752174
    2176     pgmUnlock(pVM);
     2175    PGM_UNLOCK(pVM);
    21772176    Assert(rc <= VINF_SUCCESS);
    21782177    return rc;
     
    23232322
    23242323        /* Release the PGM lock as MMIO handlers take the IOM lock. (deadlock prevention) */
    2325         pgmUnlock(pVM);
     2324        PGM_UNLOCK(pVM);
    23262325        rcStrict = pfnHandler(pVM, pVCpu, GCPhys, (void *)pvSrc, pvBuf, cb, PGMACCESSTYPE_READ, enmOrigin, pvUser);
    2327         pgmLock(pVM);
     2326        PGM_LOCK_VOID(pVM);
    23282327
    23292328#ifdef VBOX_WITH_STATISTICS
     
    23992398    STAM_COUNTER_ADD(&pVM->pgm.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,PhysReadBytes), cbRead);
    24002399
    2401     pgmLock(pVM);
     2400    PGM_LOCK_VOID(pVM);
    24022401
    24032402    /*
     
    24582457                    {
    24592458                        memset(pvBuf, 0xff, cb);
    2460                         pgmUnlock(pVM);
     2459                        PGM_UNLOCK(pVM);
    24612460                        return rcStrict2;
    24622461                    }
     
    24662465                if (cb >= cbRead)
    24672466                {
    2468                     pgmUnlock(pVM);
     2467                    PGM_UNLOCK(pVM);
    24692468                    return rcStrict;
    24702469                }
     
    25012500    } /* Ram range walk */
    25022501
    2503     pgmUnlock(pVM);
     2502    PGM_UNLOCK(pVM);
    25042503    return rcStrict;
    25052504}
     
    25632562            /* Release the PGM lock as MMIO handlers take the IOM lock. (deadlock prevention) */
    25642563            PGM_LOCK_ASSERT_OWNER(pVM);
    2565             pgmUnlock(pVM);
     2564            PGM_UNLOCK(pVM);
    25662565            rcStrict = pfnHandler(pVM, pVCpu, GCPhys, pvDst, (void *)pvBuf, cbRange, PGMACCESSTYPE_WRITE, enmOrigin, pvUser);
    2567             pgmLock(pVM);
     2566            PGM_LOCK_VOID(pVM);
    25682567
    25692568#ifdef VBOX_WITH_STATISTICS
     
    26822681            /* Release the PGM lock as MMIO handlers take the IOM lock. (deadlock prevention) */
    26832682            PGM_LOCK_ASSERT_OWNER(pVM);
    2684             pgmUnlock(pVM);
     2683            PGM_UNLOCK(pVM);
    26852684            rcStrict2 = pfnHandler(pVM, pVCpu, GCPhys, pvDst, (void *)pvBuf, cbRange, PGMACCESSTYPE_WRITE, enmOrigin, pvUser);
    2686             pgmLock(pVM);
     2685            PGM_LOCK_VOID(pVM);
    26872686
    26882687#ifdef VBOX_WITH_STATISTICS
     
    27852784    STAM_COUNTER_ADD(&pVM->pgm.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,PhysWriteBytes), cbWrite);
    27862785
    2787     pgmLock(pVM);
     2786    PGM_LOCK_VOID(pVM);
    27882787
    27892788    /*
     
    28392838                    else
    28402839                    {
    2841                         pgmUnlock(pVM);
     2840                        PGM_UNLOCK(pVM);
    28422841                        return rcStrict2;
    28432842                    }
     
    28472846                if (cb >= cbWrite)
    28482847                {
    2849                     pgmUnlock(pVM);
     2848                    PGM_UNLOCK(pVM);
    28502849                    return rcStrict;
    28512850                }
     
    28782877    } /* Ram range walk */
    28792878
    2880     pgmUnlock(pVM);
     2879    PGM_UNLOCK(pVM);
    28812880    return rcStrict;
    28822881}
     
    30563055     * when many VCPUs are fighting for the lock.
    30573056     */
    3058     pgmLock(pVM);
     3057    PGM_LOCK_VOID(pVM);
    30593058
    30603059    /* map the 1st page */
     
    30643063    if (RT_FAILURE(rc))
    30653064    {
    3066         pgmUnlock(pVM);
     3065        PGM_UNLOCK(pVM);
    30673066        return rc;
    30683067    }
     
    30743073        memcpy(pvDst, pvSrc, cb);
    30753074        PGMPhysReleasePageMappingLock(pVM, &Lock);
    3076         pgmUnlock(pVM);
     3075        PGM_UNLOCK(pVM);
    30773076        return VINF_SUCCESS;
    30783077    }
     
    30943093        if (RT_FAILURE(rc))
    30953094        {
    3096             pgmUnlock(pVM);
     3095            PGM_UNLOCK(pVM);
    30973096            return rc;
    30983097        }
     
    31033102            memcpy(pvDst, pvSrc, cb);
    31043103            PGMPhysReleasePageMappingLock(pVM, &Lock);
    3105             pgmUnlock(pVM);
     3104            PGM_UNLOCK(pVM);
    31063105            return VINF_SUCCESS;
    31073106        }
     
    40694068VMM_INT_DECL(PGMPAGETYPE) PGMPhysGetPageType(PVMCC pVM, RTGCPHYS GCPhys)
    40704069{
    4071     pgmLock(pVM);
     4070    PGM_LOCK_VOID(pVM);
    40724071    PPGMPAGE pPage = pgmPhysGetPage(pVM, GCPhys);
    40734072    PGMPAGETYPE enmPgType = pPage ? (PGMPAGETYPE)PGM_PAGE_GET_TYPE(pPage) : PGMPAGETYPE_INVALID;
    4074     pgmUnlock(pVM);
     4073    PGM_UNLOCK(pVM);
    40754074
    40764075    return enmPgType;
     
    41074106    Assert(!(GCPhys & X86_PAGE_OFFSET_MASK));
    41084107
    4109     pgmLock(pVM);
     4108    PGM_LOCK_VOID(pVM);
    41104109
    41114110    PPGMRAMRANGE pRam;
     
    42044203    }
    42054204
    4206     pgmUnlock(pVM);
     4205    PGM_UNLOCK(pVM);
    42074206    return VINF_SUCCESS;
    42084207}
     
    42404239    PGM_A20_APPLY_TO_VAR(pVCpu, GCPhys);
    42414240
    4242     pgmLock(pVM);
     4241    PGM_LOCK_VOID(pVM);
    42434242
    42444243    PPGMRAMRANGE pRam;
     
    43104309        rc = VERR_PGM_PHYS_TLB_UNASSIGNED;
    43114310
    4312     pgmUnlock(pVM);
     4311    PGM_UNLOCK(pVM);
    43134312    return rc;
    43144313}
     
    43404339VMM_INT_DECL(int) PGMPhysIemQueryAccess(PVMCC pVM, RTGCPHYS GCPhys, bool fWritable, bool fByPassHandlers)
    43414340{
    4342     pgmLock(pVM);
     4341    PGM_LOCK_VOID(pVM);
    43434342    PGM_A20_ASSERT_MASKED(VMMGetCpu(pVM), GCPhys);
    43444343
     
    43704369    }
    43714370
    4372     pgmUnlock(pVM);
     4371    PGM_UNLOCK(pVM);
    43734372    return rc;
    43744373}
     
    43944393                                            PFNPGMPHYSNEMCHECKPAGE pfnChecker, void *pvUser)
    43954394{
    4396     pgmLock(pVM);
     4395    PGM_LOCK_VOID(pVM);
    43974396
    43984397    PPGMPAGE pPage;
     
    44564455
    44574456        /* Done. */
    4458         pgmUnlock(pVM);
     4457        PGM_UNLOCK(pVM);
    44594458    }
    44604459    else
    44614460    {
    4462         pgmUnlock(pVM);
     4461        PGM_UNLOCK(pVM);
    44634462
    44644463        pInfo->HCPhys       = NIL_RTHCPHYS;
     
    44924491     * Just brute force this problem.
    44934492     */
    4494     pgmLock(pVM);
     4493    PGM_LOCK_VOID(pVM);
    44954494    int rc = VINF_SUCCESS;
    44964495    for (PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(pRamRangesX); pRam; pRam = pRam->CTX_SUFF(pNext))
     
    45124511        }
    45134512    }
    4514     pgmUnlock(pVM);
     4513    PGM_UNLOCK(pVM);
    45154514
    45164515    return rc;
  • trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp

    r90346 r90439  
    957957    LogFlow(("pgmRZPoolAccessPfHandler: pvFault=%RGv pPage=%p:{.idx=%d} GCPhysFault=%RGp\n", pvFault, pPage, pPage->idx, GCPhysFault));
    958958
    959     pgmLock(pVM);
     959    PGM_LOCK_VOID(pVM);
    960960    if (PHYS_PAGE_ADDRESS(GCPhysFault) != PHYS_PAGE_ADDRESS(pPage->GCPhys))
    961961    {
     
    963963        Log(("CPU%d: pgmRZPoolAccessPfHandler pgm pool page for %RGp changed (to %RGp) while waiting!\n", pVCpu->idCpu, PHYS_PAGE_ADDRESS(GCPhysFault), PHYS_PAGE_ADDRESS(pPage->GCPhys)));
    964964        STAM_PROFILE_STOP_EX(&pVM->pgm.s.CTX_SUFF(pPool)->StatMonitorPfRZ, &pPool->StatMonitorPfRZHandled, a);
    965         pgmUnlock(pVM);
     965        PGM_UNLOCK(pVM);
    966966        return VINF_SUCCESS;
    967967    }
     
    970970    {
    971971        Assert(VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_TLB_FLUSH));
    972         pgmUnlock(pVM);
     972        PGM_UNLOCK(pVM);
    973973        return VINF_SUCCESS;    /* SMP guest case where we were blocking on the pgm lock while the same page was being marked dirty. */
    974974    }
     
    995995    {
    996996        AssertMsg(rc == VERR_PAGE_NOT_PRESENT || rc == VERR_PAGE_TABLE_NOT_PRESENT, ("Unexpected rc %d\n", rc));
    997         pgmUnlock(pVM);
     997        PGM_UNLOCK(pVM);
    998998        return rc;
    999999    }
     
    10901090
    10911091            STAM_PROFILE_STOP_EX(&pVM->pgm.s.CTX_SUFF(pPool)->StatMonitorPfRZ, &pPool->StatMonitorPfRZHandled, a);
    1092             pgmUnlock(pVM);
     1092            PGM_UNLOCK(pVM);
    10931093            return rc;
    10941094        }
     
    11321132                rc = pgmRZPoolAccessPfHandlerSTOSD(pVM, pPool, pPage, pDis, pRegFrame, GCPhysFault, pvFault);
    11331133                STAM_PROFILE_STOP_EX(&pVM->pgm.s.CTX_SUFF(pPool)->StatMonitorPfRZ, &pPool->StatMonitorPfRZRepStosd, a);
    1134                 pgmUnlock(pVM);
     1134                PGM_UNLOCK(pVM);
    11351135                return rc;
    11361136            }
     
    12101210
    12111211                STAM_PROFILE_STOP(&pVM->pgm.s.CTX_SUFF(pPool)->StatMonitorPfRZ, a);
    1212                 pgmUnlock(pVM);
     1212                PGM_UNLOCK(pVM);
    12131213                return rc;
    12141214            }
     
    12361236    }
    12371237    STAM_PROFILE_STOP_EX(&pVM->pgm.s.CTX_SUFF(pPool)->StatMonitorPfRZ, &pPool->StatMonitorPfRZFlushPage, a);
    1238     pgmUnlock(pVM);
     1238    PGM_UNLOCK(pVM);
    12391239    return rc;
    12401240}
     
    12601260    NOREF(pvPhys); NOREF(pvBuf); NOREF(enmAccessType);
    12611261
    1262     pgmLock(pVM);
     1262    PGM_LOCK_VOID(pVM);
    12631263
    12641264#ifdef VBOX_WITH_STATISTICS
     
    13421342    else
    13431343        Log(("CPU%d: PGM_ALL_CB_DECL pgm pool page for %RGp changed (to %RGp) while waiting!\n", pVCpu->idCpu, PHYS_PAGE_ADDRESS(GCPhys), PHYS_PAGE_ADDRESS(pPage->GCPhys)));
    1344     pgmUnlock(pVM);
     1344    PGM_UNLOCK(pVM);
    13451345    return VINF_PGM_HANDLER_DO_DEFAULT;
    13461346}
     
    26702670static void pgmPoolMonitorModifiedClearAll(PVMCC pVM)
    26712671{
    2672     pgmLock(pVM);
     2672    PGM_LOCK_VOID(pVM);
    26732673    PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool);
    26742674    LogFlow(("pgmPoolMonitorModifiedClearAll: cModifiedPages=%d\n", pPool->cModifiedPages));
     
    26932693    AssertMsg(cPages == pPool->cModifiedPages, ("%d != %d\n", cPages, pPool->cModifiedPages));
    26942694    pPool->cModifiedPages = 0;
    2695     pgmUnlock(pVM);
     2695    PGM_UNLOCK(pVM);
    26962696}
    26972697
     
    34613461{
    34623462    PVMCPUCC pVCpu = VMMGetCpu(pVM);
    3463     pgmLock(pVM);
     3463    PGM_LOCK_VOID(pVM);
    34643464    int rc = VINF_SUCCESS;
    34653465
     
    34933493
    34943494            *pfFlushTLBs = true;
    3495             pgmUnlock(pVM);
     3495            PGM_UNLOCK(pVM);
    34963496            return rc;
    34973497        }
     
    35373537        rc = VINF_PGM_SYNC_CR3;
    35383538    }
    3539     pgmUnlock(pVM);
     3539    PGM_UNLOCK(pVM);
    35403540    return rc;
    35413541}
     
    40414041uint16_t pgmPoolTrackPhysExtAddref(PVMCC pVM, PPGMPAGE pPhysPage, uint16_t u16, uint16_t iShwPT, uint16_t iPte)
    40424042{
    4043     pgmLock(pVM);
     4043    PGM_LOCK_VOID(pVM);
    40444044    if (PGMPOOL_TD_GET_CREFS(u16) != PGMPOOL_TD_CREFS_PHYSEXT)
    40454045    {
     
    40724072    else
    40734073        STAM_COUNTER_INC(&pVM->pgm.s.CTX_SUFF(pStats)->StatTrackAliasedLots);
    4074     pgmUnlock(pVM);
     4074    PGM_UNLOCK(pVM);
    40754075    return u16;
    40764076}
     
    40944094    if (iPhysExt != PGMPOOL_TD_IDX_OVERFLOWED)
    40954095    {
    4096         pgmLock(pVM);
     4096        PGM_LOCK_VOID(pVM);
    40974097
    40984098        uint16_t        iPhysExtPrev = NIL_PGMPOOL_PHYSEXT_INDEX;
     
    41174117                        {
    41184118                            Log2(("pgmPoolTrackPhysExtDerefGCPhys: pPhysPage=%R[pgmpage] idx=%d\n", pPhysPage, pPage->idx));
    4119                             pgmUnlock(pVM);
     4119                            PGM_UNLOCK(pVM);
    41204120                            return;
    41214121                        }
     
    41464146                    }
    41474147                    iPhysExt = iPhysExtNext;
    4148                     pgmUnlock(pVM);
     4148                    PGM_UNLOCK(pVM);
    41494149                    return;
    41504150                }
     
    41564156        } while (iPhysExt != NIL_PGMPOOL_PHYSEXT_INDEX);
    41574157
    4158         pgmUnlock(pVM);
     4158        PGM_UNLOCK(pVM);
    41594159        AssertFatalMsgFailed(("not-found! cRefs=%d pPhysPage=%R[pgmpage] pPage=%p:{.idx=%d}\n", cRefs, pPhysPage, pPage, pPage->idx));
    41604160    }
     
    48084808                    VINF_SUCCESS);
    48094809
    4810     pgmLock(pVM);
     4810    PGM_LOCK_VOID(pVM);
    48114811
    48124812    /*
     
    48274827                  ("Can't free the shadow CR3! (%RHp vs %RHp kind=%d\n", PGMGetHyperCR3(VMMGetCpu(pVM)), pPage->Core.Key, pPage->enmKind));
    48284828        Log(("pgmPoolFlushPage: current active shadow CR3, rejected. enmKind=%s idx=%d\n", pgmPoolPoolKindToStr(pPage->enmKind), pPage->idx));
    4829         pgmUnlock(pVM);
     4829        PGM_UNLOCK(pVM);
    48304830        return VINF_SUCCESS;
    48314831    }
     
    48844884    }
    48854885
    4886     pgmUnlock(pVM);
     4886    PGM_UNLOCK(pVM);
    48874887    STAM_PROFILE_STOP(&pPool->StatFlushPage, f);
    48884888    return rc;
     
    49124912    AssertReturnVoid(pPage->idx >= PGMPOOL_IDX_FIRST); /* paranoia (#6349) */
    49134913
    4914     pgmLock(pVM);
     4914    PGM_LOCK_VOID(pVM);
    49154915    if (iUser != NIL_PGMPOOL_IDX)
    49164916        pgmPoolTrackFreeUser(pPool, pPage, iUser, iUserTable);
    49174917    if (!pPage->fCached)
    49184918        pgmPoolFlushPage(pPool, pPage);
    4919     pgmUnlock(pVM);
     4919    PGM_UNLOCK(pVM);
    49204920    STAM_PROFILE_STOP(&pPool->StatFree, a);
    49214921}
     
    49984998     *  Assert(!(pVM->pgm.s.fGlobalSyncFlags & PGM_SYNC_CLEAR_PGM_POOL)); */
    49994999
    5000     pgmLock(pVM);
     5000    PGM_LOCK_VOID(pVM);
    50015001
    50025002    if (pPool->fCacheEnabled)
     
    50075007            if (fLockPage)
    50085008                pgmPoolLockPage(pPool, *ppPage);
    5009             pgmUnlock(pVM);
     5009            PGM_UNLOCK(pVM);
    50105010            STAM_PROFILE_ADV_STOP(&pPool->StatAlloc, a);
    50115011            LogFlow(("pgmPoolAlloc: cached returns %Rrc *ppPage=%p:{.Key=%RHp, .idx=%d}\n", rc2, *ppPage, (*ppPage)->Core.Key, (*ppPage)->idx));
     
    50245024        if (RT_FAILURE(rc))
    50255025        {
    5026             pgmUnlock(pVM);
     5026            PGM_UNLOCK(pVM);
    50275027            Log(("pgmPoolAlloc: returns %Rrc (Free)\n", rc));
    50285028            STAM_PROFILE_ADV_STOP(&pPool->StatAlloc, a);
     
    50775077        pPage->iNext        = pPool->iFreeHead;
    50785078        pPool->iFreeHead    = pPage->idx;
    5079         pgmUnlock(pVM);
     5079        PGM_UNLOCK(pVM);
    50805080        STAM_PROFILE_ADV_STOP(&pPool->StatAlloc, a);
    50815081        Log(("pgmPoolAlloc: returns %Rrc (Insert)\n", rc3));
     
    51025102    if (fLockPage)
    51035103        pgmPoolLockPage(pPool, pPage);
    5104     pgmUnlock(pVM);
     5104    PGM_UNLOCK(pVM);
    51055105    LogFlow(("pgmPoolAlloc: returns %Rrc *ppPage=%p:{.Key=%RHp, .idx=%d, .fCached=%RTbool, .fMonitored=%RTbool}\n",
    51065106             rc, pPage, pPage->Core.Key, pPage->idx, pPage->fCached, pPage->fMonitored));
  • trunk/src/VBox/VMM/VMMAll/PGMAllShw.h

    r90346 r90439  
    238238    Assert(!pVCpu->pgm.s.pShwPageCR3R3);
    239239
    240     pgmLock(pVM);
     240    PGM_LOCK_VOID(pVM);
    241241
    242242    int rc = pgmPoolAlloc(pVM, GCPhysCR3, PGMPOOLKIND_ROOT_NESTED, PGMPOOLACCESS_DONTCARE, PGM_A20_IS_ENABLED(pVCpu),
    243243                          NIL_PGMPOOL_IDX, UINT32_MAX, true /*fLockPage*/,
    244244                          &pNewShwPageCR3);
    245     AssertLogRelRCReturnStmt(rc, pgmUnlock(pVM), rc);
     245    AssertLogRelRCReturnStmt(rc, PGM_UNLOCK(pVM), rc);
    246246
    247247    pVCpu->pgm.s.pShwPageCR3R3 = (R3PTRTYPE(PPGMPOOLPAGE))MMHyperCCToR3(pVM, pNewShwPageCR3);
    248248    pVCpu->pgm.s.pShwPageCR3R0 = (R0PTRTYPE(PPGMPOOLPAGE))MMHyperCCToR0(pVM, pNewShwPageCR3);
    249249
    250     pgmUnlock(pVM);
     250    PGM_UNLOCK(pVM);
    251251
    252252    Log(("Enter nested shadow paging mode: root %RHv phys %RHp\n", pVCpu->pgm.s.pShwPageCR3R3, pVCpu->pgm.s.CTX_SUFF(pShwPageCR3)->Core.Key));
     
    272272        PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool);
    273273
    274         pgmLock(pVM);
     274        PGM_LOCK_VOID(pVM);
    275275
    276276        /* Do *not* unlock this page as we have two of them floating around in the 32-bit host & 64-bit guest case.
     
    285285        pVCpu->pgm.s.pShwPageCR3R0 = 0;
    286286
    287         pgmUnlock(pVM);
     287        PGM_UNLOCK(pVM);
    288288
    289289        Log(("Leave nested shadow paging mode\n"));
  • trunk/src/VBox/VMM/VMMR0/PGMR0.cpp

    r86473 r90439  
    544544         * IOMMU about each of them.
    545545         */
    546         pgmLock(pGVM);
     546        PGM_LOCK_VOID(pGVM);
    547547        rc = GPciRawR0GuestPageBeginAssignments(pGVM);
    548548        if (RT_SUCCESS(rc))
     
    573573                rc = rc2;
    574574        }
    575         pgmUnlock(pGVM);
     575        PGM_UNLOCK(pGVM);
    576576    }
    577577    else
     
    683683    {
    684684        PGM_LOCK_ASSERT_OWNER(pGVM);
    685         pgmUnlock(pGVM);
     685        PGM_UNLOCK(pGVM);
    686686    }
    687687
     
    734734     * Try lookup the all access physical handler for the address.
    735735     */
    736     pgmLock(pGVM);
     736    PGM_LOCK_VOID(pGVM);
    737737    PPGMPHYSHANDLER         pHandler     = pgmHandlerPhysicalLookup(pGVM, GCPhysFault);
    738738    PPGMPHYSHANDLERTYPEINT  pHandlerType = RT_LIKELY(pHandler) ? PGMPHYSHANDLER_GET_TYPE(pGVM, pHandler) : NULL;
     
    754754            STAM_COUNTER_INC(&pGVCpu->pgm.s.CTX_SUFF(pStats)->StatR0NpMiscfgSyncPage);
    755755            rc = pgmShwSyncNestedPageLocked(pGVCpu, GCPhysFault, 1 /*cPages*/, enmShwPagingMode);
    756             pgmUnlock(pGVM);
     756            PGM_UNLOCK(pGVM);
    757757        }
    758758        else
     
    762762                void *pvUser = pHandler->CTX_SUFF(pvUser);
    763763                STAM_PROFILE_START(&pHandler->Stat, h);
    764                 pgmUnlock(pGVM);
     764                PGM_UNLOCK(pGVM);
    765765
    766766                Log6(("PGMR0Trap0eHandlerNPMisconfig: calling %p(,%#x,,%RGp,%p)\n", pHandlerType->CTX_SUFF(pfnPfHandler), uErr, GCPhysFault, pvUser));
     
    769769
    770770#ifdef VBOX_WITH_STATISTICS
    771                 pgmLock(pGVM);
     771                PGM_LOCK_VOID(pGVM);
    772772                pHandler = pgmHandlerPhysicalLookup(pGVM, GCPhysFault);
    773773                if (pHandler)
    774774                    STAM_PROFILE_STOP(&pHandler->Stat, h);
    775                 pgmUnlock(pGVM);
     775                PGM_UNLOCK(pGVM);
    776776#endif
    777777            }
    778778            else
    779779            {
    780                 pgmUnlock(pGVM);
     780                PGM_UNLOCK(pGVM);
    781781                Log(("PGMR0Trap0eHandlerNPMisconfig: %RGp (uErr=%#x) -> R3\n", GCPhysFault, uErr));
    782782                rc = VINF_EM_RAW_EMULATE_INSTR;
     
    795795        STAM_COUNTER_INC(&pGVCpu->pgm.s.CTX_SUFF(pStats)->StatR0NpMiscfgSyncPage);
    796796        rc = pgmShwSyncNestedPageLocked(pGVCpu, GCPhysFault, 1 /*cPages*/, enmShwPagingMode);
    797         pgmUnlock(pGVM);
     797        PGM_UNLOCK(pGVM);
    798798    }
    799799
  • trunk/src/VBox/VMM/VMMR3/PGM.cpp

    r90348 r90439  
    19971997    VM_ASSERT_EMT(pVM);
    19981998
    1999     pgmLock(pVM);
     1999    PGM_LOCK_VOID(pVM);
    20002000
    20012001    /*
     
    20742074
    20752075    //pgmLogState(pVM);
    2076     pgmUnlock(pVM);
     2076    PGM_UNLOCK(pVM);
    20772077}
    20782078
     
    20892089    if (fAtReset)
    20902090    {
    2091         pgmLock(pVM);
     2091        PGM_LOCK_VOID(pVM);
    20922092
    20932093        int rc = pgmR3PhysRamZeroAll(pVM);
     
    20972097        AssertReleaseRC(rc);
    20982098
    2099         pgmUnlock(pVM);
     2099        PGM_UNLOCK(pVM);
    21002100    }
    21012101}
     
    21332133{
    21342134    /* Must free shared pages here. */
    2135     pgmLock(pVM);
     2135    PGM_LOCK_VOID(pVM);
    21362136    pgmR3PhysRamTerm(pVM);
    21372137    pgmR3PhysRomTerm(pVM);
    2138     pgmUnlock(pVM);
     2138    PGM_UNLOCK(pVM);
    21392139
    21402140    PGMDeregisterStringFormatTypes();
     
    22782278                    {
    22792279                        pszType = "MMIO";
    2280                         pgmLock(pVM);
     2280                        PGM_LOCK_VOID(pVM);
    22812281                        PPGMPHYSHANDLER pHandler = pgmHandlerPhysicalLookup(pVM, iFirstPage * X86_PAGE_SIZE);
    22822282                        if (pHandler)
    22832283                            pszMore = pHandler->pszDesc;
    2284                         pgmUnlock(pVM);
     2284                        PGM_UNLOCK(pVM);
    22852285                        break;
    22862286                    }
     
    23352335     * Get page directory addresses.
    23362336     */
    2337     pgmLock(pVM);
     2337    PGM_LOCK_VOID(pVM);
    23382338    PX86PD     pPDSrc = pgmGstGet32bitPDPtr(pVCpu);
    23392339    Assert(pPDSrc);
     
    23612361        }
    23622362    }
    2363     pgmUnlock(pVM);
     2363    PGM_UNLOCK(pVM);
    23642364}
    23652365
     
    26362636    RT_ZERO(abZeroPg);
    26372637
    2638     pgmLock(pVM);
     2638    PGM_LOCK_VOID(pVM);
    26392639    for (PPGMRAMRANGE pRam = pVM->pgm.s.pRamRangesXR3;
    26402640         pRam && pRam->GCPhys < GCPhysEnd && RT_SUCCESS(rc);
     
    27102710        }
    27112711    }
    2712     pgmUnlock(pVM);
     2712    PGM_UNLOCK(pVM);
    27132713
    27142714    RTFileClose(hFile);
  • trunk/src/VBox/VMM/VMMR3/PGMDbg.cpp

    r86523 r90439  
    690690     * bother to match across ranges.
    691691     */
    692     pgmLock(pVM);
     692    PGM_LOCK_VOID(pVM);
    693693    for (PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(pRamRangesX);
    694694         pRam;
     
    750750                        {
    751751                            *pGCPhysHit = GCPhys + offHit;
    752                             pgmUnlock(pVM);
     752                            PGM_UNLOCK(pVM);
    753753                            return VINF_SUCCESS;
    754754                        }
     
    764764                if (GCPhys >= GCPhysLast) /* (may not always hit, but we're run out of ranges.) */
    765765                {
    766                     pgmUnlock(pVM);
     766                    PGM_UNLOCK(pVM);
    767767                    return VERR_DBGF_MEM_NOT_FOUND;
    768768                }
     
    774774        }
    775775    }
    776     pgmUnlock(pVM);
     776    PGM_UNLOCK(pVM);
    777777    return VERR_DBGF_MEM_NOT_FOUND;
    778778}
     
    872872    RT_ZERO(Walk);
    873873
    874     pgmLock(pVM);
     874    PGM_LOCK_VOID(pVM);
    875875    for (;; offPage = 0)
    876876    {
     
    918918                        {
    919919                            *pGCPtrHit = GCPtr + offHit;
    920                             pgmUnlock(pVM);
     920                            PGM_UNLOCK(pVM);
    921921                            return VINF_SUCCESS;
    922922                        }
     
    10051005        }
    10061006    }
    1007     pgmUnlock(pVM);
     1007    PGM_UNLOCK(pVM);
    10081008    return VERR_DBGF_MEM_NOT_FOUND;
    10091009}
     
    11631163static void pgmR3DumpHierarchyShwTablePageInfo(PPGMR3DUMPHIERARCHYSTATE pState, RTHCPHYS HCPhys)
    11641164{
    1165     pgmLock(pState->pVM);
     1165    PGM_LOCK_VOID(pState->pVM);
    11661166    char            szPage[80];
    11671167    PPGMPOOLPAGE    pPage = pgmPoolQueryPageForDbg(pState->pVM->pgm.s.CTX_SUFF(pPool), HCPhys);
     
    11921192#endif /* !PGM_WITHOUT_MAPPINGS */
    11931193    }
    1194     pgmUnlock(pState->pVM);
     1194    PGM_UNLOCK(pState->pVM);
    11951195    pState->pHlp->pfnPrintf(pState->pHlp, "%s", szPage);
    11961196}
     
    12111211    if (RT_SUCCESS(rc))
    12121212    {
    1213         pgmLock(pState->pVM);
     1213        PGM_LOCK_VOID(pState->pVM);
    12141214        PCPGMPAGE pPage = pgmPhysGetPage(pState->pVM, GCPhys);
    12151215        if (pPage)
     
    12171217        else
    12181218            strcpy(szPage, "not found");
    1219         pgmUnlock(pState->pVM);
     1219        PGM_UNLOCK(pState->pVM);
    12201220        pState->pHlp->pfnPrintf(pState->pHlp, " -> %RGp %s", GCPhys, szPage);
    12211221    }
     
    19201920{
    19211921    char szPage[80];
    1922     pgmLock(pState->pVM);
     1922    PGM_LOCK_VOID(pState->pVM);
    19231923    PCPGMPAGE pPage = pgmPhysGetPage(pState->pVM, GCPhys);
    19241924    if (pPage)
     
    19261926    else
    19271927        strcpy(szPage, " not found");
    1928     pgmUnlock(pState->pVM);
     1928    PGM_UNLOCK(pState->pVM);
    19291929    pState->pHlp->pfnPrintf(pState->pHlp, "%s", szPage);
    19301930    NOREF(cbPage);
  • trunk/src/VBox/VMM/VMMR3/PGMHandler.cpp

    r86473 r90439  
    102102        pType->pszDesc          = pszDesc;
    103103
    104         pgmLock(pVM);
     104        PGM_LOCK_VOID(pVM);
    105105        RTListOff32Append(&pVM->pgm.s.CTX_SUFF(pTrees)->HeadPhysHandlerTypes, &pType->ListNode);
    106         pgmUnlock(pVM);
     106        PGM_UNLOCK(pVM);
    107107
    108108        *phType = MMHyperHeapPtrToOffset(pVM, pType);
     
    223223     * (the right -> left on the setting pass is just bird speculating on cache hits)
    224224     */
    225     pgmLock(pVM);
     225    PGM_LOCK_VOID(pVM);
    226226    RTAvlroGCPhysDoWithAll(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers,  true, pgmR3HandlerPhysicalOneClear, pVM);
    227227    RTAvlroGCPhysDoWithAll(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, false, pgmR3HandlerPhysicalOneSet, pVM);
    228     pgmUnlock(pVM);
     228    PGM_UNLOCK(pVM);
    229229}
    230230
  • trunk/src/VBox/VMM/VMMR3/PGMMap.cpp

    r82968 r90439  
    954954    unsigned i     = pMap->cPTs;
    955955    PVMCPU   pVCpu = VMMGetCpu(pVM);
    956     pgmLock(pVM);                           /* to avoid assertions */
     956    PGM_LOCK_VOID(pVM);                           /* to avoid assertions */
    957957
    958958    pgmMapClearShadowPDEs(pVM, pVCpu->pgm.s.CTX_SUFF(pShwPageCR3), pMap, iOldPDE, false /*fDeactivateCR3*/);
     
    979979    }
    980980
    981     pgmUnlock(pVM);
     981    PGM_UNLOCK(pVM);
    982982}
    983983
     
    996996    PVMCPU pVCpu = VMMGetCpu(pVM);
    997997# endif
    998     pgmLock(pVM);                           /* to avoid assertions */
     998    PGM_LOCK_VOID(pVM);                           /* to avoid assertions */
    999999
    10001000    Assert(!pgmMapAreMappingsEnabled(pVM) || PGMGetGuestMode(pVCpu) <= PGMMODE_PAE_NX);
     
    10341034    }
    10351035
    1036     pgmUnlock(pVM);
     1036    PGM_UNLOCK(pVM);
    10371037}
    10381038
  • trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp

    r86473 r90439  
    118118    LogFlow(("PGMR3PhysReadExternal: %RGp %d\n", GCPhys, cbRead));
    119119
    120     pgmLock(pVM);
     120    PGM_LOCK_VOID(pVM);
    121121
    122122    /*
     
    145145                    || PGM_PAGE_IS_SPECIAL_ALIAS_MMIO(pPage))
    146146                {
    147                     pgmUnlock(pVM);
     147                    PGM_UNLOCK(pVM);
    148148
    149149                    return VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)pgmR3PhysReadExternalEMT, 5,
     
    176176                if (cb >= cbRead)
    177177                {
    178                     pgmUnlock(pVM);
     178                    PGM_UNLOCK(pVM);
    179179                    return VINF_SUCCESS;
    180180                }
     
    210210    } /* Ram range walk */
    211211
    212     pgmUnlock(pVM);
     212    PGM_UNLOCK(pVM);
    213213
    214214    return VINF_SUCCESS;
     
    254254    LogFlow(("PGMR3PhysWriteExternal: %RGp %d\n", GCPhys, cbWrite));
    255255
    256     pgmLock(pVM);
     256    PGM_LOCK_VOID(pVM);
    257257
    258258    /*
     
    290290                    else
    291291                    {
    292                         pgmUnlock(pVM);
     292                        PGM_UNLOCK(pVM);
    293293
    294294                        return VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)pgmR3PhysWriteExternalEMT, 5,
     
    319319                if (cb >= cbWrite)
    320320                {
    321                     pgmUnlock(pVM);
     321                    PGM_UNLOCK(pVM);
    322322                    return VINF_SUCCESS;
    323323                }
     
    349349    } /* Ram range walk */
    350350
    351     pgmUnlock(pVM);
     351    PGM_UNLOCK(pVM);
    352352    return VINF_SUCCESS;
    353353}
     
    369369     * an access handler after it succeeds.
    370370     */
    371     int rc = pgmLock(pVM);
     371    int rc = PGM_LOCK(pVM);
    372372    AssertRCReturn(rc, rc);
    373373
     
    400400    }
    401401
    402     pgmUnlock(pVM);
     402    PGM_UNLOCK(pVM);
    403403    return rc;
    404404}
     
    439439    Assert(VM_IS_EMT(pVM) || !PGMIsLockOwner(pVM));
    440440
    441     int rc = pgmLock(pVM);
     441    int rc = PGM_LOCK(pVM);
    442442    AssertRCReturn(rc, rc);
    443443
     
    476476                else
    477477                {
    478                     pgmUnlock(pVM);
     478                    PGM_UNLOCK(pVM);
    479479
    480480                    return VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)pgmR3PhysGCPhys2CCPtrDelegated, 4,
     
    511511    }
    512512
    513     pgmUnlock(pVM);
     513    PGM_UNLOCK(pVM);
    514514    return rc;
    515515}
     
    540540VMMR3DECL(int) PGMR3PhysGCPhys2CCPtrReadOnlyExternal(PVM pVM, RTGCPHYS GCPhys, void const **ppv, PPGMPAGEMAPLOCK pLock)
    541541{
    542     int rc = pgmLock(pVM);
     542    int rc = PGM_LOCK(pVM);
    543543    AssertRCReturn(rc, rc);
    544544
     
    589589    }
    590590
    591     pgmUnlock(pVM);
     591    PGM_UNLOCK(pVM);
    592592    return rc;
    593593}
     
    636636    Assert(VM_IS_EMT(pVM) || !PGMIsLockOwner(pVM));
    637637
    638     int rc = pgmLock(pVM);
     638    int rc = PGM_LOCK(pVM);
    639639    AssertRCReturn(rc, rc);
    640640
     
    651651        else
    652652        {
    653             pgmUnlock(pVM);
     653            PGM_UNLOCK(pVM);
    654654            ASMNopPause();
    655             pgmLock(pVM);
     655            PGM_LOCK_VOID(pVM);
    656656            cNextYield = 128;
    657657        }
     
    708708        {
    709709            /* We could do this delegation in bulk, but considered too much work vs gain. */
    710             pgmUnlock(pVM);
     710            PGM_UNLOCK(pVM);
    711711            rc = VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)pgmR3PhysGCPhys2CCPtrDelegated, 4,
    712712                                         pVM, &paGCPhysPages[iPage], &papvPages[iPage], &paLocks[iPage]);
    713             pgmLock(pVM);
     713            PGM_LOCK_VOID(pVM);
    714714            if (RT_FAILURE(rc))
    715715                break;
     
    744744    }
    745745
    746     pgmUnlock(pVM);
     746    PGM_UNLOCK(pVM);
    747747
    748748    /*
     
    794794    Assert(VM_IS_EMT(pVM) || !PGMIsLockOwner(pVM));
    795795
    796     int rc = pgmLock(pVM);
     796    int rc = PGM_LOCK(pVM);
    797797    AssertRCReturn(rc, rc);
    798798
     
    809809        else
    810810        {
    811             pgmUnlock(pVM);
     811            PGM_UNLOCK(pVM);
    812812            ASMNopPause();
    813             pgmLock(pVM);
     813            PGM_LOCK_VOID(pVM);
    814814            cNextYield = 256;
    815815        }
     
    865865    }
    866866
    867     pgmUnlock(pVM);
     867    PGM_UNLOCK(pVM);
    868868
    869869    /*
     
    10691069    Assert((pNew->fFlags & PGM_RAM_RANGE_FLAGS_FLOATING) || pNew->pSelfR0 == MMHyperCCToR0(pVM, pNew));
    10701070
    1071     pgmLock(pVM);
     1071    PGM_LOCK_VOID(pVM);
    10721072
    10731073    PPGMRAMRANGE pRam = pPrev ? pPrev->pNextR3 : pVM->pgm.s.pRamRangesXR3;
     
    10881088
    10891089    pgmR3PhysRebuildRamRangeSearchTrees(pVM);
    1090     pgmUnlock(pVM);
     1090    PGM_UNLOCK(pVM);
    10911091}
    10921092
     
    11041104    Assert((pRam->fFlags & PGM_RAM_RANGE_FLAGS_FLOATING) || pRam->pSelfR0 == MMHyperCCToR0(pVM, pRam));
    11051105
    1106     pgmLock(pVM);
     1106    PGM_LOCK_VOID(pVM);
    11071107
    11081108    PPGMRAMRANGE pNext = pRam->pNextR3;
     
    11211121
    11221122    pgmR3PhysRebuildRamRangeSearchTrees(pVM);
    1123     pgmUnlock(pVM);
     1123    PGM_UNLOCK(pVM);
    11241124}
    11251125
     
    11331133static void pgmR3PhysUnlinkRamRange(PVM pVM, PPGMRAMRANGE pRam)
    11341134{
    1135     pgmLock(pVM);
     1135    PGM_LOCK_VOID(pVM);
    11361136
    11371137    /* find prev. */
     
    11461146
    11471147    pgmR3PhysUnlinkRamRange2(pVM, pRam, pPrev);
    1148     pgmUnlock(pVM);
     1148    PGM_UNLOCK(pVM);
    11491149}
    11501150
     
    12161216
    12171217    Log(("pgmR3PhysChangeMemBalloonRendezvous: %s %x pages\n", (fInflate) ? "inflate" : "deflate", cPages));
    1218     pgmLock(pVM);
     1218    PGM_LOCK_VOID(pVM);
    12191219
    12201220    if (fInflate)
     
    12271227        if (RT_FAILURE(rc))
    12281228        {
    1229             pgmUnlock(pVM);
     1229            PGM_UNLOCK(pVM);
    12301230            AssertLogRelRC(rc);
    12311231            return rc;
     
    12511251            if (RT_FAILURE(rc))
    12521252            {
    1253                 pgmUnlock(pVM);
     1253                PGM_UNLOCK(pVM);
    12541254                AssertLogRelRC(rc);
    12551255                return rc;
     
    12641264            if (RT_FAILURE(rc))
    12651265            {
    1266                 pgmUnlock(pVM);
     1266                PGM_UNLOCK(pVM);
    12671267                AssertLogRelRC(rc);
    12681268                return rc;
     
    13031303    }
    13041304
    1305     pgmUnlock(pVM);
     1305    PGM_UNLOCK(pVM);
    13061306
    13071307    /* Flush the recompiler's TLB as well. */
     
    14071407    NOREF(pvUser); NOREF(pVCpu);
    14081408
    1409     pgmLock(pVM);
     1409    PGM_LOCK_VOID(pVM);
    14101410#ifdef PGMPOOL_WITH_OPTIMIZED_DIRTY_PT
    14111411    pgmPoolResetDirtyPages(pVM);
     
    14571457        CPUMSetChangedFlags(pVM->apCpusR3[idCpu], CPUM_CHANGED_GLOBAL_TLB_FLUSH);
    14581458
    1459     pgmUnlock(pVM);
     1459    PGM_UNLOCK(pVM);
    14601460    return rc;
    14611461}
     
    14871487    VM_ASSERT_VALID_EXT_RETURN(pVM, UINT32_MAX);
    14881488
    1489     pgmLock(pVM);
     1489    PGM_LOCK_VOID(pVM);
    14901490    uint32_t cRamRanges = 0;
    14911491    for (PPGMRAMRANGE pCur = pVM->pgm.s.CTX_SUFF(pRamRangesX); pCur; pCur = pCur->CTX_SUFF(pNext))
    14921492        cRamRanges++;
    1493     pgmUnlock(pVM);
     1493    PGM_UNLOCK(pVM);
    14941494    return cRamRanges;
    14951495}
     
    15141514    VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);
    15151515
    1516     pgmLock(pVM);
     1516    PGM_LOCK_VOID(pVM);
    15171517    uint32_t iCurRange = 0;
    15181518    for (PPGMRAMRANGE pCur = pVM->pgm.s.CTX_SUFF(pRamRangesX); pCur; pCur = pCur->CTX_SUFF(pNext), iCurRange++)
     
    15281528                *pfIsMmio     = !!(pCur->fFlags & PGM_RAM_RANGE_FLAGS_AD_HOC_MMIO);
    15291529
    1530             pgmUnlock(pVM);
     1530            PGM_UNLOCK(pVM);
    15311531            return VINF_SUCCESS;
    15321532        }
    1533     pgmUnlock(pVM);
     1533    PGM_UNLOCK(pVM);
    15341534    return VERR_OUT_OF_RANGE;
    15351535}
     
    16971697             * Update myself, then relink all the ranges and flush the RC TLB.
    16981698             */
    1699             pgmLock(pVM);
     1699            PGM_LOCK_VOID(pVM);
    17001700
    17011701            pRam->pSelfRC = (RTRCPTR)(GCPtrNew + PAGE_SIZE);
     
    17051705                pVM->pgm.s.apRamRangesTlbRC[i] = NIL_RTRCPTR;
    17061706
    1707             pgmUnlock(pVM);
     1707            PGM_UNLOCK(pVM);
    17081708            return true;
    17091709        }
     
    18181818    VM_ASSERT_EMT_RETURN(pVM, VERR_VM_THREAD_NOT_EMT);
    18191819
    1820     pgmLock(pVM);
     1820    PGM_LOCK_VOID(pVM);
    18211821
    18221822    /*
     
    18471847    if (RT_FAILURE(rc))
    18481848    {
    1849         pgmUnlock(pVM);
     1849        PGM_UNLOCK(pVM);
    18501850        return rc;
    18511851    }
     
    19091909     */
    19101910    rc = NEMR3NotifyPhysRamRegister(pVM, GCPhys, cb);
    1911     pgmUnlock(pVM);
     1911    PGM_UNLOCK(pVM);
    19121912    return rc;
    19131913}
     
    19351935    uint64_t cPages = 0;
    19361936    uint64_t NanoTS = RTTimeNanoTS();
    1937     pgmLock(pVM);
     1937    PGM_LOCK_VOID(pVM);
    19381938    for (PPGMRAMRANGE pRam = pVM->pgm.s.pRamRangesXR3; pRam; pRam = pRam->pNextR3)
    19391939    {
     
    19531953                        {
    19541954                            LogRel(("PGM: RAM Pre-allocation failed at %RGp (in %s) with rc=%Rrc\n", GCPhys, pRam->pszDesc, rc));
    1955                             pgmUnlock(pVM);
     1955                            PGM_UNLOCK(pVM);
    19561956                            return rc;
    19571957                        }
     
    19741974        }
    19751975    }
    1976     pgmUnlock(pVM);
     1976    PGM_UNLOCK(pVM);
    19771977    NanoTS = RTTimeNanoTS() - NanoTS;
    19781978
     
    19911991{
    19921992#ifdef VBOX_STRICT
    1993     pgmLock(pVM);
     1993    PGM_LOCK_VOID(pVM);
    19941994
    19951995    if (pVM->pgm.s.cSharedPages > 0)
     
    20362036    }
    20372037
    2038     pgmUnlock(pVM);
     2038    PGM_UNLOCK(pVM);
    20392039#endif /* VBOX_STRICT */
    20402040    NOREF(pVM);
     
    23412341    Assert(((PPGMPHYSHANDLERTYPEINT)MMHyperHeapOffsetToPtr(pVM, hType))->enmKind == PGMPHYSHANDLERKIND_MMIO);
    23422342
    2343     int rc = pgmLock(pVM);
     2343    int rc = PGM_LOCK(pVM);
    23442344    AssertRCReturn(rc, rc);
    23452345
     
    23622362                                       GCPhys, GCPhysLast, pszDesc,
    23632363                                       pRam->GCPhys, pRam->GCPhysLast, pRam->pszDesc),
    2364                                       pgmUnlock(pVM),
     2364                                      PGM_UNLOCK(pVM),
    23652365                                      VERR_PGM_RAM_CONFLICT);
    23662366
     
    23742374                                          ("%RGp-%RGp (MMIO/%s): %RGp is not a RAM or MMIO page - type=%d desc=%s\n",
    23752375                                           GCPhys, GCPhysLast, pszDesc, pRam->GCPhys, PGM_PAGE_GET_TYPE(pPage), pRam->pszDesc),
    2376                                           pgmUnlock(pVM),
     2376                                          PGM_UNLOCK(pVM),
    23772377                                          VERR_PGM_RAM_CONFLICT);
    23782378                pPage++;
     
    23992399         */
    24002400        rc = pgmR3PhysFreePageRange(pVM, pRam, GCPhys, GCPhysLast, PGMPAGETYPE_MMIO);
    2401         AssertRCReturnStmt(rc, pgmUnlock(pVM), rc);
     2401        AssertRCReturnStmt(rc, PGM_UNLOCK(pVM), rc);
    24022402
    24032403        /* Force a PGM pool flush as guest ram references have been changed. */
     
    24232423        const size_t cbRamRange = RT_UOFFSETOF_DYN(PGMRAMRANGE, aPages[cPages]);
    24242424        rc = MMHyperAlloc(pVM, RT_UOFFSETOF_DYN(PGMRAMRANGE, aPages[cPages]), 16, MM_TAG_PGM_PHYS, (void **)&pNew);
    2425         AssertLogRelMsgRCReturnStmt(rc, ("cbRamRange=%zu\n", cbRamRange), pgmUnlock(pVM), rc);
     2425        AssertLogRelMsgRCReturnStmt(rc, ("cbRamRange=%zu\n", cbRamRange), PGM_UNLOCK(pVM), rc);
    24262426
    24272427        /* Initialize the range. */
     
    24652465    pgmPhysInvalidatePageMapTLB(pVM);
    24662466
    2467     pgmUnlock(pVM);
     2467    PGM_UNLOCK(pVM);
    24682468    return rc;
    24692469}
     
    24852485    VM_ASSERT_EMT(pVM);
    24862486
    2487     int rc = pgmLock(pVM);
     2487    int rc = PGM_LOCK(pVM);
    24882488    AssertRCReturn(rc, rc);
    24892489
     
    25872587    pgmPhysInvalidatePageMapTLB(pVM);
    25882588    pgmPhysInvalidRamRangeTlbs(pVM);
    2589     pgmUnlock(pVM);
     2589    PGM_UNLOCK(pVM);
    25902590    return rc;
    25912591}
     
    26682668             * Update myself, then relink all the ranges and flush the RC TLB.
    26692669             */
    2670             pgmLock(pVM);
     2670            PGM_LOCK_VOID(pVM);
    26712671
    26722672            pMmio->RamRange.pSelfRC = (RTRCPTR)(GCPtrNew + PAGE_SIZE + RT_UOFFSETOF(PGMREGMMIO2RANGE, RamRange));
     
    26762676                pVM->pgm.s.apRamRangesTlbRC[i] = NIL_RTRCPTR;
    26772677
    2678             pgmUnlock(pVM);
     2678            PGM_UNLOCK(pVM);
    26792679            return true;
    26802680        }
     
    29052905    }
    29062906
    2907     pgmLock(pVM);
     2907    PGM_LOCK_VOID(pVM);
    29082908
    29092909    /* Link in the chain of ranges at the head of the list. */
     
    29322932
    29332933    pgmPhysInvalidatePageMapTLB(pVM);
    2934     pgmUnlock(pVM);
     2934    PGM_UNLOCK(pVM);
    29352935}
    29362936
     
    30153015     */
    30163016    unsigned cChunks = pgmR3PhysMmio2CalcChunkCount(pVM, cb, NULL, NULL);
    3017     pgmLock(pVM);
     3017    PGM_LOCK_VOID(pVM);
    30183018    uint8_t  idMmio2 = pVM->pgm.s.cMmio2Regions + 1;
    30193019    unsigned cNewMmio2Regions = pVM->pgm.s.cMmio2Regions + cChunks;
    30203020    if (cNewMmio2Regions > PGM_MMIO2_MAX_RANGES)
    30213021    {
    3022         pgmUnlock(pVM);
     3022        PGM_UNLOCK(pVM);
    30233023        AssertLogRelFailedReturn(VERR_PGM_TOO_MANY_MMIO2_RANGES);
    30243024    }
    30253025    pVM->pgm.s.cMmio2Regions = cNewMmio2Regions;
    3026     pgmUnlock(pVM);
     3026    PGM_UNLOCK(pVM);
    30273027
    30283028    /*
     
    31343134     * get properly deregistered, though it's original purpose was the wildcard iRegion.
    31353135     */
    3136     pgmLock(pVM);
     3136    PGM_LOCK_VOID(pVM);
    31373137    int rc = VINF_SUCCESS;
    31383138    unsigned cFound = 0;
     
    32483248    }
    32493249    pgmPhysInvalidatePageMapTLB(pVM);
    3250     pgmUnlock(pVM);
     3250    PGM_UNLOCK(pVM);
    32513251    return !cFound && hMmio2 != NIL_PGMMMIO2HANDLE  ? VERR_NOT_FOUND : rc;
    32523252}
     
    33103310     * ram ranges).
    33113311     */
    3312     pgmLock(pVM);
    3313 
    3314     AssertReturnStmt(!(pFirstMmio->fFlags & PGMREGMMIO2RANGE_F_MAPPED), pgmUnlock(pVM), VERR_WRONG_ORDER);
     3312    PGM_LOCK_VOID(pVM);
     3313
     3314    AssertReturnStmt(!(pFirstMmio->fFlags & PGMREGMMIO2RANGE_F_MAPPED), PGM_UNLOCK(pVM), VERR_WRONG_ORDER);
    33153315
    33163316    bool fRamExists = false;
     
    33283328                                       GCPhys, GCPhysLast, pFirstMmio->RamRange.pszDesc,
    33293329                                       pRam->GCPhys, pRam->GCPhysLast, pRam->pszDesc),
    3330                                       pgmUnlock(pVM),
     3330                                      PGM_UNLOCK(pVM),
    33313331                                      VERR_PGM_RAM_CONFLICT);
    33323332
     
    33393339                                          ("%RGp isn't a RAM page (%d) - mapping %RGp-%RGp (MMIO2/%s).\n",
    33403340                                           GCPhys, PGM_PAGE_GET_TYPE(pPage), GCPhys, GCPhysLast, pFirstMmio->RamRange.pszDesc),
    3341                                           pgmUnlock(pVM),
     3341                                          PGM_UNLOCK(pVM),
    33423342                                          VERR_PGM_RAM_CONFLICT);
    33433343                pPage++;
     
    33483348                                      ("%RGp-%RGp (MMIOEx/%s, flags %#X) consists of multiple chunks whereas the RAM somehow doesn't!\n",
    33493349                                       GCPhys, GCPhysLast, pFirstMmio->RamRange.pszDesc, pFirstMmio->fFlags),
    3350                                       pgmUnlock(pVM),
     3350                                      PGM_UNLOCK(pVM),
    33513351                                      VERR_PGM_PHYS_MMIO_EX_IPE);
    33523352
     
    33903390
    33913391        int rc = pgmR3PhysFreePageRange(pVM, pRam, GCPhys, GCPhysLast, PGMPAGETYPE_MMIO);
    3392         AssertRCReturnStmt(rc, pgmUnlock(pVM), rc);
     3392        AssertRCReturnStmt(rc, PGM_UNLOCK(pVM), rc);
    33933393
    33943394        if (pFirstMmio->fFlags & PGMREGMMIO2RANGE_F_MMIO2)
     
    35123512            }
    35133513
    3514             pgmUnlock(pVM);
     3514            PGM_UNLOCK(pVM);
    35153515            return rc;
    35163516        }
     
    35393539    int rc = NEMR3NotifyPhysMmioExMap(pVM, GCPhys, cbRange, fNemNotify, pFirstMmio->pvR3);
    35403540
    3541     pgmUnlock(pVM);
     3541    PGM_UNLOCK(pVM);
    35423542
    35433543    return rc;
     
    35703570    Assert(pFirstMmio->fFlags & PGMREGMMIO2RANGE_F_FIRST_CHUNK);
    35713571
    3572     int rc = pgmLock(pVM);
     3572    int rc = PGM_LOCK(pVM);
    35733573    AssertRCReturn(rc, rc);
    35743574
     
    35773577    for (;;)
    35783578    {
    3579         AssertReturnStmt(pLastMmio->fFlags & PGMREGMMIO2RANGE_F_MAPPED, pgmUnlock(pVM), VERR_WRONG_ORDER);
    3580         AssertReturnStmt(pLastMmio->RamRange.GCPhys == GCPhys + cbRange || GCPhys == NIL_RTGCPHYS, pgmUnlock(pVM), VERR_INVALID_PARAMETER);
     3579        AssertReturnStmt(pLastMmio->fFlags & PGMREGMMIO2RANGE_F_MAPPED, PGM_UNLOCK(pVM), VERR_WRONG_ORDER);
     3580        AssertReturnStmt(pLastMmio->RamRange.GCPhys == GCPhys + cbRange || GCPhys == NIL_RTGCPHYS, PGM_UNLOCK(pVM), VERR_INVALID_PARAMETER);
    35813581        Assert(pLastMmio->pDevInsR3 == pFirstMmio->pDevInsR3);
    35823582        Assert(pLastMmio->iSubDev   == pFirstMmio->iSubDev);
     
    35923592
    35933593    uint16_t const fOldFlags = pFirstMmio->fFlags;
    3594     AssertReturnStmt(fOldFlags & PGMREGMMIO2RANGE_F_MAPPED, pgmUnlock(pVM), VERR_WRONG_ORDER);
     3594    AssertReturnStmt(fOldFlags & PGMREGMMIO2RANGE_F_MAPPED, PGM_UNLOCK(pVM), VERR_WRONG_ORDER);
    35953595
    35963596    /*
     
    36033603        PPGMREGMMIO2RANGE pCurMmio = pFirstMmio;
    36043604        rc = pgmHandlerPhysicalExDeregister(pVM, pFirstMmio->pPhysHandlerR3, RT_BOOL(fOldFlags & PGMREGMMIO2RANGE_F_OVERLAPPING));
    3605         AssertRCReturnStmt(rc, pgmUnlock(pVM), rc);
     3605        AssertRCReturnStmt(rc, PGM_UNLOCK(pVM), rc);
    36063606        while (!(pCurMmio->fFlags & PGMREGMMIO2RANGE_F_LAST_CHUNK))
    36073607        {
    36083608            pCurMmio = pCurMmio->pNextR3;
    36093609            rc = pgmHandlerPhysicalExDeregister(pVM, pCurMmio->pPhysHandlerR3, RT_BOOL(fOldFlags & PGMREGMMIO2RANGE_F_OVERLAPPING));
    3610             AssertRCReturnStmt(rc, pgmUnlock(pVM), VERR_PGM_PHYS_MMIO_EX_IPE);
     3610            AssertRCReturnStmt(rc, PGM_UNLOCK(pVM), VERR_PGM_PHYS_MMIO_EX_IPE);
    36113611        }
    36123612    }
     
    36863686    rc = NEMR3NotifyPhysMmioExUnmap(pVM, GCPhysRangeNotify, cbRange, fNemFlags);
    36873687
    3688     pgmUnlock(pVM);
     3688    PGM_UNLOCK(pVM);
    36893689    return rc;
    36903690}
     
    37233723                          VERR_VM_INVALID_VM_STATE);
    37243724
    3725     int rc = pgmLock(pVM);
     3725    int rc = PGM_LOCK(pVM);
    37263726    AssertRCReturn(rc, rc);
    37273727
     
    37623762        rc = VERR_NOT_FOUND;
    37633763
    3764     pgmUnlock(pVM);
     3764    PGM_UNLOCK(pVM);
    37653765    return rc;
    37663766}
     
    37863786     * Just do this the simple way.  No need for locking as this is only taken at
    37873787     */
    3788     pgmLock(pVM);
     3788    PGM_LOCK_VOID(pVM);
    37893789    PPGMREGMMIO2RANGE pFirstMmio = pgmR3PhysMmio2Find(pVM, pDevIns, UINT32_MAX, UINT32_MAX, hMmio2);
    3790     pgmUnlock(pVM);
     3790    PGM_UNLOCK(pVM);
    37913791    AssertReturn(pFirstMmio, VERR_INVALID_HANDLE);
    37923792    AssertReturn(pFirstMmio->fFlags & PGMREGMMIO2RANGE_F_MMIO2, VERR_INVALID_HANDLE);
     
    38223822    AssertReturn(iRegion <= UINT8_MAX, VERR_INVALID_PARAMETER);
    38233823
    3824     pgmLock(pVM);
     3824    PGM_LOCK_VOID(pVM);
    38253825    PPGMREGMMIO2RANGE pCurMmio = pgmR3PhysMmio2Find(pVM, pDevIns, iSubDev, iRegion, NIL_PGMMMIO2HANDLE);
    38263826    AssertReturn(pCurMmio, VERR_NOT_FOUND);
     
    38373837    PCPGMPAGE pPage = &pCurMmio->RamRange.aPages[off >> PAGE_SHIFT];
    38383838    *pHCPhys = PGM_PAGE_GET_HCPHYS(pPage);
    3839     pgmUnlock(pVM);
     3839    PGM_UNLOCK(pVM);
    38403840    return VINF_SUCCESS;
    38413841}
     
    38923892    AssertReturn(pVM->enmVMState == VMSTATE_LOADING, VERR_INVALID_STATE);
    38933893
    3894     int rc = pgmLock(pVM);
     3894    int rc = PGM_LOCK(pVM);
    38953895    AssertRCReturn(rc, rc);
    38963896
    38973897    PPGMREGMMIO2RANGE pFirstRegMmio = pgmR3PhysMmio2Find(pVM, pDevIns, UINT32_MAX, UINT32_MAX, hMmio2);
    3898     AssertReturnStmt(pFirstRegMmio, pgmUnlock(pVM), VERR_NOT_FOUND);
     3898    AssertReturnStmt(pFirstRegMmio, PGM_UNLOCK(pVM), VERR_NOT_FOUND);
    38993899    AssertReturnStmt(pgmR3PhysMmio2Find(pVM, pDevIns, pFirstRegMmio->iSubDev, iNewRegion, NIL_PGMMMIO2HANDLE) == NULL,
    3900                      pgmUnlock(pVM), VERR_RESOURCE_IN_USE);
     3900                     PGM_UNLOCK(pVM), VERR_RESOURCE_IN_USE);
    39013901
    39023902    /*
     
    39053905    pFirstRegMmio->iRegion = (uint8_t)iNewRegion;
    39063906
    3907     pgmUnlock(pVM);
     3907    PGM_UNLOCK(pVM);
    39083908    return VINF_SUCCESS;
    39093909}
     
    42724272    Log(("PGMR3PhysRomRegister: pDevIns=%p GCPhys=%RGp(-%RGp) cb=%RGp pvBinary=%p cbBinary=%#x fFlags=%#x pszDesc=%s\n",
    42734273         pDevIns, GCPhys, GCPhys + cb, cb, pvBinary, cbBinary, fFlags, pszDesc));
    4274     pgmLock(pVM);
     4274    PGM_LOCK_VOID(pVM);
    42754275    int rc = pgmR3PhysRomRegisterLocked(pVM, pDevIns, GCPhys, cb, pvBinary, cbBinary, fFlags, pszDesc);
    4276     pgmUnlock(pVM);
     4276    PGM_UNLOCK(pVM);
    42774277    return rc;
    42784278}
     
    44564456     * Process the request.
    44574457     */
    4458     pgmLock(pVM);
     4458    PGM_LOCK_VOID(pVM);
    44594459    int  rc = VINF_SUCCESS;
    44604460    bool fFlushTLB = false;
     
    45174517                if (RT_FAILURE(rc2))
    45184518                {
    4519                     pgmUnlock(pVM);
     4519                    PGM_UNLOCK(pVM);
    45204520                    AssertRC(rc);
    45214521                    return rc2;
     
    45274527        }
    45284528    }
    4529     pgmUnlock(pVM);
     4529    PGM_UNLOCK(pVM);
    45304530    if (fFlushTLB)
    45314531        PGM_INVL_ALL_VCPU_TLBS(pVM);
     
    47044704{
    47054705    int rc = VINF_SUCCESS;
    4706     pgmLock(pVM);
     4706    PGM_LOCK_VOID(pVM);
    47074707    NOREF(pVCpu); NOREF(pvUser);
    47084708
     
    47774777        }
    47784778    }
    4779     pgmUnlock(pVM);
     4779    PGM_UNLOCK(pVM);
    47804780    return rc;
    47814781}
     
    49334933    int rc;
    49344934
    4935     pgmLock(pVM);
     4935    PGM_LOCK_VOID(pVM);
    49364936    rc = pgmR3PhysChunkMap(pVM, idChunk, &pChunk);
    4937     pgmUnlock(pVM);
     4937    PGM_UNLOCK(pVM);
    49384938    return rc;
    49394939}
     
    49474947VMMR3DECL(void) PGMR3PhysChunkInvalidateTLB(PVM pVM)
    49484948{
    4949     pgmLock(pVM);
     4949    PGM_LOCK_VOID(pVM);
    49504950    for (unsigned i = 0; i < RT_ELEMENTS(pVM->pgm.s.ChunkR3Map.Tlb.aEntries); i++)
    49514951    {
     
    49554955    /* The page map TLB references chunks, so invalidate that one too. */
    49564956    pgmPhysInvalidatePageMapTLB(pVM);
    4957     pgmUnlock(pVM);
     4957    PGM_UNLOCK(pVM);
    49584958}
    49594959
     
    49754975    uint64_t u64TimeStamp1, u64TimeStamp2;
    49764976
    4977     pgmLock(pVM);
     4977    PGM_LOCK_VOID(pVM);
    49784978
    49794979    STAM_PROFILE_START(&pVM->pgm.s.CTX_SUFF(pStats)->StatAllocLargePage, a);
     
    50725072    }
    50735073
    5074     pgmUnlock(pVM);
     5074    PGM_UNLOCK(pVM);
    50755075    return rc;
    50765076#else
     
    51025102VMMR3DECL(int) PGMR3PhysAllocateHandyPages(PVM pVM)
    51035103{
    5104     pgmLock(pVM);
     5104    PGM_LOCK_VOID(pVM);
    51055105
    51065106    /*
     
    52515251    }
    52525252
    5253     pgmUnlock(pVM);
     5253    PGM_UNLOCK(pVM);
    52545254    return rc;
    52555255}
     
    54065406VMMR3DECL(int) PGMR3PhysTlbGCPhys2Ptr(PVM pVM, RTGCPHYS GCPhys, bool fWritable, void **ppv)
    54075407{
    5408     pgmLock(pVM);
     5408    PGM_LOCK_VOID(pVM);
    54095409    PGM_A20_ASSERT_MASKED(VMMGetCpu(pVM), GCPhys);
    54105410
     
    54825482        rc = VERR_PGM_PHYS_TLB_UNASSIGNED;
    54835483
    5484     pgmUnlock(pVM);
     5484    PGM_UNLOCK(pVM);
    54855485    return rc;
    54865486}
  • trunk/src/VBox/VMM/VMMR3/PGMPool.cpp

    r86497 r90439  
    514514    NOREF(pVCpu);
    515515
    516     pgmLock(pVM);
     516    PGM_LOCK_VOID(pVM);
    517517    Log(("pgmR3PoolClearAllRendezvous: cUsedPages=%d fpvFlushRemTlb=%RTbool\n", pPool->cUsedPages, !!fpvFlushRemTlb));
    518518
     
    729729    VM_FF_CLEAR(pVM, VM_FF_PGM_POOL_FLUSH_PENDING);
    730730    pPool->cPresent = 0;
    731     pgmUnlock(pVM);
     731    PGM_UNLOCK(pVM);
    732732
    733733    PGM_INVL_ALL_VCPU_TLBS(pVM);
  • trunk/src/VBox/VMM/VMMR3/PGMSavedState.cpp

    r86473 r90439  
    237237     * Initialize the live save tracking in the ROM page descriptors.
    238238     */
    239     pgmLock(pVM);
     239    PGM_LOCK_VOID(pVM);
    240240    for (PPGMROMRANGE pRom = pVM->pgm.s.pRomRangesR3; pRom; pRom = pRom->pNextR3)
    241241    {
     
    271271            pVM->pgm.s.LiveSave.Rom.cDirtyPages += cPages;
    272272    }
    273     pgmUnlock(pVM);
     273    PGM_UNLOCK(pVM);
    274274
    275275    return VINF_SUCCESS;
     
    286286static int pgmR3SaveRomRanges(PVM pVM, PSSMHANDLE pSSM)
    287287{
    288     pgmLock(pVM);
     288    PGM_LOCK_VOID(pVM);
    289289    uint8_t id = 1;
    290290    for (PPGMROMRANGE pRom = pVM->pgm.s.pRomRangesR3; pRom; pRom = pRom->pNextR3, id++)
     
    301301            break;
    302302    }
    303     pgmUnlock(pVM);
     303    PGM_UNLOCK(pVM);
    304304    return SSMR3PutU8(pSSM, UINT8_MAX);
    305305}
     
    402402     * The shadow ROMs.
    403403     */
    404     pgmLock(pVM);
     404    PGM_LOCK_VOID(pVM);
    405405    for (PPGMROMRANGE pRom = pVM->pgm.s.pRomRangesR3; pRom; pRom = pRom->pNextR3)
    406406    {
     
    427427        }
    428428    }
    429     pgmUnlock(pVM);
     429    PGM_UNLOCK(pVM);
    430430}
    431431
     
    444444static int pgmR3SaveRomVirginPages(PVM pVM, PSSMHANDLE pSSM, bool fLiveSave)
    445445{
    446     pgmLock(pVM);
     446    PGM_LOCK_VOID(pVM);
    447447    for (PPGMROMRANGE pRom = pVM->pgm.s.pRomRangesR3; pRom; pRom = pRom->pNextR3)
    448448    {
     
    473473            else
    474474                ASMMemZeroPage(abPage);
    475             pgmUnlock(pVM);
     475            PGM_UNLOCK(pVM);
    476476            AssertLogRelMsgRCReturn(rc, ("rc=%Rrc GCPhys=%RGp\n", rc, GCPhys), rc);
    477477
     
    491491
    492492            /* Update state. */
    493             pgmLock(pVM);
     493            PGM_LOCK_VOID(pVM);
    494494            pRom->aPages[iPage].LiveSave.u8Prot = (uint8_t)enmProt;
    495495            if (fLiveSave)
     
    501501        }
    502502    }
    503     pgmUnlock(pVM);
     503    PGM_UNLOCK(pVM);
    504504    return VINF_SUCCESS;
    505505}
     
    525525     * ASSUMES that all the ROM ranges are mapped.
    526526     */
    527     pgmLock(pVM);
     527    PGM_LOCK_VOID(pVM);
    528528    for (PPGMROMRANGE pRom = pVM->pgm.s.pRomRangesR3; pRom; pRom = pRom->pNextR3)
    529529    {
     
    565565                        pVM->pgm.s.LiveSave.cSavedPages++;
    566566                    }
    567                     pgmUnlock(pVM);
     567                    PGM_UNLOCK(pVM);
    568568                    AssertLogRelMsgRCReturn(rc, ("rc=%Rrc GCPhys=%RGp\n", rc, GCPhys), rc);
    569569
     
    582582                        return rc;
    583583
    584                     pgmLock(pVM);
     584                    PGM_LOCK_VOID(pVM);
    585585                    iPrevPage = iPage;
    586586                }
     
    593593                    PGMROMPROT enmProt = pRomPage->enmProt;
    594594                    pRomPage->LiveSave.u8Prot = (uint8_t)enmProt;
    595                     pgmUnlock(pVM);
     595                    PGM_UNLOCK(pVM);
    596596
    597597                    if (iPage - 1U == iPrevPage && iPage > 0)
     
    607607                        return rc;
    608608
    609                     pgmLock(pVM);
     609                    PGM_LOCK_VOID(pVM);
    610610                    iPrevPage = iPage;
    611611                }
     
    613613        }
    614614    }
    615     pgmUnlock(pVM);
     615    PGM_UNLOCK(pVM);
    616616    return VINF_SUCCESS;
    617617}
     
    641641     * ASSUME nothing changes here.
    642642     */
    643     pgmLock(pVM);
     643    PGM_LOCK_VOID(pVM);
    644644    for (PPGMREGMMIO2RANGE pRegMmio = pVM->pgm.s.pRegMmioRangesR3; pRegMmio; pRegMmio = pRegMmio->pNextR3)
    645645    {
     
    647647        {
    648648            uint32_t const  cPages = pRegMmio->RamRange.cb >> PAGE_SHIFT;
    649             pgmUnlock(pVM);
     649            PGM_UNLOCK(pVM);
    650650
    651651            PPGMLIVESAVEMMIO2PAGE paLSPages = (PPGMLIVESAVEMMIO2PAGE)MMR3HeapAllocZ(pVM, MM_TAG_PGM, sizeof(PGMLIVESAVEMMIO2PAGE) * cPages);
     
    662662            }
    663663
    664             pgmLock(pVM);
     664            PGM_LOCK_VOID(pVM);
    665665            pRegMmio->paLSPages = paLSPages;
    666666            pVM->pgm.s.LiveSave.Mmio2.cDirtyPages += cPages;
    667667        }
    668668    }
    669     pgmUnlock(pVM);
     669    PGM_UNLOCK(pVM);
    670670    return VINF_SUCCESS;
    671671}
     
    681681static int pgmR3SaveMmio2Ranges(PVM pVM, PSSMHANDLE pSSM)
    682682{
    683     pgmLock(pVM);
     683    PGM_LOCK_VOID(pVM);
    684684    uint8_t id = 1;
    685685    for (PPGMREGMMIO2RANGE pRegMmio = pVM->pgm.s.pRegMmioRangesR3; pRegMmio; pRegMmio = pRegMmio->pNextR3)
     
    699699        }
    700700    }
    701     pgmUnlock(pVM);
     701    PGM_UNLOCK(pVM);
    702702    return SSMR3PutU8(pSSM, UINT8_MAX);
    703703}
     
    883883        return;
    884884
    885     pgmLock(pVM);                       /* paranoia */
     885    PGM_LOCK_VOID(pVM);                 /* paranoia */
    886886    for (PPGMREGMMIO2RANGE pRegMmio = pVM->pgm.s.pRegMmioRangesR3; pRegMmio; pRegMmio = pRegMmio->pNextR3)
    887887        if (pRegMmio->fFlags & PGMREGMMIO2RANGE_F_MMIO2)
     
    889889            PPGMLIVESAVEMMIO2PAGE paLSPages = pRegMmio->paLSPages;
    890890            uint32_t              cPages    = pRegMmio->RamRange.cb >> PAGE_SHIFT;
    891             pgmUnlock(pVM);
     891            PGM_UNLOCK(pVM);
    892892
    893893            for (uint32_t iPage = 0; iPage < cPages; iPage++)
     
    897897            }
    898898
    899             pgmLock(pVM);
    900         }
    901     pgmUnlock(pVM);
     899            PGM_LOCK_VOID(pVM);
     900        }
     901    PGM_UNLOCK(pVM);
    902902
    903903}
     
    924924         * The mop up round.
    925925         */
    926         pgmLock(pVM);
     926        PGM_LOCK_VOID(pVM);
    927927        for (PPGMREGMMIO2RANGE pRegMmio = pVM->pgm.s.pRegMmioRangesR3;
    928928             pRegMmio && RT_SUCCESS(rc);
     
    972972                }
    973973            }
    974         pgmUnlock(pVM);
     974        PGM_UNLOCK(pVM);
    975975    }
    976976    /*
     
    982982             || (uPass & 3) == 2)
    983983    {
    984         pgmLock(pVM);
     984        PGM_LOCK_VOID(pVM);
    985985        for (PPGMREGMMIO2RANGE pRegMmio = pVM->pgm.s.pRegMmioRangesR3;
    986986             pRegMmio && RT_SUCCESS(rc);
     
    992992                uint32_t              cPages    = pRegMmio->RamRange.cb >> PAGE_SHIFT;
    993993                uint32_t              iPageLast = cPages;
    994                 pgmUnlock(pVM);
     994                PGM_UNLOCK(pVM);
    995995
    996996                for (uint32_t iPage = 0; iPage < cPages; iPage++, pbPage += PAGE_SIZE)
     
    10371037                }
    10381038
    1039                 pgmLock(pVM);
    1040             }
    1041         pgmUnlock(pVM);
     1039                PGM_LOCK_VOID(pVM);
     1040            }
     1041        PGM_UNLOCK(pVM);
    10421042    }
    10431043
     
    10571057     * We do the freeing outside the lock in case the VM is running.
    10581058     */
    1059     pgmLock(pVM);
     1059    PGM_LOCK_VOID(pVM);
    10601060    for (PPGMREGMMIO2RANGE pRegMmio = pVM->pgm.s.pRegMmioRangesR3; pRegMmio; pRegMmio = pRegMmio->pNextR3)
    10611061        if (pRegMmio->fFlags & PGMREGMMIO2RANGE_F_MMIO2)
     
    10651065            {
    10661066                pRegMmio->paLSPages = NULL;
    1067                 pgmUnlock(pVM);
     1067                PGM_UNLOCK(pVM);
    10681068                MMR3HeapFree(pvMmio2ToFree);
    1069                 pgmLock(pVM);
    1070             }
    1071         }
    1072     pgmUnlock(pVM);
     1069                PGM_LOCK_VOID(pVM);
     1070            }
     1071        }
     1072    PGM_UNLOCK(pVM);
    10731073}
    10741074
     
    10941094     */
    10951095    PPGMRAMRANGE pCur;
    1096     pgmLock(pVM);
     1096    PGM_LOCK_VOID(pVM);
    10971097    do
    10981098    {
     
    11041104                uint32_t const  idRamRangesGen = pVM->pgm.s.idRamRangesGen;
    11051105                uint32_t const  cPages = pCur->cb >> PAGE_SHIFT;
    1106                 pgmUnlock(pVM);
     1106                PGM_UNLOCK(pVM);
    11071107                PPGMLIVESAVERAMPAGE paLSPages = (PPGMLIVESAVERAMPAGE)MMR3HeapAllocZ(pVM, MM_TAG_PGM, cPages * sizeof(PGMLIVESAVERAMPAGE));
    11081108                if (!paLSPages)
    11091109                    return VERR_NO_MEMORY;
    1110                 pgmLock(pVM);
     1110                PGM_LOCK_VOID(pVM);
    11111111                if (pVM->pgm.s.idRamRangesGen != idRamRangesGen)
    11121112                {
    1113                     pgmUnlock(pVM);
     1113                    PGM_UNLOCK(pVM);
    11141114                    MMR3HeapFree(paLSPages);
    1115                     pgmLock(pVM);
     1115                    PGM_LOCK_VOID(pVM);
    11161116                    break;              /* try again */
    11171117                }
     
    12081208        }
    12091209    } while (pCur);
    1210     pgmUnlock(pVM);
     1210    PGM_UNLOCK(pVM);
    12111211
    12121212    return VINF_SUCCESS;
     
    13591359    RTGCPHYS GCPhysCur = 0;
    13601360    PPGMRAMRANGE pCur;
    1361     pgmLock(pVM);
     1361    PGM_LOCK_VOID(pVM);
    13621362    do
    13631363    {
     
    15491549        } /* for each range */
    15501550    } while (pCur);
    1551     pgmUnlock(pVM);
     1551    PGM_UNLOCK(pVM);
    15521552}
    15531553
     
    15731573    PPGMRAMRANGE pCur;
    15741574
    1575     pgmLock(pVM);
     1575    PGM_LOCK_VOID(pVM);
    15761576    do
    15771577    {
     
    16681668                            pgmPhysReleaseInternalPageMappingLock(pVM, &PgMpLck);
    16691669                        }
    1670                         pgmUnlock(pVM);
     1670                        PGM_UNLOCK(pVM);
    16711671                        AssertLogRelMsgRCReturn(rc, ("rc=%Rrc GCPhys=%RGp\n", rc, GCPhys), rc);
    16721672
     
    17031703                            pgmR3StateVerifyCrc32ForRamPage(pVM, pCur, paLSPages, iPage, "save#2");
    17041704#endif
    1705                         pgmUnlock(pVM);
     1705                        PGM_UNLOCK(pVM);
    17061706
    17071707                        uint8_t u8RecType = fBallooned ? PGM_STATE_REC_RAM_BALLOONED : PGM_STATE_REC_RAM_ZERO;
     
    17171717                        return rc;
    17181718
    1719                     pgmLock(pVM);
     1719                    PGM_LOCK_VOID(pVM);
    17201720                    if (!fSkipped)
    17211721                        GCPhysLast = GCPhys;
     
    17441744    } while (pCur);
    17451745
    1746     pgmUnlock(pVM);
     1746    PGM_UNLOCK(pVM);
    17471747
    17481748    return VINF_SUCCESS;
     
    17681768    PPGMRAMRANGE pCur;
    17691769    uint32_t cMonitoredPages = 0;
    1770     pgmLock(pVM);
     1770    PGM_LOCK_VOID(pVM);
    17711771    do
    17721772    {
     
    17781778                {
    17791779                    uint32_t idRamRangesGen = pVM->pgm.s.idRamRangesGen;
    1780                     pgmUnlock(pVM);
     1780                    PGM_UNLOCK(pVM);
    17811781                    MMR3HeapFree(pvToFree);
    17821782                    pvToFree = NULL;
    1783                     pgmLock(pVM);
     1783                    PGM_LOCK_VOID(pVM);
    17841784                    if (idRamRangesGen != pVM->pgm.s.idRamRangesGen)
    17851785                        break;          /* start over again. */
     
    18101810        pVM->pgm.s.cMonitoredPages -= cMonitoredPages;
    18111811
    1812     pgmUnlock(pVM);
     1812    PGM_UNLOCK(pVM);
    18131813
    18141814    MMR3HeapFree(pvToFree);
     
    18871887
    18881888    /* update history. */
    1889     pgmLock(pVM);
     1889    PGM_LOCK_VOID(pVM);
    18901890    uint32_t const cWrittenToPages = pVM->pgm.s.cWrittenToPages;
    1891     pgmUnlock(pVM);
     1891    PGM_UNLOCK(pVM);
    18921892    uint32_t const cDirtyNow = pVM->pgm.s.LiveSave.Rom.cDirtyPages
    18931893                             + pVM->pgm.s.LiveSave.Mmio2.cDirtyPages
     
    19911991     * Indicate that we will be using the write monitoring.
    19921992     */
    1993     pgmLock(pVM);
     1993    PGM_LOCK_VOID(pVM);
    19941994    /** @todo find a way of mediating this when more users are added. */
    19951995    if (pVM->pgm.s.fPhysWriteMonitoringEngaged)
    19961996    {
    1997         pgmUnlock(pVM);
     1997        PGM_UNLOCK(pVM);
    19981998        AssertLogRelFailedReturn(VERR_PGM_WRITE_MONITOR_ENGAGED);
    19991999    }
    20002000    pVM->pgm.s.fPhysWriteMonitoringEngaged = true;
    2001     pgmUnlock(pVM);
     2001    PGM_UNLOCK(pVM);
    20022002
    20032003    /*
     
    20442044     * Lock PGM and set the no-more-writes indicator.
    20452045     */
    2046     pgmLock(pVM);
     2046    PGM_LOCK_VOID(pVM);
    20472047    pVM->pgm.s.fNoMorePhysWrites = true;
    20482048
     
    20942094    }
    20952095
    2096     pgmUnlock(pVM);
     2096    PGM_UNLOCK(pVM);
    20972097    return rc;
    20982098}
     
    21172117     * Clear the live save indicator and disengage write monitoring.
    21182118     */
    2119     pgmLock(pVM);
     2119    PGM_LOCK_VOID(pVM);
    21202120    pVM->pgm.s.LiveSave.fActive = false;
    21212121    /** @todo this is blindly assuming that we're the only user of write
    21222122     *        monitoring. Fix this when more users are added. */
    21232123    pVM->pgm.s.fPhysWriteMonitoringEngaged = false;
    2124     pgmUnlock(pVM);
     2124    PGM_UNLOCK(pVM);
    21252125
    21262126    NOREF(pSSM);
     
    31483148    if (uPass != SSM_PASS_FINAL)
    31493149    {
    3150         pgmLock(pVM);
     3150        PGM_LOCK_VOID(pVM);
    31513151        if (uPass != 0)
    31523152            rc = pgmR3LoadMemory(pVM, pSSM, uVersion, uPass);
     
    31653165                rc = pgmR3LoadMemory(pVM, pSSM, uVersion, uPass);
    31663166        }
    3167         pgmUnlock(pVM);
     3167        PGM_UNLOCK(pVM);
    31683168    }
    31693169    else
    31703170    {
    3171         pgmLock(pVM);
     3171        PGM_LOCK_VOID(pVM);
    31723172        rc = pgmR3LoadFinalLocked(pVM, pSSM, uVersion);
    31733173        pVM->pgm.s.LiveSave.fActive = false;
    3174         pgmUnlock(pVM);
     3174        PGM_UNLOCK(pVM);
    31753175        if (RT_SUCCESS(rc))
    31763176        {
  • trunk/src/VBox/VMM/VMMR3/PGMSharedPage.cpp

    r86473 r90439  
    232232    LogFlow(("pgmR3SharedModuleRegRendezvous: start (%d)\n", pVM->pgm.s.cSharedPages));
    233233
    234     pgmLock(pVM);
     234    PGM_LOCK_VOID(pVM);
    235235    pgmR3PhysAssertSharedPageChecksums(pVM);
    236236    rc = GMMR3CheckSharedModules(pVM);
    237237    pgmR3PhysAssertSharedPageChecksums(pVM);
    238     pgmUnlock(pVM);
     238    PGM_UNLOCK(pVM);
    239239    AssertLogRelRC(rc);
    240240
     
    291291    uint64_t fFlags;
    292292
    293     pgmLock(pVM);
     293    PGM_LOCK_VOID(pVM);
    294294
    295295    int rc = PGMGstGetPage(VMMGetCpu(pVM), GCPtrPage, &fFlags, &GCPhys);
     
    322322    }
    323323
    324     pgmUnlock(pVM);
     324    PGM_UNLOCK(pVM);
    325325    return rc;
    326326}
     
    345345    VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);
    346346
    347     pgmLock(pVM);
     347    PGM_LOCK_VOID(pVM);
    348348
    349349    for (PPGMRAMRANGE pRam = pVM->pgm.s.pRamRangesXR3; pRam; pRam = pRam->pNextR3)
     
    404404        }
    405405    }
    406     pgmUnlock(pVM);
     406    PGM_UNLOCK(pVM);
    407407
    408408    pCmdHlp->pfnPrintf(pCmdHlp, NULL, "\nNumber of zero pages      %08x (%d MB)\n", cZero, cZero / 256);
     
    425425    VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);
    426426
    427     pgmLock(pVM);
     427    PGM_LOCK_VOID(pVM);
    428428    for (unsigned i = 0; i < RT_ELEMENTS(g_apSharedModules); i++)
    429429    {
     
    435435        }
    436436    }
    437     pgmUnlock(pVM);
     437    PGM_UNLOCK(pVM);
    438438
    439439    return VINF_SUCCESS;
  • trunk/src/VBox/VMM/include/PGMInternal.h

    r90346 r90439  
    38973897RT_C_DECLS_BEGIN
    38983898
    3899 #if defined(VBOX_STRICT) && defined(IN_RING3)
    3900 int             pgmLockDebug(PVMCC pVM, RT_SRC_POS_DECL);
    3901 # define pgmLock(a_pVM) pgmLockDebug(a_pVM, RT_SRC_POS)
     3899#if defined(VBOX_STRICT)
     3900int             pgmLockDebug(PVMCC pVM, bool fVoid, RT_SRC_POS_DECL);
     3901# define PGM_LOCK_VOID(a_pVM)       pgmLockDebug((a_pVM), true,  RT_SRC_POS)
     3902# define PGM_LOCK(a_pVM)            pgmLockDebug((a_pVM), false, RT_SRC_POS)
    39023903#else
    3903 int             pgmLock(PVMCC pVM);
     3904int             pgmLock(PVMCC pVM, bool fVoid);
     3905# define PGM_LOCK_VOID(a_pVM)       pgmLock((a_pVM), true)
     3906# define PGM_LOCK(a_pVM)            pgmLock((a_pVM), false)
    39043907#endif
    39053908void            pgmUnlock(PVMCC pVM);
     3909# define PGM_UNLOCK(a_pVM)          pgmUnlock((a_pVM))
    39063910/**
    39073911 * Asserts that the caller owns the PDM lock.
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