VirtualBox

Changeset 90346 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Jul 26, 2021 7:55:53 PM (4 years ago)
Author:
vboxsync
Message:
  • VMM: Pass pVM to PDMCritSect APIs. bugref:9218 bugref:10074
  • DrvNetShaper: Do bandwidth allocation via PDMDrvHlp. bugref:10074
Location:
trunk/src/VBox/VMM
Files:
33 edited

Legend:

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

    r82968 r90346  
    108108         * Call the device.
    109109         */
    110         VBOXSTRICTRC rcStrict = PDMCritSectEnter(pDevIns->CTX_SUFF(pCritSectRo), VINF_IOM_R3_IOPORT_READ);
     110        VBOXSTRICTRC rcStrict = PDMCritSectEnter(pVM, pDevIns->CTX_SUFF(pCritSectRo), VINF_IOM_R3_IOPORT_READ);
    111111        if (rcStrict == VINF_SUCCESS)
    112112        {
     
    114114            rcStrict = pfnInCallback(pDevIns, pvUser, fFlags & IOM_IOPORT_F_ABS ? Port : offPort, pu32Value, (unsigned)cbValue);
    115115            STAM_PROFILE_STOP(&pStats->CTX_SUFF_Z(ProfIn), a);
    116             PDMCritSectLeave(pDevIns->CTX_SUFF(pCritSectRo));
     116            PDMCritSectLeave(pVM, pDevIns->CTX_SUFF(pCritSectRo));
    117117
    118118#ifndef IN_RING3
     
    236236         * Call the device.
    237237         */
    238         VBOXSTRICTRC rcStrict = PDMCritSectEnter(pDevIns->CTX_SUFF(pCritSectRo), VINF_IOM_R3_IOPORT_READ);
     238        VBOXSTRICTRC rcStrict = PDMCritSectEnter(pVM, pDevIns->CTX_SUFF(pCritSectRo), VINF_IOM_R3_IOPORT_READ);
    239239        if (rcStrict == VINF_SUCCESS)
    240240        {
     
    282282                         && rcStrict == VINF_SUCCESS);
    283283            }
    284             PDMCritSectLeave(pDevIns->CTX_SUFF(pCritSectRo));
     284            PDMCritSectLeave(pVM, pDevIns->CTX_SUFF(pCritSectRo));
    285285
    286286#ifdef VBOX_WITH_STATISTICS
     
    408408         * Call the device.
    409409         */
    410         VBOXSTRICTRC rcStrict = PDMCritSectEnter(pDevIns->CTX_SUFF(pCritSectRo), VINF_IOM_R3_IOPORT_WRITE);
     410        VBOXSTRICTRC rcStrict = PDMCritSectEnter(pVM, pDevIns->CTX_SUFF(pCritSectRo), VINF_IOM_R3_IOPORT_WRITE);
    411411        if (rcStrict == VINF_SUCCESS)
    412412        {
     
    415415            STAM_PROFILE_STOP(&pStats->CTX_SUFF_Z(ProfOut), a);
    416416
    417             PDMCritSectLeave(pDevIns->CTX_SUFF(pCritSectRo));
     417            PDMCritSectLeave(pVM, pDevIns->CTX_SUFF(pCritSectRo));
    418418
    419419#ifdef VBOX_WITH_STATISTICS
     
    522522         * Call the device.
    523523         */
    524         VBOXSTRICTRC rcStrict = PDMCritSectEnter(pDevIns->CTX_SUFF(pCritSectRo), VINF_IOM_R3_IOPORT_WRITE);
     524        VBOXSTRICTRC rcStrict = PDMCritSectEnter(pVM, pDevIns->CTX_SUFF(pCritSectRo), VINF_IOM_R3_IOPORT_WRITE);
    525525        if (rcStrict == VINF_SUCCESS)
    526526        {
     
    562562            }
    563563
    564             PDMCritSectLeave(pDevIns->CTX_SUFF(pCritSectRo));
     564            PDMCritSectLeave(pVM, pDevIns->CTX_SUFF(pCritSectRo));
    565565
    566566#ifdef VBOX_WITH_STATISTICS
  • trunk/src/VBox/VMM/VMMAll/IOMAllMmioNew.cpp

    r82968 r90346  
    368368# endif
    369369    PPDMDEVINS const         pDevIns = pRegEntry->pDevIns;
    370     int rc = PDMCritSectEnter(pDevIns->CTX_SUFF(pCritSectRo), VERR_IGNORED);
     370    int rc = PDMCritSectEnter(pVM, pDevIns->CTX_SUFF(pCritSectRo), VERR_IGNORED);
    371371    AssertRCReturn(rc, rc);
    372372
     
    375375                                           IOM_MMIO_STATS_COMMA_ARG);
    376376
    377     PDMCritSectLeave(pDevIns->CTX_SUFF(pCritSectRo));
     377    PDMCritSectLeave(pVM, pDevIns->CTX_SUFF(pCritSectRo));
    378378    STAM_PROFILE_STOP(&pStats->ProfWriteR3, Prf);
    379379    return rcStrict;
     
    670670         * Note! Perhaps not a good move?
    671671         */
    672         rcStrict = PDMCritSectEnter(pDevIns->CTX_SUFF(pCritSectRo), VINF_IOM_R3_MMIO_READ_WRITE);
     672        rcStrict = PDMCritSectEnter(pVM, pDevIns->CTX_SUFF(pCritSectRo), VINF_IOM_R3_MMIO_READ_WRITE);
    673673        if (rcStrict == VINF_SUCCESS)
    674674        {
     
    681681
    682682#ifndef IN_RING3
    683             PDMCritSectLeave(pDevIns->CTX_SUFF(pCritSectRo));
     683            PDMCritSectLeave(pVM, pDevIns->CTX_SUFF(pCritSectRo));
    684684#endif
    685685            if (RT_SUCCESS(rcStrict))
     
    910910     *       NULL.  This is supposed to be an unlikely case, so not optimized yet.
    911911     */
    912     VBOXSTRICTRC rcStrict = PDMCritSectEnter(pDevIns->CTX_SUFF(pCritSectRo), rcToRing3);
     912    VBOXSTRICTRC rcStrict = PDMCritSectEnter(pVM, pDevIns->CTX_SUFF(pCritSectRo), rcToRing3);
    913913    if (rcStrict == VINF_SUCCESS)
    914914    {
     
    920920            rcStrict = iomMmioDoRead(pVM, pRegEntry, GCPhysFault, offRegion, pvBuf, (uint32_t)cbBuf IOM_MMIO_STATS_COMMA_ARG);
    921921
    922             PDMCritSectLeave(pDevIns->CTX_SUFF(pCritSectRo));
     922            PDMCritSectLeave(pVM, pDevIns->CTX_SUFF(pCritSectRo));
    923923#ifndef IN_RING3
    924924            if (rcStrict == VINF_IOM_R3_MMIO_READ)
     
    938938             */
    939939            rcStrict = iomMmioDoWrite(pVM, pVCpu, pRegEntry, GCPhysFault, offRegion, pvBuf, (uint32_t)cbBuf IOM_MMIO_STATS_COMMA_ARG);
    940             PDMCritSectLeave(pDevIns->CTX_SUFF(pCritSectRo));
     940            PDMCritSectLeave(pVM, pDevIns->CTX_SUFF(pCritSectRo));
    941941#ifndef IN_RING3
    942942            if (rcStrict == VINF_IOM_R3_MMIO_WRITE)
  • trunk/src/VBox/VMM/VMMAll/MMAllHyper.cpp

    r82968 r90346  
    166166    Assert(PDMCritSectIsInitialized(&pHeap->Lock));
    167167#endif
    168     int rc = PDMCritSectEnter(&pHeap->Lock, VERR_SEM_BUSY);
     168    int rc = PDMCritSectEnter(pVM, &pHeap->Lock, VERR_SEM_BUSY);
    169169#ifdef IN_RING0
    170170    if (rc == VERR_SEM_BUSY)
     
    181181 * @param   pVM     The cross context VM structure.
    182182 */
    183 static void mmHyperUnlock(PVM pVM)
     183static void mmHyperUnlock(PVMCC pVM)
    184184{
    185185    PMMHYPERHEAP pHeap = pVM->mm.s.CTX_SUFF(pHyperHeap);
     
    190190#endif
    191191    Assert(PDMCritSectIsInitialized(&pHeap->Lock));
    192     PDMCritSectLeave(&pHeap->Lock);
     192    PDMCritSectLeave(pVM, &pHeap->Lock);
    193193}
    194194
  • trunk/src/VBox/VMM/VMMAll/PDMAll.cpp

    r89620 r90346  
    307307{
    308308#ifdef IN_RING3
    309     int rc = PDMCritSectEnter(&pVM->pdm.s.CritSect, VERR_IGNORED);
     309    int rc = PDMCritSectEnter(pVM, &pVM->pdm.s.CritSect, VERR_IGNORED);
    310310#else
    311     int rc = PDMCritSectEnter(&pVM->pdm.s.CritSect, VERR_GENERAL_FAILURE);
     311    int rc = PDMCritSectEnter(pVM, &pVM->pdm.s.CritSect, VERR_GENERAL_FAILURE);
    312312    if (rc == VERR_GENERAL_FAILURE)
    313313        rc = VMMRZCallRing3NoCpu(pVM, VMMCALLRING3_PDM_LOCK, 0);
     
    327327int pdmLockEx(PVMCC pVM, int rc)
    328328{
    329     return PDMCritSectEnter(&pVM->pdm.s.CritSect, rc);
     329    return PDMCritSectEnter(pVM, &pVM->pdm.s.CritSect, rc);
    330330}
    331331
     
    338338void pdmUnlock(PVMCC pVM)
    339339{
    340     PDMCritSectLeave(&pVM->pdm.s.CritSect);
     340    PDMCritSectLeave(pVM, &pVM->pdm.s.CritSect);
    341341}
    342342
     
    348348 * @param   pVM     The cross context VM structure.
    349349 */
    350 bool pdmLockIsOwner(PCVMCC pVM)
    351 {
    352     return PDMCritSectIsOwner(&pVM->pdm.s.CritSect);
     350bool pdmLockIsOwner(PVMCC pVM)
     351{
     352    return PDMCritSectIsOwner(pVM, &pVM->pdm.s.CritSect);
    353353}
    354354
  • trunk/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp

    r90329 r90346  
    6767 *
    6868 * @returns native thread handle (ring-3).
    69  * @param   pCritSect           The critical section. This is used in R0 and RC.
    70  */
    71 DECL_FORCE_INLINE(RTNATIVETHREAD) pdmCritSectGetNativeSelf(PCPDMCRITSECT pCritSect)
     69 * @param   pVM         The cross context VM structure.
     70 * @param   pCritSect   The critical section. This is used in R0 and RC.
     71 */
     72DECL_FORCE_INLINE(RTNATIVETHREAD) pdmCritSectGetNativeSelf(PVMCC pVM, PCPDMCRITSECT pCritSect)
    7273{
    7374#ifdef IN_RING3
    74     NOREF(pCritSect);
     75    RT_NOREF(pVM, pCritSect);
    7576    RTNATIVETHREAD  hNativeSelf = RTThreadNativeSelf();
    7677#else
    7778    AssertMsgReturn(pCritSect->s.Core.u32Magic == RTCRITSECT_MAGIC, ("%RX32\n", pCritSect->s.Core.u32Magic),
    7879                    NIL_RTNATIVETHREAD);
    79     PVMCC           pVM         = pCritSect->s.CTX_SUFF(pVM); AssertPtr(pVM);
    80     PVMCPUCC        pVCpu       = VMMGetCpu(pVM);             AssertPtr(pVCpu);
    81     RTNATIVETHREAD  hNativeSelf = pVCpu->hNativeThread;       Assert(hNativeSelf != NIL_RTNATIVETHREAD);
     80    PVMCPUCC        pVCpu       = VMMGetCpu(pVM);                                       AssertPtr(pVCpu);
     81    RTNATIVETHREAD  hNativeSelf = pVCpu ? pVCpu->hNativeThread : NIL_RTNATIVETHREAD;    Assert(hNativeSelf != NIL_RTNATIVETHREAD);
    8282#endif
    8383    return hNativeSelf;
     
    125125 * @retval  VERR_SEM_DESTROYED if destroyed.
    126126 *
     127 * @param   pVM                 The cross context VM structure.
    127128 * @param   pCritSect           The critsect.
    128129 * @param   hNativeSelf         The native thread handle.
    129130 * @param   pSrcPos             The source position of the lock operation.
    130131 */
    131 static int pdmR3R0CritSectEnterContended(PPDMCRITSECT pCritSect, RTNATIVETHREAD hNativeSelf, PCRTLOCKVALSRCPOS pSrcPos)
     132static int pdmR3R0CritSectEnterContended(PVMCC pVM, PPDMCRITSECT pCritSect, RTNATIVETHREAD hNativeSelf, PCRTLOCKVALSRCPOS pSrcPos)
    132133{
    133134    /*
     
    201202                 it without creating a race with PDMCritSectLeave, resulting in
    202203                 spurious wakeups. */
    203         PVMCC     pVM   = pCritSect->s.CTX_SUFF(pVM); AssertPtr(pVM);
    204         PVMCPUCC  pVCpu = VMMGetCpu(pVM);             AssertPtr(pVCpu);
     204        PVMCPUCC pVCpu = VMMGetCpu(pVM); AssertPtr(pVCpu);
    205205        rc = VMMRZCallRing3(pVM, pVCpu, VMMCALLRING3_VM_R0_PREEMPT, NULL);
    206206        AssertRC(rc);
     207# else
     208        RT_NOREF(pVM);
    207209# endif
    208210    }
     
    220222 *          during the operation.
    221223 *
     224 * @param   pVM                 The cross context VM structure.
    222225 * @param   pCritSect           The PDM critical section to enter.
    223226 * @param   rcBusy              The status code to return when we're in GC or R0
    224227 * @param   pSrcPos             The source position of the lock operation.
    225228 */
    226 DECL_FORCE_INLINE(int) pdmCritSectEnter(PPDMCRITSECT pCritSect, int rcBusy, PCRTLOCKVALSRCPOS pSrcPos)
     229DECL_FORCE_INLINE(int) pdmCritSectEnter(PVMCC pVM, PPDMCRITSECT pCritSect, int rcBusy, PCRTLOCKVALSRCPOS pSrcPos)
    227230{
    228231    Assert(pCritSect->s.Core.cNestings < 8);  /* useful to catch incorrect locking */
     
    245248        return VINF_SUCCESS;
    246249
    247     RTNATIVETHREAD hNativeSelf = pdmCritSectGetNativeSelf(pCritSect);
     250    Assert(pCritSect->s.CTX_SUFF(pVM) == pVM); RT_NOREF(pVM);
     251    RTNATIVETHREAD hNativeSelf = pdmCritSectGetNativeSelf(pVM, pCritSect);
    248252    /* ... not owned ... */
    249253    if (ASMAtomicCmpXchgS32(&pCritSect->s.Core.cLockers, 0, -1))
     
    286290     */
    287291    NOREF(rcBusy);
    288     return pdmR3R0CritSectEnterContended(pCritSect, hNativeSelf, pSrcPos);
     292    return pdmR3R0CritSectEnterContended(pVM, pCritSect, hNativeSelf, pSrcPos);
    289293
    290294#else
     
    320324        {
    321325            STAM_REL_COUNTER_ADD(&pCritSect->s.StatContentionRZLock,    1000000);
    322             rc = pdmR3R0CritSectEnterContended(pCritSect, hNativeSelf, pSrcPos);
     326            rc = pdmR3R0CritSectEnterContended(pVM, pCritSect, hNativeSelf, pSrcPos);
    323327        }
    324328        else
     
    330334            RTThreadPreemptRestore(NIL_RTTHREAD, XXX);
    331335
    332             rc = pdmR3R0CritSectEnterContended(pCritSect, hNativeSelf, pSrcPos);
     336            rc = pdmR3R0CritSectEnterContended(pVM, pCritSect, hNativeSelf, pSrcPos);
    333337
    334338            RTThreadPreemptDisable(NIL_RTTHREAD, XXX);
     
    343347    if (   RTThreadPreemptIsEnabled(NIL_RTTHREAD)
    344348        && ASMIntAreEnabled())
    345         return pdmR3R0CritSectEnterContended(pCritSect, hNativeSelf, pSrcPos);
     349        return pdmR3R0CritSectEnterContended(pVM, pCritSect, hNativeSelf, pSrcPos);
    346350#  endif
    347351# endif /* IN_RING0 */
     
    354358    if (rcBusy == VINF_SUCCESS)
    355359    {
    356         PVMCC     pVM   = pCritSect->s.CTX_SUFF(pVM); AssertPtr(pVM);
    357         PVMCPUCC  pVCpu = VMMGetCpu(pVM);             AssertPtr(pVCpu);
     360        PVMCPUCC pVCpu = VMMGetCpu(pVM);
     361        AssertReturn(pVCpu, VERR_PDM_CRITSECT_IPE);
    358362        return VMMRZCallRing3(pVM, pVCpu, VMMCALLRING3_PDM_CRIT_SECT_ENTER, MMHyperCCToR3(pVM, pCritSect));
    359363    }
     
    376380 *          during the operation.
    377381 *
     382 * @param   pVM                 The cross context VM structure.
    378383 * @param   pCritSect           The PDM critical section to enter.
    379384 * @param   rcBusy              The status code to return when we're in RC or R0
     
    382387 *                              call if necessary.
    383388 */
    384 VMMDECL(int) PDMCritSectEnter(PPDMCRITSECT pCritSect, int rcBusy)
     389VMMDECL(int) PDMCritSectEnter(PVMCC pVM, PPDMCRITSECT pCritSect, int rcBusy)
    385390{
    386391#ifndef PDMCRITSECT_STRICT
    387     return pdmCritSectEnter(pCritSect, rcBusy, NULL);
     392    return pdmCritSectEnter(pVM, pCritSect, rcBusy, NULL);
    388393#else
    389394    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API();
    390     return pdmCritSectEnter(pCritSect, rcBusy, &SrcPos);
     395    return pdmCritSectEnter(pVM, pCritSect, rcBusy, &SrcPos);
    391396#endif
    392397}
     
    401406 *          during the operation.
    402407 *
     408 * @param   pVM                 The cross context VM structure.
    403409 * @param   pCritSect           The PDM critical section to enter.
    404410 * @param   rcBusy              The status code to return when we're in RC or R0
     
    411417 *                              acquired from.  Optional.
    412418 */
    413 VMMDECL(int) PDMCritSectEnterDebug(PPDMCRITSECT pCritSect, int rcBusy, RTHCUINTPTR uId, RT_SRC_POS_DECL)
     419VMMDECL(int) PDMCritSectEnterDebug(PVMCC pVM, PPDMCRITSECT pCritSect, int rcBusy, RTHCUINTPTR uId, RT_SRC_POS_DECL)
    414420{
    415421#ifdef PDMCRITSECT_STRICT
    416422    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
    417     return pdmCritSectEnter(pCritSect, rcBusy, &SrcPos);
     423    return pdmCritSectEnter(pVM, pCritSect, rcBusy, &SrcPos);
    418424#else
    419425    NOREF(uId); RT_SRC_POS_NOREF();
    420     return pdmCritSectEnter(pCritSect, rcBusy, NULL);
     426    return pdmCritSectEnter(pVM, pCritSect, rcBusy, NULL);
    421427#endif
    422428}
     
    432438 *          during the operation.
    433439 *
     440 * @param   pVM         The cross context VM structure.
    434441 * @param   pCritSect   The critical section.
    435442 * @param   pSrcPos     The source position of the lock operation.
    436443 */
    437 static int pdmCritSectTryEnter(PPDMCRITSECT pCritSect, PCRTLOCKVALSRCPOS pSrcPos)
     444static int pdmCritSectTryEnter(PVMCC pVM, PPDMCRITSECT pCritSect, PCRTLOCKVALSRCPOS pSrcPos)
    438445{
    439446    /*
     
    453460        return VINF_SUCCESS;
    454461
    455     RTNATIVETHREAD hNativeSelf = pdmCritSectGetNativeSelf(pCritSect);
     462    Assert(pCritSect->s.CTX_SUFF(pVM) == pVM);
     463    RTNATIVETHREAD hNativeSelf = pdmCritSectGetNativeSelf(pVM, pCritSect);
    456464    /* ... not owned ... */
    457465    if (ASMAtomicCmpXchgS32(&pCritSect->s.Core.cLockers, 0, -1))
     
    495503 *          during the operation.
    496504 *
     505 * @param   pVM         The cross context VM structure.
    497506 * @param   pCritSect   The critical section.
    498507 */
    499 VMMDECL(int) PDMCritSectTryEnter(PPDMCRITSECT pCritSect)
     508VMMDECL(int) PDMCritSectTryEnter(PVMCC pVM, PPDMCRITSECT pCritSect)
    500509{
    501510#ifndef PDMCRITSECT_STRICT
    502     return pdmCritSectTryEnter(pCritSect, NULL);
     511    return pdmCritSectTryEnter(pVM, pCritSect, NULL);
    503512#else
    504513    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API();
    505     return pdmCritSectTryEnter(pCritSect, &SrcPos);
     514    return pdmCritSectTryEnter(pVM, pCritSect, &SrcPos);
    506515#endif
    507516}
     
    517526 *          during the operation.
    518527 *
     528 * @param   pVM                 The cross context VM structure.
    519529 * @param   pCritSect           The critical section.
    520530 * @param   uId                 Some kind of locking location ID.  Typically a
     
    523533 *                              acquired from.  Optional.
    524534 */
    525 VMMDECL(int) PDMCritSectTryEnterDebug(PPDMCRITSECT pCritSect, RTHCUINTPTR uId, RT_SRC_POS_DECL)
     535VMMDECL(int) PDMCritSectTryEnterDebug(PVMCC pVM, PPDMCRITSECT pCritSect, RTHCUINTPTR uId, RT_SRC_POS_DECL)
    526536{
    527537#ifdef PDMCRITSECT_STRICT
    528538    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
    529     return pdmCritSectTryEnter(pCritSect, &SrcPos);
     539    return pdmCritSectTryEnter(pVM, pCritSect, &SrcPos);
    530540#else
    531541    NOREF(uId); RT_SRC_POS_NOREF();
    532     return pdmCritSectTryEnter(pCritSect, NULL);
     542    return pdmCritSectTryEnter(pVM, pCritSect, NULL);
    533543#endif
    534544}
     
    544554 *          during the operation.
    545555 *
     556 * @param   pVM                 The cross context VM structure.
    546557 * @param   pCritSect           The PDM critical section to enter.
    547558 * @param   fCallRing3          Whether this is a VMMRZCallRing3()request.
    548559 */
    549 VMMR3DECL(int) PDMR3CritSectEnterEx(PPDMCRITSECT pCritSect, bool fCallRing3)
    550 {
    551     int rc = PDMCritSectEnter(pCritSect, VERR_IGNORED);
     560VMMR3DECL(int) PDMR3CritSectEnterEx(PVM pVM, PPDMCRITSECT pCritSect, bool fCallRing3)
     561{
     562    int rc = PDMCritSectEnter(pVM, pCritSect, VERR_IGNORED);
    552563    if (    rc == VINF_SUCCESS
    553564        &&  fCallRing3
     
    568579 * @retval  VERR_NOT_OWNER if you somehow ignore release assertions.
    569580 *
    570  * @param   pCritSect           The PDM critical section to leave.
    571  */
    572 VMMDECL(int) PDMCritSectLeave(PPDMCRITSECT pCritSect)
     581 * @param   pVM         The cross context VM structure.
     582 * @param   pCritSect   The PDM critical section to leave.
     583 */
     584VMMDECL(int) PDMCritSectLeave(PVMCC pVM, PPDMCRITSECT pCritSect)
    573585{
    574586    AssertMsg(pCritSect->s.Core.u32Magic == RTCRITSECT_MAGIC, ("%p %RX32\n", pCritSect, pCritSect->s.Core.u32Magic));
     
    584596     * Always check that the caller is the owner (screw performance).
    585597     */
    586     RTNATIVETHREAD const hNativeSelf = pdmCritSectGetNativeSelf(pCritSect);
     598    Assert(pCritSect->s.CTX_SUFF(pVM) == pVM); RT_NOREF(pVM);
     599    RTNATIVETHREAD const hNativeSelf = pdmCritSectGetNativeSelf(pVM, pCritSect);
    587600    AssertReleaseMsgReturn(pCritSect->s.Core.NativeThreadOwner == hNativeSelf,
    588601                           ("%p %s: %p != %p; cLockers=%d cNestings=%d\n", pCritSect, R3STRING(pCritSect->s.pszName),
     
    648661            /* Someone is waiting, wake up one of them. */
    649662            SUPSEMEVENT     hEvent   = (SUPSEMEVENT)pCritSect->s.Core.EventSem;
    650             PSUPDRVSESSION  pSession = pCritSect->s.CTX_SUFF(pVM)->pSession;
     663            PSUPDRVSESSION  pSession = pVM->pSession;
    651664            int rc = SUPSemEventSignal(pSession, hEvent);
    652665            AssertRC(rc);
     
    659672        {
    660673            Log8(("Signalling %#p\n", hEventToSignal));
    661             int rc = SUPSemEventSignal(pCritSect->s.CTX_SUFF(pVM)->pSession, hEventToSignal);
     674            int rc = SUPSemEventSignal(pVM->pSession, hEventToSignal);
    662675            AssertRC(rc);
    663676        }
     
    707720         * Queue the request.
    708721         */
    709         PVMCC       pVM   = pCritSect->s.CTX_SUFF(pVM);     AssertPtr(pVM);
    710722        PVMCPUCC    pVCpu = VMMGetCpu(pVM);                 AssertPtr(pVCpu);
    711723        uint32_t    i     = pVCpu->pdm.s.cQueuedCritSectLeaves++;
     
    762774 * @returns true if owner.
    763775 * @returns false if not owner.
     776 * @param   pVM         The cross context VM structure.
    764777 * @param   pCritSect   The critical section.
    765778 */
    766 VMMDECL(bool) PDMCritSectIsOwner(PCPDMCRITSECT pCritSect)
     779VMMDECL(bool) PDMCritSectIsOwner(PVMCC pVM, PCPDMCRITSECT pCritSect)
    767780{
    768781#ifdef IN_RING3
     782    RT_NOREF(pVM);
    769783    return RTCritSectIsOwner(&pCritSect->s.Core);
    770784#else
    771     PVMCC     pVM   = pCritSect->s.CTX_SUFF(pVM); AssertPtr(pVM);
    772     PVMCPUCC  pVCpu = VMMGetCpu(pVM);             AssertPtr(pVCpu);
    773     if (pCritSect->s.Core.NativeThreadOwner != pVCpu->hNativeThread)
     785    PVMCPUCC pVCpu = VMMGetCpu(pVM);
     786    if (   !pVCpu
     787        || pCritSect->s.Core.NativeThreadOwner != pVCpu->hNativeThread)
    774788        return false;
    775789    return (pCritSect->s.Core.fFlags & PDMCRITSECT_FLAGS_PENDING_UNLOCK) == 0
     
    784798 * @returns true if owner.
    785799 * @returns false if not owner.
     800 * @param   pVCpu       The cross context virtual CPU structure.
    786801 * @param   pCritSect   The critical section.
    787  * @param   pVCpu       The cross context virtual CPU structure.
    788  */
    789 VMMDECL(bool) PDMCritSectIsOwnerEx(PCPDMCRITSECT pCritSect, PVMCPUCC pVCpu)
     802 */
     803VMMDECL(bool) PDMCritSectIsOwnerEx(PVMCPUCC pVCpu, PCPDMCRITSECT pCritSect)
    790804{
    791805#ifdef IN_RING3
     
    807821 * @returns true if someone is waiting.
    808822 * @returns false if no one is waiting.
     823 * @param   pVM         The cross context VM structure.
    809824 * @param   pCritSect   The critical section.
    810825 */
    811 VMMDECL(bool) PDMCritSectHasWaiters(PCPDMCRITSECT pCritSect)
     826VMMDECL(bool) PDMCritSectHasWaiters(PVMCC pVM, PCPDMCRITSECT pCritSect)
    812827{
    813828    AssertReturn(pCritSect->s.Core.u32Magic == RTCRITSECT_MAGIC, false);
    814     Assert(pCritSect->s.Core.NativeThreadOwner == pdmCritSectGetNativeSelf(pCritSect));
     829    Assert(pCritSect->s.Core.NativeThreadOwner == pdmCritSectGetNativeSelf(pVM, pCritSect)); RT_NOREF(pVM);
    815830    return pCritSect->s.Core.cLockers >= pCritSect->s.Core.cNestings;
    816831}
  • trunk/src/VBox/VMM/VMMAll/PDMAllCritSectBoth.cpp

    r82968 r90346  
    3636 * Process the critical sections (both types) queued for ring-3 'leave'.
    3737 *
     38 * @param   pVM           The cross context VM structure.
    3839 * @param   pVCpu         The cross context virtual CPU structure.
    3940 */
    40 VMM_INT_DECL(void) PDMCritSectBothFF(PVMCPUCC pVCpu)
     41VMM_INT_DECL(void) PDMCritSectBothFF(PVMCC pVM, PVMCPUCC pVCpu)
    4142{
    4243    uint32_t i;
     
    8889# endif
    8990
    90         PDMCritSectLeave(pCritSect);
     91        PDMCritSectLeave(pVM, pCritSect);
    9192        LogFlow(("PDMR3CritSectFF: %p\n", pCritSect));
    9293    }
  • trunk/src/VBox/VMM/VMMAll/PDMAllNetShaper.cpp

    r82968 r90346  
    3636 * @param   cbTransfer      Number of bytes to allocate.
    3737 */
    38 VMMDECL(bool) PDMNsAllocateBandwidth(PPDMNSFILTER pFilter, size_t cbTransfer)
     38VMM_INT_DECL(bool) PDMNetShaperAllocateBandwidth(PVMCC pVM, PPDMNSFILTER pFilter, size_t cbTransfer)
    3939{
    4040    AssertPtrReturn(pFilter, true);
     
    4343
    4444    PPDMNSBWGROUP pBwGroup = ASMAtomicReadPtrT(&pFilter->CTX_SUFF(pBwGroup), PPDMNSBWGROUP);
    45     int rc = PDMCritSectEnter(&pBwGroup->Lock, VERR_SEM_BUSY); AssertRC(rc);
     45    int rc = PDMCritSectEnter(pVM, &pBwGroup->Lock, VERR_SEM_BUSY); AssertRC(rc);
    4646    if (RT_UNLIKELY(rc == VERR_SEM_BUSY))
    4747        return true;
     
    7272              pBwGroup, R3STRING(pBwGroup->pszNameR3), fAllowed));
    7373
    74     rc = PDMCritSectLeave(&pBwGroup->Lock); AssertRC(rc);
     74    rc = PDMCritSectLeave(pVM, &pBwGroup->Lock); AssertRC(rc);
    7575    return fAllowed;
    7676}
  • trunk/src/VBox/VMM/VMMAll/PGMAll.cpp

    r87515 r90346  
    889889VMMDECL(int) PGMTrap0eHandler(PVMCPUCC pVCpu, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault)
    890890{
    891     PVM pVM = pVCpu->CTX_SUFF(pVM);
     891    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    892892
    893893    Log(("PGMTrap0eHandler: uErr=%RGx pvFault=%RGv eip=%04x:%RGv cr3=%RGp\n", uErr, pvFault, pRegFrame->cs.Sel, (RTGCPTR)pRegFrame->rip, (RTGCPHYS)CPUMGetGuestCR3(pVCpu)));
     
    15401540DECLINLINE(int) pgmShwGetPaePoolPagePD(PVMCPUCC pVCpu, RTGCPTR GCPtr, PPGMPOOLPAGE *ppShwPde)
    15411541{
    1542     PVM pVM   = pVCpu->CTX_SUFF(pVM);
     1542    PVMCC pVM   = pVCpu->CTX_SUFF(pVM);
    15431543    PGM_LOCK_ASSERT_OWNER(pVM);
    15441544
     
    17101710DECLINLINE(int) pgmShwGetLongModePDPtr(PVMCPUCC pVCpu, RTGCPTR64 GCPtr, PX86PML4E *ppPml4e, PX86PDPT *ppPdpt, PX86PDPAE *ppPD)
    17111711{
    1712     PVM pVM = pVCpu->CTX_SUFF(pVM);
     1712    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    17131713    PGM_LOCK_ASSERT_OWNER(pVM);
    17141714
     
    34903490 * @param   pVM         The cross context VM structure.
    34913491 */
    3492 VMMDECL(bool) PGMIsLockOwner(PVM pVM)
    3493 {
    3494     return PDMCritSectIsOwner(&pVM->pgm.s.CritSectX);
     3492VMMDECL(bool) PGMIsLockOwner(PVMCC pVM)
     3493{
     3494    return PDMCritSectIsOwner(pVM, &pVM->pgm.s.CritSectX);
    34953495}
    34963496
     
    35263526{
    35273527#if defined(VBOX_STRICT) && defined(IN_RING3)
    3528     int rc = PDMCritSectEnterDebug(&pVM->pgm.s.CritSectX, VERR_SEM_BUSY, (uintptr_t)ASMReturnAddress(), RT_SRC_POS_ARGS);
     3528    int rc = PDMCritSectEnterDebug(pVM, &pVM->pgm.s.CritSectX, VERR_SEM_BUSY, (uintptr_t)ASMReturnAddress(), RT_SRC_POS_ARGS);
    35293529#else
    3530     int rc = PDMCritSectEnter(&pVM->pgm.s.CritSectX, VERR_SEM_BUSY);
     3530    int rc = PDMCritSectEnter(pVM, &pVM->pgm.s.CritSectX, VERR_SEM_BUSY);
    35313531#endif
    35323532#ifdef IN_RING0
     
    35453545 * @param   pVM         The cross context VM structure.
    35463546 */
    3547 void pgmUnlock(PVM pVM)
     3547void pgmUnlock(PVMCC pVM)
    35483548{
    35493549    uint32_t cDeprecatedPageLocks = pVM->pgm.s.cDeprecatedPageLocks;
    35503550    pVM->pgm.s.cDeprecatedPageLocks = 0;
    3551     int rc = PDMCritSectLeave(&pVM->pgm.s.CritSectX);
     3551    int rc = PDMCritSectLeave(pVM, &pVM->pgm.s.CritSectX);
    35523552    if (rc == VINF_SEM_NESTED)
    35533553        pVM->pgm.s.cDeprecatedPageLocks = cDeprecatedPageLocks;
  • trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp

    r86473 r90346  
    16821682 * @param   pVM     The cross context VM structure.
    16831683 */
    1684 VMMDECL(unsigned) PGMAssertHandlerAndFlagsInSync(PVM pVM)
     1684VMMDECL(unsigned) PGMAssertHandlerAndFlagsInSync(PVMCC pVM)
    16851685{
    16861686    PPGM        pPGM = &pVM->pgm.s;
  • trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp

    r90162 r90346  
    598598 * @param   GCPhys  GCPhys entry to flush
    599599 */
    600 void pgmPhysInvalidatePageMapTLBEntry(PVM pVM, RTGCPHYS GCPhys)
     600void pgmPhysInvalidatePageMapTLBEntry(PVMCC pVM, RTGCPHYS GCPhys)
    601601{
    602602    PGM_LOCK_ASSERT_OWNER(pVM);
  • trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp

    r87141 r90346  
    5959
    6060int             pgmPoolTrackFlushGCPhysPTsSlow(PVMCC pVM, PPGMPAGE pPhysPage);
    61 PPGMPOOLPHYSEXT pgmPoolTrackPhysExtAlloc(PVM pVM, uint16_t *piPhysExt);
    62 void            pgmPoolTrackPhysExtFree(PVM pVM, uint16_t iPhysExt);
    63 void            pgmPoolTrackPhysExtFreeList(PVM pVM, uint16_t iPhysExt);
     61PPGMPOOLPHYSEXT pgmPoolTrackPhysExtAlloc(PVMCC pVM, uint16_t *piPhysExt);
     62void            pgmPoolTrackPhysExtFree(PVMCC pVM, uint16_t iPhysExt);
     63void            pgmPoolTrackPhysExtFreeList(PVMCC pVM, uint16_t iPhysExt);
    6464
    6565RT_C_DECLS_END
     
    17931793 * @param   GCPhys          Guest physical address
    17941794 */
    1795 bool pgmPoolIsDirtyPageSlow(PVM pVM, RTGCPHYS GCPhys)
     1795bool pgmPoolIsDirtyPageSlow(PVMCC pVM, RTGCPHYS GCPhys)
    17961796{
    17971797    PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool);
     
    18611861 * @param   GCPtrPage       Guest page to invalidate
    18621862 */
    1863 void pgmPoolResetDirtyPage(PVM pVM, RTGCPTR GCPtrPage)
     1863void pgmPoolResetDirtyPage(PVMCC pVM, RTGCPTR GCPtrPage)
    18641864{
    18651865    PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool);
     
    33923392 * @param   iPhysExt    The physical cross reference extent list to flush.
    33933393 */
    3394 static void pgmPoolTrackFlushGCPhysPTs(PVM pVM, PPGMPAGE pPhysPage, bool fFlushPTEs, uint16_t iPhysExt)
     3394static void pgmPoolTrackFlushGCPhysPTs(PVMCC pVM, PPGMPAGE pPhysPage, bool fFlushPTEs, uint16_t iPhysExt)
    33953395{
    33963396    PGM_LOCK_ASSERT_OWNER(pVM);
     
    38683868 * @param   piPhysExt   Where to store the phys ext index.
    38693869 */
    3870 PPGMPOOLPHYSEXT pgmPoolTrackPhysExtAlloc(PVM pVM, uint16_t *piPhysExt)
     3870PPGMPOOLPHYSEXT pgmPoolTrackPhysExtAlloc(PVMCC pVM, uint16_t *piPhysExt)
    38713871{
    38723872    PGM_LOCK_ASSERT_OWNER(pVM);
     
    38923892 * @param   iPhysExt    The extent to free.
    38933893 */
    3894 void pgmPoolTrackPhysExtFree(PVM pVM, uint16_t iPhysExt)
     3894void pgmPoolTrackPhysExtFree(PVMCC pVM, uint16_t iPhysExt)
    38953895{
    38963896    PGM_LOCK_ASSERT_OWNER(pVM);
     
    39143914 * @param   iPhysExt    The extent to free.
    39153915 */
    3916 void pgmPoolTrackPhysExtFreeList(PVM pVM, uint16_t iPhysExt)
     3916void pgmPoolTrackPhysExtFreeList(PVMCC pVM, uint16_t iPhysExt)
    39173917{
    39183918    PGM_LOCK_ASSERT_OWNER(pVM);
     
    39513951 *
    39523952 */
    3953 static uint16_t pgmPoolTrackPhysExtInsert(PVM pVM, uint16_t iPhysExt, uint16_t iShwPT, uint16_t iPte)
     3953static uint16_t pgmPoolTrackPhysExtInsert(PVMCC pVM, uint16_t iPhysExt, uint16_t iShwPT, uint16_t iPte)
    39543954{
    39553955    PGM_LOCK_ASSERT_OWNER(pVM);
  • trunk/src/VBox/VMM/VMMAll/PGMAllShw.h

    r86489 r90346  
    317317
    318318#else  /* PGM_SHW_TYPE != PGM_TYPE_NONE */
    319     PVM pVM = pVCpu->CTX_SUFF(pVM);
     319    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    320320
    321321    PGM_LOCK_ASSERT_OWNER(pVM);
  • trunk/src/VBox/VMM/VMMAll/TMAll.cpp

    r88076 r90346  
    7474            PPDMCRITSECT pCritSect = TMTIMER_GET_CRITSECT(a_pVM, a_pTimer); \
    7575            AssertMsg(   pCritSect \
    76                       && (   PDMCritSectIsOwner(pCritSect) \
     76                      && (   PDMCritSectIsOwner((a_pVM), pCritSect) \
    7777                          || (enmState = (a_pVM)->enmVMState) == VMSTATE_CREATING \
    7878                          || enmState == VMSTATE_RESETTING \
     
    107107            PPDMCRITSECT pCritSect = TMTIMER_GET_CRITSECT(pVM, pTimer); \
    108108            AssertMsg(   pCritSect \
    109                       && (   !PDMCritSectIsOwner(pCritSect) \
    110                           || PDMCritSectIsOwner(&pVM->tm.s.VirtualSyncLock) \
     109                      && (   !PDMCritSectIsOwner((pVM), pCritSect) \
     110                          || PDMCritSectIsOwner((pVM), &(pVM)->tm.s.VirtualSyncLock) \
    111111                          || (enmState = (pVM)->enmVMState) == VMSTATE_CREATING \
    112112                          || enmState == VMSTATE_RESETTING \
     
    363363DECLINLINE(void) tmSchedule(PVMCC pVM, PTMTIMERQUEUECC pQueueCC, PTMTIMERQUEUE pQueue, PTMTIMER pTimer)
    364364{
    365     int rc = PDMCritSectTryEnter(&pQueue->TimerLock);
     365    int rc = PDMCritSectTryEnter(pVM, &pQueue->TimerLock);
    366366    if (RT_SUCCESS_NP(rc))
    367367    {
     
    373373#endif
    374374        STAM_PROFILE_STOP(&pVM->tm.s.CTX_SUFF_Z(StatScheduleOne), a);
    375         PDMCritSectLeave(&pQueue->TimerLock);
     375        PDMCritSectLeave(pVM, &pQueue->TimerLock);
    376376        return;
    377377    }
     
    621621void tmTimerQueueSchedule(PVMCC pVM, PTMTIMERQUEUECC pQueueCC, PTMTIMERQUEUE pQueue)
    622622{
    623     Assert(PDMCritSectIsOwner(&pQueue->TimerLock));
     623    Assert(PDMCritSectIsOwner(pVM, &pQueue->TimerLock));
    624624
    625625    /*
     
    666666        Assert(pQueue->enmClock == (TMCLOCK)idxQueue);
    667667
    668         int rc = PDMCritSectTryEnter(&pQueue->TimerLock);
     668        int rc = PDMCritSectTryEnter(pVM, &pQueue->TimerLock);
    669669        if (RT_SUCCESS(rc))
    670670        {
    671671            if (   pQueue->enmClock != TMCLOCK_VIRTUAL_SYNC
    672                 || PDMCritSectTryEnter(&pVM->tm.s.VirtualSyncLock) == VINF_SUCCESS)
     672                || PDMCritSectTryEnter(pVM, &pVM->tm.s.VirtualSyncLock) == VINF_SUCCESS)
    673673            {
    674674                /* Check the linking of the active lists. */
     
    769769
    770770                if (pQueue->enmClock == TMCLOCK_VIRTUAL_SYNC)
    771                     PDMCritSectLeave(&pVM->tm.s.VirtualSyncLock);
     771                    PDMCritSectLeave(pVM, &pVM->tm.s.VirtualSyncLock);
    772772            }
    773             PDMCritSectLeave(&pQueue->TimerLock);
     773            PDMCritSectLeave(pVM, &pQueue->TimerLock);
    774774        }
    775775    }
     
    11471147    TMTIMER_HANDLE_TO_VARS_RETURN(pVM, hTimer); /* => pTimer, pQueueCC, pQueue, idxTimer, idxQueue */
    11481148    AssertReturn(idxQueue == TMCLOCK_VIRTUAL_SYNC, VERR_NOT_SUPPORTED);
    1149     return PDMCritSectEnter(&pVM->tm.s.VirtualSyncLock, rcBusy);
     1149    return PDMCritSectEnter(pVM, &pVM->tm.s.VirtualSyncLock, rcBusy);
    11501150}
    11511151
     
    11611161    TMTIMER_HANDLE_TO_VARS_RETURN_VOID(pVM, hTimer); /* => pTimer, pQueueCC, pQueue, idxTimer, idxQueue */
    11621162    AssertReturnVoid(idxQueue == TMCLOCK_VIRTUAL_SYNC);
    1163     PDMCritSectLeave(&pVM->tm.s.VirtualSyncLock);
     1163    PDMCritSectLeave(pVM, &pVM->tm.s.VirtualSyncLock);
    11641164}
    11651165
     
    11761176    TMTIMER_HANDLE_TO_VARS_RETURN_EX(pVM, hTimer, false); /* => pTimer, pQueueCC, pQueue, idxTimer, idxQueue */
    11771177    AssertReturn(idxQueue == TMCLOCK_VIRTUAL_SYNC, false);
    1178     return PDMCritSectIsOwner(&pVM->tm.s.VirtualSyncLock);
     1178    return PDMCritSectIsOwner(pVM, &pVM->tm.s.VirtualSyncLock);
    11791179}
    11801180
     
    12361236    VM_ASSERT_EMT(pVM);
    12371237    TMTIMER_ASSERT_SYNC_CRITSECT_ORDER(pVM, pTimer);
    1238     int rc = PDMCritSectEnter(&pVM->tm.s.VirtualSyncLock, VINF_SUCCESS);
     1238    int rc = PDMCritSectEnter(pVM, &pVM->tm.s.VirtualSyncLock, VINF_SUCCESS);
    12391239    AssertRCReturn(rc, rc);
    12401240
     
    12871287
    12881288    STAM_PROFILE_STOP(&pVM->tm.s.CTX_SUFF_Z(StatTimerSetVs), a);
    1289     PDMCritSectLeave(&pVM->tm.s.VirtualSyncLock);
     1289    PDMCritSectLeave(pVM, &pVM->tm.s.VirtualSyncLock);
    12901290    return rc;
    12911291}
     
    13441344    {
    13451345        /* Try take the TM lock and check the state again. */
    1346         int rc = PDMCritSectTryEnter(&pQueue->TimerLock);
     1346        int rc = PDMCritSectTryEnter(pVM, &pQueue->TimerLock);
    13471347        if (RT_SUCCESS_NP(rc))
    13481348        {
     
    13511351                tmTimerSetOptimizedStart(pVM, pTimer, u64Expire, pQueue, idxQueue);
    13521352                STAM_PROFILE_STOP(&pVM->tm.s.CTX_SUFF_Z(StatTimerSet), a);
    1353                 PDMCritSectLeave(&pQueue->TimerLock);
     1353                PDMCritSectLeave(pVM, &pQueue->TimerLock);
    13541354                return VINF_SUCCESS;
    13551355            }
    1356             PDMCritSectLeave(&pQueue->TimerLock);
     1356            PDMCritSectLeave(pVM, &pQueue->TimerLock);
    13571357        }
    13581358    }
     
    15431543    VM_ASSERT_EMT(pVM);
    15441544    TMTIMER_ASSERT_SYNC_CRITSECT_ORDER(pVM, pTimer);
    1545     int rc = PDMCritSectEnter(&pVM->tm.s.VirtualSyncLock, VINF_SUCCESS);
     1545    int rc = PDMCritSectEnter(pVM, &pVM->tm.s.VirtualSyncLock, VINF_SUCCESS);
    15461546    AssertRCReturn(rc, rc);
    15471547
     
    15981598
    15991599    STAM_PROFILE_STOP(&pVM->tm.s.CTX_SUFF_Z(StatTimerSetRelativeVs), a);
    1600     PDMCritSectLeave(&pVM->tm.s.VirtualSyncLock);
     1600    PDMCritSectLeave(pVM, &pVM->tm.s.VirtualSyncLock);
    16011601    return rc;
    16021602}
     
    16621662     *       get the innermost locks.
    16631663     */
    1664     bool fOwnTMLock = RT_SUCCESS_NP(PDMCritSectTryEnter(&pQueue->TimerLock));
     1664    bool fOwnTMLock = RT_SUCCESS_NP(PDMCritSectTryEnter(pVM, &pQueue->TimerLock));
    16651665#if 1
    16661666    if (    fOwnTMLock
     
    16741674            tmTimerSetRelativeOptimizedStart(pVM, pTimer, cTicksToNext, pu64Now, pQueueCC, pQueue);
    16751675            STAM_PROFILE_STOP(&pVM->tm.s.CTX_SUFF_Z(StatTimerSetRelative), a);
    1676             PDMCritSectLeave(&pQueue->TimerLock);
     1676            PDMCritSectLeave(pVM, &pQueue->TimerLock);
    16771677            return VINF_SUCCESS;
    16781678        }
     
    18141814         */
    18151815        if (!fOwnTMLock)
    1816             fOwnTMLock = RT_SUCCESS_NP(PDMCritSectTryEnter(&pQueue->TimerLock));
     1816            fOwnTMLock = RT_SUCCESS_NP(PDMCritSectTryEnter(pVM, &pQueue->TimerLock));
    18171817
    18181818    } /* for (;;) */
     
    18221822     */
    18231823    if (fOwnTMLock)
    1824         PDMCritSectLeave(&pQueue->TimerLock);
     1824        PDMCritSectLeave(pVM, &pQueue->TimerLock);
    18251825
    18261826    STAM_PROFILE_STOP(&pVM->tm.s.CTX_SUFF_Z(StatTimerSetRelative), a);
     
    18931893    VM_ASSERT_EMT(pVM);
    18941894    TMTIMER_ASSERT_SYNC_CRITSECT_ORDER(pVM, pTimer);
    1895     int rc = PDMCritSectEnter(&pVM->tm.s.VirtualSyncLock, VINF_SUCCESS);
     1895    int rc = PDMCritSectEnter(pVM, &pVM->tm.s.VirtualSyncLock, VINF_SUCCESS);
    18961896    AssertRCReturn(rc, rc);
    18971897
     
    19471947
    19481948    STAM_PROFILE_STOP(&pVM->tm.s.CTX_SUFF_Z(StatTimerStopVs), a);
    1949     PDMCritSectLeave(&pVM->tm.s.VirtualSyncLock);
     1949    PDMCritSectLeave(pVM, &pVM->tm.s.VirtualSyncLock);
    19501950    return rc;
    19511951}
     
    26172617        uint32_t uMaxHzHintQueue;
    26182618        if (  !(ASMAtomicUoReadU64(&pVM->tm.s.HzHint.u64Combined) & (RT_BIT_32(idxQueue) | RT_BIT_32(idxQueue + 16)))
    2619             || RT_FAILURE_NP(PDMCritSectTryEnter(&pQueue->TimerLock)))
     2619            || RT_FAILURE_NP(PDMCritSectTryEnter(pVM, &pQueue->TimerLock)))
    26202620            uMaxHzHintQueue = ASMAtomicReadU32(&pQueue->uMaxHzHint);
    26212621        else
     
    26672667                uMaxHzHintQueue = ASMAtomicUoReadU32(&pQueue->uMaxHzHint);
    26682668
    2669             PDMCritSectLeave(&pQueue->TimerLock);
     2669            PDMCritSectLeave(pVM, &pQueue->TimerLock);
    26702670        }
    26712671
  • trunk/src/VBox/VMM/VMMAll/TMAllVirtual.cpp

    r87792 r90346  
    437437            *pcNsToDeadline = tmVirtualVirtToNsDeadline(pVM, cNsToDeadline);
    438438        }
    439         PDMCritSectLeave(&pVM->tm.s.VirtualSyncLock);
     439        PDMCritSectLeave(pVM, &pVM->tm.s.VirtualSyncLock);
    440440    }
    441441    else
     
    450450        Log5(("TMAllVirtual(%u): FF: %d -> 1\n", __LINE__, VMCPU_FF_IS_SET(pVCpuDst, VMCPU_FF_TIMER)));
    451451        Log4(("TM: %'RU64/-%'8RU64: exp tmr=>ff [vsghcul]\n", u64, pVM->tm.s.offVirtualSync - pVM->tm.s.offVirtualSyncGivenUp));
    452         PDMCritSectLeave(&pVM->tm.s.VirtualSyncLock);
     452        PDMCritSectLeave(pVM, &pVM->tm.s.VirtualSyncLock);
    453453
    454454        if (pcNsToDeadline)
     
    488488    {
    489489        u64 = ASMAtomicUoReadU64(&pVM->tm.s.u64VirtualSync);
    490         PDMCritSectLeave(&pVM->tm.s.VirtualSyncLock);
     490        PDMCritSectLeave(pVM, &pVM->tm.s.VirtualSyncLock);
    491491        if (pcNsToDeadline)
    492492            *pcNsToDeadline = 0;
     
    526526    {
    527527        ASMAtomicWriteU64(&pVM->tm.s.u64VirtualSync, u64);
    528         PDMCritSectLeave(&pVM->tm.s.VirtualSyncLock);
     528        PDMCritSectLeave(pVM, &pVM->tm.s.VirtualSyncLock);
    529529        if (pcNsToDeadline)
    530530            *pcNsToDeadline = tmVirtualVirtToNsDeadline(pVM, u64Expire - u64);
     
    541541        Log5(("TMAllVirtual(%u): FF: %d -> 1\n", __LINE__, VMCPU_FF_IS_SET(pVCpuDst, VMCPU_FF_TIMER)));
    542542        Log4(("TM: %'RU64/-%'8RU64: exp tmr=>ff [vsgl]\n", u64, pVM->tm.s.offVirtualSync - pVM->tm.s.offVirtualSyncGivenUp));
    543         PDMCritSectLeave(&pVM->tm.s.VirtualSyncLock);
     543        PDMCritSectLeave(pVM, &pVM->tm.s.VirtualSyncLock);
    544544
    545545#ifdef IN_RING3
     
    617617    /** @todo switch this around, have the tmVirtualSyncGetLocked code inlined
    618618     *        here and the remainder of this function in a static worker. */
    619     if (PDMCritSectTryEnter(&pVM->tm.s.VirtualSyncLock) == VINF_SUCCESS)
     619    if (PDMCritSectTryEnter(pVM, &pVM->tm.s.VirtualSyncLock) == VINF_SUCCESS)
    620620        return tmVirtualSyncGetLocked(pVM, u64, pcNsToDeadline, pnsAbsDeadline);
    621621
     
    689689    {
    690690        /* Try grab the lock, things get simpler when owning the lock. */
    691         int rcLock = PDMCritSectTryEnter(&pVM->tm.s.VirtualSyncLock);
     691        int rcLock = PDMCritSectTryEnter(pVM, &pVM->tm.s.VirtualSyncLock);
    692692        if (RT_SUCCESS_NP(rcLock))
    693693            return tmVirtualSyncGetLocked(pVM, u64, pcNsToDeadline, pnsAbsDeadline);
  • trunk/src/VBox/VMM/VMMR0/PDMR0DevHlp.cpp

    r89620 r90346  
    497497{
    498498    PDMDEV_ASSERT_DEVINS(pDevIns);
    499     VBOXSTRICTRC rc = TMTimerLock(pDevIns->Internal.s.pGVM, hTimer, rcBusy);
     499    PGVM const pGVM = pDevIns->Internal.s.pGVM;
     500    VBOXSTRICTRC rc = TMTimerLock(pGVM, hTimer, rcBusy);
    500501    if (rc == VINF_SUCCESS)
    501502    {
    502         rc = PDMCritSectEnter(pCritSect, rcBusy);
     503        rc = PDMCritSectEnter(pGVM, pCritSect, rcBusy);
    503504        if (rc == VINF_SUCCESS)
    504505            return rc;
    505506        AssertRC(VBOXSTRICTRC_VAL(rc));
    506         TMTimerUnlock(pDevIns->Internal.s.pGVM, hTimer);
     507        TMTimerUnlock(pGVM, hTimer);
    507508    }
    508509    else
     
    580581{
    581582    PDMDEV_ASSERT_DEVINS(pDevIns);
    582     TMTimerUnlock(pDevIns->Internal.s.pGVM, hTimer);
    583     int rc = PDMCritSectLeave(pCritSect);
     583    PGVM const pGVM = pDevIns->Internal.s.pGVM;
     584    TMTimerUnlock(pGVM, hTimer);
     585    int rc = PDMCritSectLeave(pGVM, pCritSect);
    584586    AssertRC(rc);
    585587}
     
    863865{
    864866    PDMDEV_ASSERT_DEVINS(pDevIns);
    865     RT_NOREF(pDevIns); /** @todo pass pDevIns->Internal.s.pGVM to the crit sect code.   */
    866     return PDMCritSectEnter(pCritSect, rcBusy);
     867    return PDMCritSectEnter(pDevIns->Internal.s.pGVM, pCritSect, rcBusy);
    867868}
    868869
     
    872873{
    873874    PDMDEV_ASSERT_DEVINS(pDevIns);
    874     RT_NOREF(pDevIns); /** @todo pass pDevIns->Internal.s.pGVM to the crit sect code.   */
    875     return PDMCritSectEnterDebug(pCritSect, rcBusy, uId, RT_SRC_POS_ARGS);
     875    return PDMCritSectEnterDebug(pDevIns->Internal.s.pGVM, pCritSect, rcBusy, uId, RT_SRC_POS_ARGS);
    876876}
    877877
     
    881881{
    882882    PDMDEV_ASSERT_DEVINS(pDevIns);
    883     RT_NOREF(pDevIns); /** @todo pass pDevIns->Internal.s.pGVM to the crit sect code.   */
    884     return PDMCritSectTryEnter(pCritSect);
     883    return PDMCritSectTryEnter(pDevIns->Internal.s.pGVM, pCritSect);
    885884}
    886885
     
    890889{
    891890    PDMDEV_ASSERT_DEVINS(pDevIns);
    892     RT_NOREF(pDevIns); /** @todo pass pDevIns->Internal.s.pGVM to the crit sect code.   */
    893     return PDMCritSectTryEnterDebug(pCritSect, uId, RT_SRC_POS_ARGS);
     891    return PDMCritSectTryEnterDebug(pDevIns->Internal.s.pGVM, pCritSect, uId, RT_SRC_POS_ARGS);
    894892}
    895893
     
    899897{
    900898    PDMDEV_ASSERT_DEVINS(pDevIns);
    901     RT_NOREF(pDevIns); /** @todo pass pDevIns->Internal.s.pGVM to the crit sect code.   */
    902     return PDMCritSectLeave(pCritSect);
     899    return PDMCritSectLeave(pDevIns->Internal.s.pGVM, pCritSect);
    903900}
    904901
     
    908905{
    909906    PDMDEV_ASSERT_DEVINS(pDevIns);
    910     RT_NOREF(pDevIns); /** @todo pass pDevIns->Internal.s.pGVM to the crit sect code.   */
    911     return PDMCritSectIsOwner(pCritSect);
     907    return PDMCritSectIsOwner(pDevIns->Internal.s.pGVM, pCritSect);
    912908}
    913909
     
    926922{
    927923    PDMDEV_ASSERT_DEVINS(pDevIns);
    928     RT_NOREF(pDevIns);
    929     return PDMCritSectHasWaiters(pCritSect);
     924    return PDMCritSectHasWaiters(pDevIns->Internal.s.pGVM, pCritSect);
    930925}
    931926
  • trunk/src/VBox/VMM/VMMR0/PDMR0Driver.cpp

    r90329 r90346  
    117117{
    118118    PDMDRV_ASSERT_DRVINS(pDrvIns);
    119     NOREF(pDrvIns);
    120     return PDMCritSectEnter(pCritSect, rcBusy);
     119    return PDMCritSectEnter(pDrvIns->Internal.s.pVMR0, pCritSect, rcBusy);
    121120}
    122121
     
    127126{
    128127    PDMDRV_ASSERT_DRVINS(pDrvIns);
    129     NOREF(pDrvIns);
    130     return PDMCritSectEnterDebug(pCritSect, rcBusy, uId, RT_SRC_POS_ARGS);
     128    return PDMCritSectEnterDebug(pDrvIns->Internal.s.pVMR0, pCritSect, rcBusy, uId, RT_SRC_POS_ARGS);
    131129}
    132130
     
    136134{
    137135    PDMDRV_ASSERT_DRVINS(pDrvIns);
    138     NOREF(pDrvIns);
    139     return PDMCritSectTryEnter(pCritSect);
     136    return PDMCritSectTryEnter(pDrvIns->Internal.s.pVMR0, pCritSect);
    140137}
    141138
     
    146143{
    147144    PDMDRV_ASSERT_DRVINS(pDrvIns);
    148     NOREF(pDrvIns);
    149     return PDMCritSectTryEnterDebug(pCritSect, uId, RT_SRC_POS_ARGS);
     145    return PDMCritSectTryEnterDebug(pDrvIns->Internal.s.pVMR0, pCritSect, uId, RT_SRC_POS_ARGS);
    150146}
    151147
     
    155151{
    156152    PDMDRV_ASSERT_DRVINS(pDrvIns);
    157     NOREF(pDrvIns);
    158     return PDMCritSectLeave(pCritSect);
     153    return PDMCritSectLeave(pDrvIns->Internal.s.pVMR0, pCritSect);
    159154}
    160155
     
    164159{
    165160    PDMDRV_ASSERT_DRVINS(pDrvIns);
    166     NOREF(pDrvIns);
    167     return PDMCritSectIsOwner(pCritSect);
     161    return PDMCritSectIsOwner(pDrvIns->Internal.s.pVMR0, pCritSect);
    168162}
    169163
     
    182176{
    183177    PDMDRV_ASSERT_DRVINS(pDrvIns);
    184     NOREF(pDrvIns);
    185     return PDMCritSectHasWaiters(pCritSect);
     178    return PDMCritSectHasWaiters(pDrvIns->Internal.s.pVMR0, pCritSect);
    186179}
    187180
     
    206199
    207200
    208 /** @interface_method_impl{PDMDRVHLPR0,pfn} */
     201/** @interface_method_impl{PDMDRVHLPR0,pfnNetShaperAllocateBandwidth} */
     202static DECLCALLBACK(bool) pdmR0DrvHlp_NetShaperAllocateBandwidth(PPDMDRVINS pDrvIns, PPDMNSFILTER pFilter, size_t cbTransfer)
     203{
     204#ifdef VBOX_WITH_NETSHAPER
     205    PDMDRV_ASSERT_DRVINS(pDrvIns);
     206    LogFlow(("pdmR0DrvHlp_NetShaperDetach: caller='%s'/%d: pFilter=%p cbTransfer=%#zx\n",
     207             pDrvIns->pReg->szName, pDrvIns->iInstance, pFilter, cbTransfer));
     208
     209    bool const fRc = PDMNetShaperAllocateBandwidth(pDrvIns->Internal.s.pVMR0, pFilter, cbTransfer);
     210
     211    LogFlow(("pdmR0DrvHlp_NetShaperDetach: caller='%s'/%d: returns %RTbool\n", pDrvIns->pReg->szName, pDrvIns->iInstance, fRc));
     212    return fRc;
     213#else
     214    RT_NOREF(pDrvIns, pFilter, cbTransfer);
     215    return true;
     216#endif
     217}
    209218
    210219
     
    231240    pdmR0DrvHlp_CritSectGetRecursion,
    232241    pdmR0DrvHlp_CritSectScheduleExitEvent,
     242    pdmR0DrvHlp_NetShaperAllocateBandwidth,
    233243    PDM_DRVHLPRC_VERSION
    234244};
  • trunk/src/VBox/VMM/VMMR0/VMMR0.def

    r87829 r90346  
    2121    ; code
    2222    GIMGetMmio2Regions
    23     PDMCritSectEnter
    24     PDMCritSectEnterDebug
    25     PDMCritSectIsOwner
    26     PDMCritSectLeave
    27     PDMHCCritSectScheduleExitEvent
    28     PDMCritSectTryEnter
    29     PDMCritSectTryEnterDebug
    3023    PDMQueueAlloc
    3124    PDMQueueInsert
     
    8578    IntNetR0IfWait
    8679
    87     ; Network Shaper
    88     PDMNsAllocateBandwidth
    89 
    9080    ; runtime
    9181    RTAssertMsg1Weak
  • trunk/src/VBox/VMM/VMMR3/EM.cpp

    r89993 r90346  
    14841484
    14851485    if (VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_PDM_CRITSECT))
    1486         PDMCritSectBothFF(pVCpu);
     1486        PDMCritSectBothFF(pVM, pVCpu);
    14871487
    14881488    /* Update CR3 (Nested Paging case for HM). */
  • trunk/src/VBox/VMM/VMMR3/MMHyper.cpp

    r82968 r90346  
    424424    PMMHYPERHEAP pHeap = pVM->mm.s.CTX_SUFF(pHyperHeap);
    425425
    426     int rc = PDMR3CritSectEnterEx(&pHeap->Lock, true /* fHostCall */);
     426    int rc = PDMR3CritSectEnterEx(pVM, &pHeap->Lock, true /* fHostCall */);
    427427    AssertRC(rc);
    428428    return rc;
  • trunk/src/VBox/VMM/VMMR3/PDM.cpp

    r86426 r90346  
    13071307 *
    13081308 * @returns VBox status code.
    1309  * @param   pDevIns             The device instance.
    1310  */
    1311 DECLINLINE(int) pdmR3PowerOnDev(PPDMDEVINS pDevIns)
     1309 * @param   pVM     The cross context VM structure.
     1310 * @param   pDevIns The device instance.
     1311 */
     1312DECLINLINE(int) pdmR3PowerOnDev(PVM pVM, PPDMDEVINS pDevIns)
    13121313{
    13131314    Assert(pDevIns->Internal.s.fIntFlags & PDMDEVINSINT_FLAGS_SUSPENDED);
     
    13151316    {
    13161317        LogFlow(("PDMR3PowerOn: Notifying - device '%s'/%d\n", pDevIns->pReg->szName, pDevIns->iInstance));
    1317         PDMCritSectEnter(pDevIns->pCritSectRoR3, VERR_IGNORED);
     1318        PDMCritSectEnter(pVM, pDevIns->pCritSectRoR3, VERR_IGNORED);
    13181319        int rc = VINF_SUCCESS; pDevIns->pReg->pfnPowerOn(pDevIns);
    1319         PDMCritSectLeave(pDevIns->pCritSectRoR3);
     1320        PDMCritSectLeave(pVM, pDevIns->pCritSectRoR3);
    13201321        if (RT_FAILURE(rc))
    13211322        {
     
    13501351                rc = pdmR3PowerOnDrv(pDrvIns, pDevIns->pReg->szName, pDevIns->iInstance, pLun->iLun);
    13511352        if (RT_SUCCESS(rc))
    1352             rc = pdmR3PowerOnDev(pDevIns);
     1353            rc = pdmR3PowerOnDev(pVM, pDevIns);
    13531354    }
    13541355
     
    15921593 * Worker for PDMR3Reset that deals with one device instance.
    15931594 *
    1594  * @param   pDevIns             The device instance.
    1595  * @param   pAsync              The structure for recording asynchronous
    1596  *                             notification tasks.
    1597  */
    1598 DECLINLINE(void) pdmR3ResetDev(PPDMDEVINS pDevIns, PPDMNOTIFYASYNCSTATS pAsync)
     1595 * @param   pVM     The cross context VM structure.
     1596 * @param   pDevIns The device instance.
     1597 * @param   pAsync  The structure for recording asynchronous notification tasks.
     1598 */
     1599DECLINLINE(void) pdmR3ResetDev(PVM pVM, PPDMDEVINS pDevIns, PPDMNOTIFYASYNCSTATS pAsync)
    15991600{
    16001601    if (!(pDevIns->Internal.s.fIntFlags & PDMDEVINSINT_FLAGS_RESET))
     
    16041605        {
    16051606            uint64_t cNsElapsed = RTTimeNanoTS();
    1606             PDMCritSectEnter(pDevIns->pCritSectRoR3, VERR_IGNORED);
     1607            PDMCritSectEnter(pVM, pDevIns->pCritSectRoR3, VERR_IGNORED);
    16071608
    16081609            if (!pDevIns->Internal.s.pfnAsyncNotify)
     
    16241625            }
    16251626
    1626             PDMCritSectLeave(pDevIns->pCritSectRoR3);
     1627            PDMCritSectLeave(pVM, pDevIns->pCritSectRoR3);
    16271628            cNsElapsed = RTTimeNanoTS() - cNsElapsed;
    16281629            if (cNsElapsed >= PDMSUSPEND_WARN_AT_NS)
     
    16981699
    16991700            if (pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_FIRST_RESET_NOTIFICATION)
    1700                 pdmR3ResetDev(pDevIns, &Async);
     1701                pdmR3ResetDev(pVM, pDevIns, &Async);
    17011702
    17021703            if (Async.cAsync == cAsyncStart)
     
    17081709            if (   Async.cAsync == cAsyncStart
    17091710                && !(pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_FIRST_RESET_NOTIFICATION))
    1710                 pdmR3ResetDev(pDevIns, &Async);
     1711                pdmR3ResetDev(pVM, pDevIns, &Async);
    17111712        }
    17121713
     
    17611762        if (pDevIns->pReg->pfnMemSetup)
    17621763        {
    1763             PDMCritSectEnter(pDevIns->pCritSectRoR3, VERR_IGNORED);
     1764            PDMCritSectEnter(pVM, pDevIns->pCritSectRoR3, VERR_IGNORED);
    17641765            pDevIns->pReg->pfnMemSetup(pDevIns, enmCtx);
    1765             PDMCritSectLeave(pDevIns->pCritSectRoR3);
     1766            PDMCritSectLeave(pVM, pDevIns->pCritSectRoR3);
    17661767        }
    17671768
     
    18391840        if (pDevIns->pReg->pfnSoftReset)
    18401841        {
    1841             PDMCritSectEnter(pDevIns->pCritSectRoR3, VERR_IGNORED);
     1842            PDMCritSectEnter(pVM, pDevIns->pCritSectRoR3, VERR_IGNORED);
    18421843            pDevIns->pReg->pfnSoftReset(pDevIns, fResetFlags);
    1843             PDMCritSectLeave(pDevIns->pCritSectRoR3);
     1844            PDMCritSectLeave(pVM, pDevIns->pCritSectRoR3);
    18441845        }
    18451846
     
    19471948 * Worker for PDMR3Suspend that deals with one device instance.
    19481949 *
    1949  * @param   pDevIns             The device instance.
    1950  * @param   pAsync              The structure for recording asynchronous
    1951  *                             notification tasks.
    1952  */
    1953 DECLINLINE(void) pdmR3SuspendDev(PPDMDEVINS pDevIns, PPDMNOTIFYASYNCSTATS pAsync)
     1950 * @param   pVM     The cross context VM structure.
     1951 * @param   pDevIns The device instance.
     1952 * @param   pAsync  The structure for recording asynchronous notification tasks.
     1953 */
     1954DECLINLINE(void) pdmR3SuspendDev(PVM pVM, PPDMDEVINS pDevIns, PPDMNOTIFYASYNCSTATS pAsync)
    19541955{
    19551956    if (!(pDevIns->Internal.s.fIntFlags & PDMDEVINSINT_FLAGS_SUSPENDED))
     
    19591960        {
    19601961            uint64_t cNsElapsed = RTTimeNanoTS();
    1961             PDMCritSectEnter(pDevIns->pCritSectRoR3, VERR_IGNORED);
     1962            PDMCritSectEnter(pVM, pDevIns->pCritSectRoR3, VERR_IGNORED);
    19621963
    19631964            if (!pDevIns->Internal.s.pfnAsyncNotify)
     
    19791980            }
    19801981
    1981             PDMCritSectLeave(pDevIns->pCritSectRoR3);
     1982            PDMCritSectLeave(pVM, pDevIns->pCritSectRoR3);
    19821983            cNsElapsed = RTTimeNanoTS() - cNsElapsed;
    19831984            if (cNsElapsed >= PDMSUSPEND_WARN_AT_NS)
     
    20302031
    20312032            if (pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_FIRST_SUSPEND_NOTIFICATION)
    2032                 pdmR3SuspendDev(pDevIns, &Async);
     2033                pdmR3SuspendDev(pVM, pDevIns, &Async);
    20332034
    20342035            if (Async.cAsync == cAsyncStart)
     
    20402041            if (    Async.cAsync == cAsyncStart
    20412042                && !(pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_FIRST_SUSPEND_NOTIFICATION))
    2042                 pdmR3SuspendDev(pDevIns, &Async);
     2043                pdmR3SuspendDev(pVM, pDevIns, &Async);
    20432044        }
    20442045
     
    21292130 *
    21302131 * @returns VBox status code.
    2131  * @param   pDevIns             The device instance.
    2132  */
    2133 DECLINLINE(int) pdmR3ResumeDev(PPDMDEVINS pDevIns)
     2132 * @param   pVM     The cross context VM structure.
     2133 * @param   pDevIns The device instance.
     2134 */
     2135DECLINLINE(int) pdmR3ResumeDev(PVM pVM, PPDMDEVINS pDevIns)
    21342136{
    21352137    Assert(pDevIns->Internal.s.fIntFlags & PDMDEVINSINT_FLAGS_SUSPENDED);
     
    21372139    {
    21382140        LogFlow(("PDMR3Resume: Notifying - device '%s'/%d\n", pDevIns->pReg->szName, pDevIns->iInstance));
    2139         PDMCritSectEnter(pDevIns->pCritSectRoR3, VERR_IGNORED);
     2141        PDMCritSectEnter(pVM, pDevIns->pCritSectRoR3, VERR_IGNORED);
    21402142        int rc = VINF_SUCCESS; pDevIns->pReg->pfnResume(pDevIns);
    2141         PDMCritSectLeave(pDevIns->pCritSectRoR3);
     2143        PDMCritSectLeave(pVM, pDevIns->pCritSectRoR3);
    21422144        if (RT_FAILURE(rc))
    21432145        {
     
    21722174                rc = pdmR3ResumeDrv(pDrvIns, pDevIns->pReg->szName, pDevIns->iInstance, pLun->iLun);
    21732175        if (RT_SUCCESS(rc))
    2174             rc = pdmR3ResumeDev(pDevIns);
     2176            rc = pdmR3ResumeDev(pVM, pDevIns);
    21752177    }
    21762178
     
    23102312 * Worker for PDMR3PowerOff that deals with one device instance.
    23112313 *
    2312  * @param   pDevIns             The device instance.
    2313  * @param   pAsync              The structure for recording asynchronous
    2314  *                             notification tasks.
    2315  */
    2316 DECLINLINE(void) pdmR3PowerOffDev(PPDMDEVINS pDevIns, PPDMNOTIFYASYNCSTATS pAsync)
     2314 * @param   pVM     The cross context VM structure.
     2315 * @param   pDevIns The device instance.
     2316 * @param   pAsync  The structure for recording asynchronous notification tasks.
     2317 */
     2318DECLINLINE(void) pdmR3PowerOffDev(PVM pVM, PPDMDEVINS pDevIns, PPDMNOTIFYASYNCSTATS pAsync)
    23172319{
    23182320    if (!(pDevIns->Internal.s.fIntFlags & PDMDEVINSINT_FLAGS_SUSPENDED))
     
    23222324        {
    23232325            uint64_t cNsElapsed = RTTimeNanoTS();
    2324             PDMCritSectEnter(pDevIns->pCritSectRoR3, VERR_IGNORED);
     2326            PDMCritSectEnter(pVM, pDevIns->pCritSectRoR3, VERR_IGNORED);
    23252327
    23262328            if (!pDevIns->Internal.s.pfnAsyncNotify)
     
    23422344            }
    23432345
    2344             PDMCritSectLeave(pDevIns->pCritSectRoR3);
     2346            PDMCritSectLeave(pVM, pDevIns->pCritSectRoR3);
    23452347            cNsElapsed = RTTimeNanoTS() - cNsElapsed;
    23462348            if (cNsElapsed >= PDMPOWEROFF_WARN_AT_NS)
     
    24112413
    24122414            if (pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_FIRST_POWEROFF_NOTIFICATION)
    2413                 pdmR3PowerOffDev(pDevIns, &Async);
     2415                pdmR3PowerOffDev(pVM, pDevIns, &Async);
    24142416
    24152417            if (Async.cAsync == cAsyncStart)
     
    24212423            if (    Async.cAsync == cAsyncStart
    24222424                && !(pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_FIRST_POWEROFF_NOTIFICATION))
    2423                 pdmR3PowerOffDev(pDevIns, &Async);
     2425                pdmR3PowerOffDev(pVM, pDevIns, &Async);
    24242426        }
    24252427
     
    26722674VMMR3_INT_DECL(int) PDMR3LockCall(PVM pVM)
    26732675{
    2674     return PDMR3CritSectEnterEx(&pVM->pdm.s.CritSect, true /* fHostCall */);
     2676    return PDMR3CritSectEnterEx(pVM, &pVM->pdm.s.CritSect, true /* fHostCall */);
    26752677}
    26762678
  • trunk/src/VBox/VMM/VMMR3/PDMCritSect.cpp

    r87123 r90346  
    867867    RTLOCKVALSRCPOS const SrcPos = pCritSect->s.Core.pValidatorRec->SrcPos;
    868868#endif
    869     PDMCritSectLeave(pCritSect);
     869    PDMCritSectLeave(pVM, pCritSect);
    870870
    871871    /*
     
    889889
    890890#ifdef PDMCRITSECT_STRICT
    891     int rc = PDMCritSectEnterDebug(pCritSect, VERR_IGNORED,
     891    int rc = PDMCritSectEnterDebug(pVM, pCritSect, VERR_IGNORED,
    892892                                   SrcPos.uId, SrcPos.pszFile, SrcPos.uLine, SrcPos.pszFunction);
    893893#else
    894     int rc = PDMCritSectEnter(pCritSect, VERR_IGNORED);
     894    int rc = PDMCritSectEnter(pVM, pCritSect, VERR_IGNORED);
    895895#endif
    896896    AssertLogRelRC(rc);
     
    10361036        while (     pCur->Core.NativeThreadOwner == hNativeSelf
    10371037               &&   pCur->Core.cNestings > 0)
    1038             PDMCritSectLeave((PPDMCRITSECT)pCur);
     1038            PDMCritSectLeave(pVM, (PPDMCRITSECT)pCur);
    10391039    }
    10401040    RTCritSectLeave(&pUVM->pdm.s.ListCritSect);
  • trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp

    r89620 r90346  
    524524{
    525525    PDMDEV_ASSERT_DEVINS(pDevIns);
    526     VBOXSTRICTRC rc = TMTimerLock(pDevIns->Internal.s.pVMR3, hTimer, rcBusy);
     526    PVM const pVM = pDevIns->Internal.s.pVMR3;
     527    VBOXSTRICTRC rc = TMTimerLock(pVM, hTimer, rcBusy);
    527528    if (rc == VINF_SUCCESS)
    528529    {
    529         rc = PDMCritSectEnter(pCritSect, rcBusy);
     530        rc = PDMCritSectEnter(pVM, pCritSect, rcBusy);
    530531        if (rc == VINF_SUCCESS)
    531532            return rc;
    532533        AssertRC(VBOXSTRICTRC_VAL(rc));
    533         TMTimerUnlock(pDevIns->Internal.s.pVMR3, hTimer);
     534        TMTimerUnlock(pVM, hTimer);
    534535    }
    535536    else
     
    607608{
    608609    PDMDEV_ASSERT_DEVINS(pDevIns);
    609     TMTimerUnlock(pDevIns->Internal.s.pVMR3, hTimer);
    610     int rc = PDMCritSectLeave(pCritSect);
     610    PVM const pVM = pDevIns->Internal.s.pVMR3;
     611    TMTimerUnlock(pVM, hTimer);
     612    int rc = PDMCritSectLeave(pVM, pCritSect);
    611613    AssertRC(rc);
    612614}
     
    27862788{
    27872789    PDMDEV_ASSERT_DEVINS(pDevIns);
    2788     RT_NOREF(pDevIns); /** @todo pass pDevIns->Internal.s.pVMR3 to the crit sect code.   */
    2789     return PDMCritSectEnter(pCritSect, rcBusy);
     2790    return PDMCritSectEnter(pDevIns->Internal.s.pVMR3, pCritSect, rcBusy);
    27902791}
    27912792
     
    27952796{
    27962797    PDMDEV_ASSERT_DEVINS(pDevIns);
    2797     RT_NOREF(pDevIns); /** @todo pass pDevIns->Internal.s.pVMR3 to the crit sect code.   */
    2798     return PDMCritSectEnterDebug(pCritSect, rcBusy, uId, RT_SRC_POS_ARGS);
     2798    return PDMCritSectEnterDebug(pDevIns->Internal.s.pVMR3, pCritSect, rcBusy, uId, RT_SRC_POS_ARGS);
    27992799}
    28002800
     
    28042804{
    28052805    PDMDEV_ASSERT_DEVINS(pDevIns);
    2806     RT_NOREF(pDevIns); /** @todo pass pDevIns->Internal.s.pVMR3 to the crit sect code.   */
    2807     return PDMCritSectTryEnter(pCritSect);
     2806    return PDMCritSectTryEnter(pDevIns->Internal.s.pVMR3, pCritSect);
    28082807}
    28092808
     
    28132812{
    28142813    PDMDEV_ASSERT_DEVINS(pDevIns);
    2815     RT_NOREF(pDevIns); /** @todo pass pDevIns->Internal.s.pVMR3 to the crit sect code.   */
    2816     return PDMCritSectTryEnterDebug(pCritSect, uId, RT_SRC_POS_ARGS);
     2814    return PDMCritSectTryEnterDebug(pDevIns->Internal.s.pVMR3, pCritSect, uId, RT_SRC_POS_ARGS);
    28172815}
    28182816
     
    28222820{
    28232821    PDMDEV_ASSERT_DEVINS(pDevIns);
    2824     RT_NOREF(pDevIns); /** @todo pass pDevIns->Internal.s.pVMR3 to the crit sect code.   */
    2825     return PDMCritSectLeave(pCritSect);
     2822    return PDMCritSectLeave(pDevIns->Internal.s.pVMR3, pCritSect);
    28262823}
    28272824
     
    28312828{
    28322829    PDMDEV_ASSERT_DEVINS(pDevIns);
    2833     RT_NOREF(pDevIns); /** @todo pass pDevIns->Internal.s.pVMR3 to the crit sect code.   */
    2834     return PDMCritSectIsOwner(pCritSect);
     2830    return PDMCritSectIsOwner(pDevIns->Internal.s.pVMR3, pCritSect);
    28352831}
    28362832
     
    28492845{
    28502846    PDMDEV_ASSERT_DEVINS(pDevIns);
    2851     RT_NOREF(pDevIns);
    2852     return PDMCritSectHasWaiters(pCritSect);
     2847    return PDMCritSectHasWaiters(pDevIns->Internal.s.pVMR3, pCritSect);
    28532848}
    28542849
     
    31703165    {
    31713166        PPDMDEVINS pDevInsRtc = pVM->pdm.s.pRtc->pDevIns;
    3172         rc = PDMCritSectEnter(pDevInsRtc->pCritSectRoR3, VERR_IGNORED);
     3167        rc = PDMCritSectEnter(pVM, pDevInsRtc->pCritSectRoR3, VERR_IGNORED);
    31733168        if (RT_SUCCESS(rc))
    31743169        {
    31753170            rc = pVM->pdm.s.pRtc->Reg.pfnWrite(pDevInsRtc, iReg, u8Value);
    3176             PDMCritSectLeave(pDevInsRtc->pCritSectRoR3);
     3171            PDMCritSectLeave(pVM, pDevInsRtc->pCritSectRoR3);
    31773172        }
    31783173    }
     
    31993194    {
    32003195        PPDMDEVINS pDevInsRtc = pVM->pdm.s.pRtc->pDevIns;
    3201         rc = PDMCritSectEnter(pDevInsRtc->pCritSectRoR3, VERR_IGNORED);
     3196        rc = PDMCritSectEnter(pVM, pDevInsRtc->pCritSectRoR3, VERR_IGNORED);
    32023197        if (RT_SUCCESS(rc))
    32033198        {
    32043199            rc = pVM->pdm.s.pRtc->Reg.pfnRead(pDevInsRtc, iReg, pu8Value);
    3205             PDMCritSectLeave(pDevInsRtc->pCritSectRoR3);
     3200            PDMCritSectLeave(pVM, pDevInsRtc->pCritSectRoR3);
    32063201        }
    32073202    }
  • trunk/src/VBox/VMM/VMMR3/PDMDevice.cpp

    r85658 r90346  
    595595        if (pDevIns->pReg->pfnInitComplete)
    596596        {
    597             PDMCritSectEnter(pDevIns->pCritSectRoR3, VERR_IGNORED);
     597            PDMCritSectEnter(pVM, pDevIns->pCritSectRoR3, VERR_IGNORED);
    598598            rc = pDevIns->pReg->pfnInitComplete(pDevIns);
    599             PDMCritSectLeave(pDevIns->pCritSectRoR3);
     599            PDMCritSectLeave(pVM, pDevIns->pCritSectRoR3);
    600600            if (RT_FAILURE(rc))
    601601            {
     
    10041004            if (!pLun->pTop)
    10051005            {
    1006                 PDMCritSectEnter(pDevIns->pCritSectRoR3, VERR_IGNORED);
     1006                PDMCritSectEnter(pVM, pDevIns->pCritSectRoR3, VERR_IGNORED);
    10071007                rc = pDevIns->pReg->pfnAttach(pDevIns, iLun, fFlags);
    1008                 PDMCritSectLeave(pDevIns->pCritSectRoR3);
     1008                PDMCritSectLeave(pVM, pDevIns->pCritSectRoR3);
    10091009            }
    10101010            else
     
    11171117            if (pDevIns->pReg->pfnAttach)
    11181118            {
    1119                 PDMCritSectEnter(pDevIns->pCritSectRoR3, VERR_IGNORED);
     1119                PDMCritSectEnter(pVM, pDevIns->pCritSectRoR3, VERR_IGNORED);
    11201120                rc = pDevIns->pReg->pfnAttach(pDevIns, iLun, fFlags);
    11211121                if (RT_SUCCESS(rc) && ppBase)
    11221122                    *ppBase = pLun->pTop ? &pLun->pTop->IBase : NULL;
    1123                 PDMCritSectLeave(pDevIns->pCritSectRoR3);
     1123                PDMCritSectLeave(pVM, pDevIns->pCritSectRoR3);
    11241124            }
    11251125            else
  • trunk/src/VBox/VMM/VMMR3/PDMDriver.cpp

    r90329 r90346  
    934934                    if (pLun->pDevIns->pReg->pfnDetach)
    935935                    {
    936                         PDMCritSectEnter(pLun->pDevIns->pCritSectRoR3, VERR_IGNORED);
     936                        PDMCritSectEnter(pVM, pLun->pDevIns->pCritSectRoR3, VERR_IGNORED);
    937937                        pLun->pDevIns->pReg->pfnDetach(pLun->pDevIns, pLun->iLun, fFlags);
    938                         PDMCritSectLeave(pLun->pDevIns->pCritSectRoR3);
     938                        PDMCritSectLeave(pVM, pLun->pDevIns->pCritSectRoR3);
    939939                    }
    940940                }
     
    16581658
    16591659
    1660 #ifdef VBOX_WITH_NETSHAPER
    16611660/** @interface_method_impl{PDMDRVHLPR3,pfnNetShaperAttach} */
    16621661static DECLCALLBACK(int) pdmR3DrvHlp_NetShaperAttach(PPDMDRVINS pDrvIns, const char *pszBwGroup, PPDMNSFILTER pFilter)
    16631662{
     1663#ifdef VBOX_WITH_NETSHAPER
    16641664    PDMDRV_ASSERT_DRVINS(pDrvIns);
    16651665    LogFlow(("pdmR3DrvHlp_NetShaperAttach: caller='%s'/%d: pFilter=%p pszBwGroup=%p:{%s}\n",
     
    16711671             pDrvIns->iInstance, rc));
    16721672    return rc;
     1673#else
     1674    RT_NOREF(pDrvIns, pszBwGroup, pFilter);
     1675    return VERR_NOT_IMPLEMENTED;
     1676#endif
    16731677}
    16741678
     
    16771681static DECLCALLBACK(int) pdmR3DrvHlp_NetShaperDetach(PPDMDRVINS pDrvIns, PPDMNSFILTER pFilter)
    16781682{
     1683#ifdef VBOX_WITH_NETSHAPER
    16791684    PDMDRV_ASSERT_DRVINS(pDrvIns);
    16801685    LogFlow(("pdmR3DrvHlp_NetShaperDetach: caller='%s'/%d: pFilter=%p\n",
     
    16861691             pDrvIns->iInstance, rc));
    16871692    return rc;
    1688 }
    1689 #endif /* VBOX_WITH_NETSHAPER */
     1693#else
     1694    RT_NOREF(pDrvIns, pFilter);
     1695    return VERR_NOT_IMPLEMENTED;
     1696#endif
     1697}
     1698
     1699
     1700/** @interface_method_impl{PDMDRVHLPR3,pfnNetShaperAllocateBandwidth} */
     1701static DECLCALLBACK(bool) pdmR3DrvHlp_NetShaperAllocateBandwidth(PPDMDRVINS pDrvIns, PPDMNSFILTER pFilter, size_t cbTransfer)
     1702{
     1703#ifdef VBOX_WITH_NETSHAPER
     1704    PDMDRV_ASSERT_DRVINS(pDrvIns);
     1705    LogFlow(("pdmR3DrvHlp_NetShaperDetach: caller='%s'/%d: pFilter=%p cbTransfer=%#zx\n",
     1706             pDrvIns->pReg->szName, pDrvIns->iInstance, pFilter, cbTransfer));
     1707
     1708    bool const fRc = PDMNetShaperAllocateBandwidth(pDrvIns->Internal.s.pVMR3, pFilter, cbTransfer);
     1709
     1710    LogFlow(("pdmR3DrvHlp_NetShaperDetach: caller='%s'/%d: returns %RTbool\n", pDrvIns->pReg->szName, pDrvIns->iInstance, fRc));
     1711    return fRc;
     1712#else
     1713    RT_NOREF(pDrvIns, pFilter, cbTransfer);
     1714    return true;
     1715#endif
     1716}
    16901717
    16911718
     
    17961823{
    17971824    PDMDRV_ASSERT_DRVINS(pDrvIns);
    1798     RT_NOREF(pDrvIns);
    1799     return PDMCritSectEnter(pCritSect, rcBusy);
     1825    return PDMCritSectEnter(pDrvIns->Internal.s.pVMR3, pCritSect, rcBusy);
    18001826}
    18011827
     
    18061832{
    18071833    PDMDRV_ASSERT_DRVINS(pDrvIns);
    1808     RT_NOREF(pDrvIns);
    1809     return PDMCritSectEnterDebug(pCritSect, rcBusy, uId, RT_SRC_POS_ARGS);
     1834    return PDMCritSectEnterDebug(pDrvIns->Internal.s.pVMR3, pCritSect, rcBusy, uId, RT_SRC_POS_ARGS);
    18101835}
    18111836
     
    18151840{
    18161841    PDMDRV_ASSERT_DRVINS(pDrvIns);
    1817     RT_NOREF(pDrvIns);
    1818     return PDMCritSectTryEnter(pCritSect);
     1842    return PDMCritSectTryEnter(pDrvIns->Internal.s.pVMR3, pCritSect);
    18191843}
    18201844
     
    18251849{
    18261850    PDMDRV_ASSERT_DRVINS(pDrvIns);
    1827     RT_NOREF(pDrvIns);
    1828     return PDMCritSectTryEnterDebug(pCritSect, uId, RT_SRC_POS_ARGS);
     1851    return PDMCritSectTryEnterDebug(pDrvIns->Internal.s.pVMR3, pCritSect, uId, RT_SRC_POS_ARGS);
    18291852}
    18301853
     
    18341857{
    18351858    PDMDRV_ASSERT_DRVINS(pDrvIns);
    1836     RT_NOREF(pDrvIns);
    1837     return PDMCritSectLeave(pCritSect);
     1859    return PDMCritSectLeave(pDrvIns->Internal.s.pVMR3, pCritSect);
    18381860}
    18391861
     
    18431865{
    18441866    PDMDRV_ASSERT_DRVINS(pDrvIns);
    1845     RT_NOREF(pDrvIns);
    1846     return PDMCritSectIsOwner(pCritSect);
     1867    return PDMCritSectIsOwner(pDrvIns->Internal.s.pVMR3, pCritSect);
    18471868}
    18481869
     
    18611882{
    18621883    PDMDRV_ASSERT_DRVINS(pDrvIns);
    1863     RT_NOREF(pDrvIns);
    1864     return PDMCritSectHasWaiters(pCritSect);
     1884    return PDMCritSectHasWaiters(pDrvIns->Internal.s.pVMR3, pCritSect);
    18651885}
    18661886
     
    20442064    pdmR3DrvHlp_ThreadCreate,
    20452065    pdmR3DrvHlp_AsyncCompletionTemplateCreate,
    2046 #ifdef VBOX_WITH_NETSHAPER
    20472066    pdmR3DrvHlp_NetShaperAttach,
    20482067    pdmR3DrvHlp_NetShaperDetach,
    2049 #endif /* VBOX_WITH_NETSHAPER */
     2068    pdmR3DrvHlp_NetShaperAllocateBandwidth,
    20502069    pdmR3DrvHlp_LdrGetRCInterfaceSymbols,
    20512070    pdmR3DrvHlp_LdrGetR0InterfaceSymbols,
  • trunk/src/VBox/VMM/VMMR3/PDMNetShaper.cpp

    r82968 r90346  
    249249{
    250250    PPDMNSBWGROUP pBwGroup = pFilter->pBwGroupR3;
    251     int rc = PDMCritSectEnter(&pBwGroup->Lock, VERR_SEM_BUSY); AssertRC(rc);
     251    PVM const     pVM      = pBwGroup->pShaperR3->pVM;
     252    int rc = PDMCritSectEnter(pVM, &pBwGroup->Lock, VERR_SEM_BUSY); AssertRC(rc);
    252253
    253254    pFilter->pNextR3 = pBwGroup->pFiltersHeadR3;
    254255    pBwGroup->pFiltersHeadR3 = pFilter;
    255256
    256     rc = PDMCritSectLeave(&pBwGroup->Lock); AssertRC(rc);
     257    rc = PDMCritSectLeave(pVM, &pBwGroup->Lock); AssertRC(rc);
    257258}
    258259
     
    269270    AssertPtr(pBwGroup->pShaperR3);
    270271    Assert(RTCritSectIsOwner(&pBwGroup->pShaperR3->Lock));
    271     int rc = PDMCritSectEnter(&pBwGroup->Lock, VERR_SEM_BUSY); AssertRC(rc);
     272    PVM const pVM = pBwGroup->pShaperR3->pVM;
     273    int rc = PDMCritSectEnter(pVM, &pBwGroup->Lock, VERR_SEM_BUSY); AssertRC(rc);
    272274
    273275    if (pFilter == pBwGroup->pFiltersHeadR3)
     
    284286    }
    285287
    286     rc = PDMCritSectLeave(&pBwGroup->Lock); AssertRC(rc);
     288    rc = PDMCritSectLeave(pVM, &pBwGroup->Lock); AssertRC(rc);
    287289}
    288290
     
    383385    if (pBwGroup)
    384386    {
    385         rc = PDMCritSectEnter(&pBwGroup->Lock, VERR_SEM_BUSY); AssertRC(rc);
     387        rc = PDMCritSectEnter(pUVM->pVM, &pBwGroup->Lock, VERR_SEM_BUSY); AssertRC(rc);
    386388        if (RT_SUCCESS(rc))
    387389        {
     
    392394                pBwGroup->cbTokensLast = pBwGroup->cbBucket;
    393395
    394             int rc2 = PDMCritSectLeave(&pBwGroup->Lock); AssertRC(rc2);
     396            int rc2 = PDMCritSectLeave(pUVM->pVM, &pBwGroup->Lock); AssertRC(rc2);
    395397        }
    396398    }
  • trunk/src/VBox/VMM/VMMR3/PDMUsb.cpp

    r89673 r90346  
    19191919{
    19201920    PDMUSB_ASSERT_USBINS(pUsbIns);
    1921     int rc = TMTimerLock(pUsbIns->Internal.s.pVM, hTimer, VERR_IGNORED);
     1921    PVM const pVM = pUsbIns->Internal.s.pVM;
     1922    int rc = TMTimerLock(pVM, hTimer, VERR_IGNORED);
    19221923    if (rc == VINF_SUCCESS)
    19231924    {
    1924         rc = PDMCritSectEnter(pCritSect, VERR_IGNORED);
     1925        rc = PDMCritSectEnter(pVM, pCritSect, VERR_IGNORED);
    19251926        if (rc == VINF_SUCCESS)
    19261927            return rc;
    19271928        AssertRC(rc);
    1928         TMTimerUnlock(pUsbIns->Internal.s.pVM, hTimer);
     1929        TMTimerUnlock(pVM, hTimer);
    19291930    }
    19301931    else
     
    20022003{
    20032004    PDMUSB_ASSERT_USBINS(pUsbIns);
    2004     TMTimerUnlock(pUsbIns->Internal.s.pVM, hTimer);
    2005     int rc = PDMCritSectLeave(pCritSect);
     2005    PVM const pVM = pUsbIns->Internal.s.pVM;
     2006    TMTimerUnlock(pVM, hTimer);
     2007    int rc = PDMCritSectLeave(pVM, pCritSect);
    20062008    AssertRC(rc);
    20072009}
  • trunk/src/VBox/VMM/VMMR3/PGM.cpp

    r86488 r90346  
    23732373VMMR3DECL(int) PGMR3LockCall(PVM pVM)
    23742374{
    2375     int rc = PDMR3CritSectEnterEx(&pVM->pgm.s.CritSectX, true /* fHostCall */);
     2375    int rc = PDMR3CritSectEnterEx(pVM, &pVM->pgm.s.CritSectX, true /* fHostCall */);
    23762376    AssertRC(rc);
    23772377    return rc;
  • trunk/src/VBox/VMM/VMMR3/SSM.cpp

    r86375 r90346  
    44794479 * Enters the critical session (optionally) associated with the unit.
    44804480 *
     4481 * @param   pVM                 The cross context VM structure.
    44814482 * @param   pUnit               The unit.
    44824483 */
    4483 DECLINLINE(void) ssmR3UnitCritSectEnter(PSSMUNIT pUnit)
     4484DECLINLINE(void) ssmR3UnitCritSectEnter(PVM pVM, PSSMUNIT pUnit)
    44844485{
    44854486    PPDMCRITSECT pCritSect = pUnit->pCritSect;
    44864487    if (pCritSect)
    44874488    {
    4488         int rc = PDMCritSectEnter(pCritSect, VERR_IGNORED);
     4489        int rc = PDMCritSectEnter(pVM, pCritSect, VERR_IGNORED);
    44894490        AssertRC(rc);
    44904491    }
     
    44954496 * Leaves the critical session (optionally) associated with the unit.
    44964497 *
     4498 * @param   pVM                 The cross context VM structure.
    44974499 * @param   pUnit               The unit.
    44984500 */
    4499 DECLINLINE(void) ssmR3UnitCritSectLeave(PSSMUNIT pUnit)
     4501DECLINLINE(void) ssmR3UnitCritSectLeave(PVM pVM, PSSMUNIT pUnit)
    45004502{
    45014503    PPDMCRITSECT pCritSect = pUnit->pCritSect;
    45024504    if (pCritSect)
    45034505    {
    4504         int rc = PDMCritSectLeave(pCritSect);
     4506        int rc = PDMCritSectLeave(pVM, pCritSect);
    45054507        AssertRC(rc);
    45064508    }
     
    45314533            int rcOld = pSSM->rc;
    45324534            int rc;
    4533             ssmR3UnitCritSectEnter(pUnit);
     4535            ssmR3UnitCritSectEnter(pVM, pUnit);
    45344536            switch (pUnit->enmType)
    45354537            {
     
    45534555                    break;
    45544556            }
    4555             ssmR3UnitCritSectLeave(pUnit);
     4557            ssmR3UnitCritSectLeave(pVM, pUnit);
    45564558            if (RT_SUCCESS(rc) && pSSM->rc != rcOld)
    45574559                rc = pSSM->rc;
     
    48834885         */
    48844886        ssmR3DataWriteBegin(pSSM);
    4885         ssmR3UnitCritSectEnter(pUnit);
     4887        ssmR3UnitCritSectEnter(pVM, pUnit);
    48864888        switch (pUnit->enmType)
    48874889        {
     
    49064908                break;
    49074909        }
    4908         ssmR3UnitCritSectLeave(pUnit);
     4910        ssmR3UnitCritSectLeave(pVM, pUnit);
    49094911        pUnit->fCalled = true;
    49104912        if (RT_FAILURE(rc) && RT_SUCCESS_NP(pSSM->rc))
     
    49764978        {
    49774979            int rc;
    4978             ssmR3UnitCritSectEnter(pUnit);
     4980            ssmR3UnitCritSectEnter(pVM, pUnit);
    49794981            switch (pUnit->enmType)
    49804982            {
     
    49985000                    break;
    49995001            }
    5000             ssmR3UnitCritSectLeave(pUnit);
     5002            ssmR3UnitCritSectLeave(pVM, pUnit);
    50015003            pUnit->fCalled = true;
    50025004            if (RT_FAILURE(rc) && RT_SUCCESS_NP(pSSM->rc))
     
    53225324        {
    53235325            int rc;
    5324             ssmR3UnitCritSectEnter(pUnit);
     5326            ssmR3UnitCritSectEnter(pVM, pUnit);
    53255327            switch (pUnit->enmType)
    53265328            {
     
    53445346                    break;
    53455347            }
    5346             ssmR3UnitCritSectLeave(pUnit);
     5348            ssmR3UnitCritSectLeave(pVM, pUnit);
    53475349            pUnit->fCalled = true;
    53485350            Assert(pSSM->rc == VINF_SUCCESS);
     
    54655467         */
    54665468        ssmR3DataWriteBegin(pSSM);
    5467         ssmR3UnitCritSectEnter(pUnit);
     5469        ssmR3UnitCritSectEnter(pVM, pUnit);
    54685470        switch (pUnit->enmType)
    54695471        {
     
    54875489                break;
    54885490        }
    5489         ssmR3UnitCritSectLeave(pUnit);
     5491        ssmR3UnitCritSectLeave(pVM, pUnit);
    54905492        pUnit->fCalled = true;
    54915493        if (RT_FAILURE(rc) && RT_SUCCESS_NP(pSSM->rc))
     
    56275629        {
    56285630            int rc;
    5629             ssmR3UnitCritSectEnter(pUnit);
     5631            ssmR3UnitCritSectEnter(pVM, pUnit);
    56305632            switch (pUnit->enmType)
    56315633            {
     
    56495651                    break;
    56505652            }
    5651             ssmR3UnitCritSectLeave(pUnit);
     5653            ssmR3UnitCritSectLeave(pVM, pUnit);
    56525654            pUnit->fCalled = true;
    56535655            if (RT_FAILURE(rc) && RT_SUCCESS_NP(pSSM->rc))
     
    86078609                            break;
    86088610                        }
    8609                         ssmR3UnitCritSectEnter(pUnit);
     8611                        ssmR3UnitCritSectEnter(pVM, pUnit);
    86108612                        switch (pUnit->enmType)
    86118613                        {
     
    86298631                                break;
    86308632                        }
    8631                         ssmR3UnitCritSectLeave(pUnit);
     8633                        ssmR3UnitCritSectLeave(pVM, pUnit);
    86328634                        pUnit->fCalled = true;
    86338635                        if (RT_FAILURE(rc) && RT_SUCCESS_NP(pSSM->rc))
     
    88758877            pSSM->u.Read.pCurUnit     = pUnit;
    88768878            ssmR3DataReadBeginV2(pSSM);
    8877             ssmR3UnitCritSectEnter(pUnit);
     8879            ssmR3UnitCritSectEnter(pVM, pUnit);
    88788880            switch (pUnit->enmType)
    88798881            {
     
    88978899                    break;
    88988900            }
    8899             ssmR3UnitCritSectLeave(pUnit);
     8901            ssmR3UnitCritSectLeave(pVM, pUnit);
    89008902            pUnit->fCalled = true;
    89018903            if (RT_FAILURE(rc) && RT_SUCCESS_NP(pSSM->rc))
     
    90599061                Handle.u.Read.pCurUnit = pUnit;
    90609062                pUnit->fCalled = true;
    9061                 ssmR3UnitCritSectEnter(pUnit);
     9063                ssmR3UnitCritSectEnter(pVM, pUnit);
    90629064                switch (pUnit->enmType)
    90639065                {
     
    90819083                        break;
    90829084                }
    9083                 ssmR3UnitCritSectLeave(pUnit);
     9085                ssmR3UnitCritSectLeave(pVM, pUnit);
    90849086                Handle.u.Read.pCurUnit = NULL;
    90859087                if (RT_FAILURE(rc) && RT_SUCCESS_NP(Handle.rc))
     
    91359137                int const rcOld = Handle.rc;
    91369138                rc = VINF_SUCCESS;
    9137                 ssmR3UnitCritSectEnter(pUnit);
     9139                ssmR3UnitCritSectEnter(pVM, pUnit);
    91389140                switch (pUnit->enmType)
    91399141                {
     
    91579159                        break;
    91589160                }
    9159                 ssmR3UnitCritSectLeave(pUnit);
     9161                ssmR3UnitCritSectLeave(pVM, pUnit);
    91609162                Handle.u.Read.pCurUnit = NULL;
    91619163                if (RT_SUCCESS(rc) && Handle.rc != rcOld)
  • trunk/src/VBox/VMM/VMMR3/TM.cpp

    r89283 r90346  
    12461246    {
    12471247        PTMTIMERQUEUE pQueue = &pVM->tm.s.aTimerQueues[idxQueue];
    1248         PDMCritSectEnter(&pQueue->TimerLock, VERR_IGNORED);
     1248        PDMCritSectEnter(pVM, &pQueue->TimerLock, VERR_IGNORED);
    12491249        tmTimerQueueSchedule(pVM, pQueue, pQueue);
    1250         PDMCritSectLeave(&pQueue->TimerLock);
     1250        PDMCritSectLeave(pVM, &pQueue->TimerLock);
    12511251    }
    12521252#ifdef VBOX_STRICT
     
    18791879    AssertMsg(   !pTimer->pCritSect
    18801880              || VMR3GetState(pVM) != VMSTATE_RUNNING
    1881               || PDMCritSectIsOwner(pTimer->pCritSect), ("%s\n", pTimer->szName));
     1881              || PDMCritSectIsOwner(pVM, pTimer->pCritSect), ("%s\n", pTimer->szName));
    18821882
    18831883    /*
     
    18861886     */
    18871887    PDMCritSectRwEnterExcl(&pQueue->AllocLock, VERR_IGNORED);
    1888     PDMCritSectEnter(&pQueue->TimerLock, VERR_IGNORED);
     1888    PDMCritSectEnter(pVM, &pQueue->TimerLock, VERR_IGNORED);
    18891889
    18901890    for (int cRetries = 1000;; cRetries--)
     
    19241924            case TMTIMERSTATE_PENDING_RESCHEDULE_SET_EXPIRE:
    19251925                AssertMsgFailed(("%p:.enmState=%s %s\n", pTimer, tmTimerState(enmState), pTimer->szName));
    1926                 PDMCritSectLeave(&pQueue->TimerLock);
     1926                PDMCritSectLeave(pVM, &pQueue->TimerLock);
    19271927                PDMCritSectRwLeaveExcl(&pQueue->AllocLock);
    19281928
     
    19331933
    19341934                PDMCritSectRwEnterExcl(&pQueue->AllocLock, VERR_IGNORED);
    1935                 PDMCritSectEnter(&pQueue->TimerLock, VERR_IGNORED);
     1935                PDMCritSectEnter(pVM, &pQueue->TimerLock, VERR_IGNORED);
    19361936                continue;
    19371937
     
    19411941            case TMTIMERSTATE_FREE:
    19421942            case TMTIMERSTATE_DESTROY:
    1943                 PDMCritSectLeave(&pQueue->TimerLock);
     1943                PDMCritSectLeave(pVM, &pQueue->TimerLock);
    19441944                PDMCritSectRwLeaveExcl(&pQueue->AllocLock);
    19451945                AssertLogRelMsgFailedReturn(("pTimer=%p %s\n", pTimer, tmTimerState(enmState)), VERR_TM_INVALID_STATE);
     
    19471947            default:
    19481948                AssertMsgFailed(("Unknown timer state %d (%s)\n", enmState, pTimer->szName));
    1949                 PDMCritSectLeave(&pQueue->TimerLock);
     1949                PDMCritSectLeave(pVM, &pQueue->TimerLock);
    19501950                PDMCritSectRwLeaveExcl(&pQueue->AllocLock);
    19511951                return VERR_TM_UNKNOWN_STATE;
     
    19611961            break;
    19621962        AssertMsgFailed(("%p:.enmState=%s %s\n", pTimer, tmTimerState(enmState), pTimer->szName));
    1963         PDMCritSectLeave(&pQueue->TimerLock);
     1963        PDMCritSectLeave(pVM, &pQueue->TimerLock);
    19641964        PDMCritSectRwLeaveExcl(&pQueue->AllocLock);
    19651965
     
    19681968
    19691969        PDMCritSectRwEnterExcl(&pQueue->AllocLock, VERR_IGNORED);
    1970         PDMCritSectEnter(&pQueue->TimerLock, VERR_IGNORED);
     1970        PDMCritSectEnter(pVM, &pQueue->TimerLock, VERR_IGNORED);
    19711971    }
    19721972
     
    20252025    tmTimerQueuesSanityChecks(pVM, "TMR3TimerDestroy");
    20262026#endif
    2027     PDMCritSectLeave(&pQueue->TimerLock);
     2027    PDMCritSectLeave(pVM, &pQueue->TimerLock);
    20282028    PDMCritSectRwLeaveExcl(&pQueue->AllocLock);
    20292029    return VINF_SUCCESS;
     
    23192319        {
    23202320            STAM_PROFILE_START(&pTimer->StatCritSectEnter, Locking);
    2321             PDMCritSectEnter(pCritSect, VERR_IGNORED);
     2321            PDMCritSectEnter(pVM, pCritSect, VERR_IGNORED);
    23222322            STAM_PROFILE_STOP(&pTimer->StatCritSectEnter, Locking);
    23232323        }
     
    23642364        }
    23652365        if (pCritSect)
    2366             PDMCritSectLeave(pCritSect);
     2366            PDMCritSectLeave(pVM, pCritSect);
    23672367
    23682368        /* Advance? */
     
    23902390    {
    23912391        STAM_PROFILE_START(&pQueue->StatDo, s);
    2392         PDMCritSectEnter(&pQueue->TimerLock, VERR_IGNORED);
     2392        PDMCritSectEnter(pVM, &pQueue->TimerLock, VERR_IGNORED);
    23932393
    23942394        if (pQueue->idxSchedule != UINT32_MAX)
     
    23992399            tmR3TimerQueueRun(pVM, pQueue, pHead);
    24002400
    2401         PDMCritSectLeave(&pQueue->TimerLock);
     2401        PDMCritSectLeave(pVM, &pQueue->TimerLock);
    24022402        STAM_PROFILE_STOP(&pQueue->StatDo, s);
    24032403        ASMAtomicWriteBool(&pQueue->fBeingProcessed, false);
     
    24232423    PTMTIMERQUEUE const pQueue = &pVM->tm.s.aTimerQueues[TMCLOCK_VIRTUAL_SYNC];
    24242424    VM_ASSERT_EMT(pVM);
    2425     Assert(PDMCritSectIsOwner(&pVM->tm.s.VirtualSyncLock));
     2425    Assert(PDMCritSectIsOwner(pVM, &pVM->tm.s.VirtualSyncLock));
    24262426
    24272427    /*
     
    25482548        {
    25492549            STAM_PROFILE_START(&pTimer->StatCritSectEnter, Locking);
    2550             PDMCritSectEnter(pCritSect, VERR_IGNORED);
     2550            PDMCritSectEnter(pVM, pCritSect, VERR_IGNORED);
    25512551            STAM_PROFILE_STOP(&pTimer->StatCritSectEnter, Locking);
    25522552        }
     
    25942594        /* Leave the associated lock. */
    25952595        if (pCritSect)
    2596             PDMCritSectLeave(pCritSect);
     2596            PDMCritSectLeave(pVM, pCritSect);
    25972597    } /* run loop */
    25982598
     
    27512751/** @todo Optimize for SMP   */
    27522752        STAM_PROFILE_START(&pVM->tm.s.StatVirtualSyncFF, a);
    2753         PDMCritSectEnter(&pVM->tm.s.VirtualSyncLock, VERR_IGNORED);
     2753        PDMCritSectEnter(pVM, &pVM->tm.s.VirtualSyncLock, VERR_IGNORED);
    27542754        if (pVM->tm.s.fVirtualSyncTicking)
    27552755        {
    27562756            STAM_PROFILE_STOP(&pVM->tm.s.StatVirtualSyncFF, a); /* before the unlock! */
    2757             PDMCritSectLeave(&pVM->tm.s.VirtualSyncLock);
     2757            PDMCritSectLeave(pVM, &pVM->tm.s.VirtualSyncLock);
    27582758            Log2(("TMR3VirtualSyncFF: ticking\n"));
    27592759        }
    27602760        else
    27612761        {
    2762             PDMCritSectLeave(&pVM->tm.s.VirtualSyncLock);
     2762            PDMCritSectLeave(pVM, &pVM->tm.s.VirtualSyncLock);
    27632763
    27642764            /* try run it. */
    2765             PDMCritSectEnter(&pVM->tm.s.aTimerQueues[TMCLOCK_VIRTUAL].TimerLock, VERR_IGNORED);
    2766             PDMCritSectEnter(&pVM->tm.s.VirtualSyncLock, VERR_IGNORED);
     2765            PDMCritSectEnter(pVM, &pVM->tm.s.aTimerQueues[TMCLOCK_VIRTUAL].TimerLock, VERR_IGNORED);
     2766            PDMCritSectEnter(pVM, &pVM->tm.s.VirtualSyncLock, VERR_IGNORED);
    27672767            if (pVM->tm.s.fVirtualSyncTicking)
    27682768                Log2(("TMR3VirtualSyncFF: ticking (2)\n"));
     
    27792779                ASMAtomicWriteBool(&pVM->tm.s.fRunningVirtualSyncQueue, false);
    27802780            }
    2781             PDMCritSectLeave(&pVM->tm.s.VirtualSyncLock);
     2781            PDMCritSectLeave(pVM, &pVM->tm.s.VirtualSyncLock);
    27822782            STAM_PROFILE_STOP(&pVM->tm.s.StatVirtualSyncFF, a); /* before the unlock! */
    2783             PDMCritSectLeave(&pVM->tm.s.aTimerQueues[TMCLOCK_VIRTUAL].TimerLock);
     2783            PDMCritSectLeave(pVM, &pVM->tm.s.aTimerQueues[TMCLOCK_VIRTUAL].TimerLock);
    27842784        }
    27852785    }
     
    27902790 * Service the special virtual sync timer queue.
    27912791 *
    2792  * @param   pVM     The cross context VM structure.
     2792 * @param   pVM         The cross context VM structure.
    27932793 * @param   pVCpuDst    The destination VCpu.
    27942794 */
     
    27992799    {
    28002800        STAM_PROFILE_START(&pQueue->StatDo, s1);
    2801         PDMCritSectEnter(&pQueue->TimerLock, VERR_IGNORED);
    2802         PDMCritSectEnter(&pVM->tm.s.VirtualSyncLock, VERR_IGNORED);
     2801        PDMCritSectEnter(pVM, &pQueue->TimerLock, VERR_IGNORED);
     2802        PDMCritSectEnter(pVM, &pVM->tm.s.VirtualSyncLock, VERR_IGNORED);
    28032803        ASMAtomicWriteBool(&pVM->tm.s.fRunningVirtualSyncQueue, true);
    28042804        VMCPU_FF_CLEAR(pVCpuDst, VMCPU_FF_TIMER);   /* Clear the FF once we started working for real. */
     
    28102810
    28112811        ASMAtomicWriteBool(&pVM->tm.s.fRunningVirtualSyncQueue, false);
    2812         PDMCritSectLeave(&pVM->tm.s.VirtualSyncLock);
    2813         PDMCritSectLeave(&pQueue->TimerLock);
     2812        PDMCritSectLeave(pVM, &pVM->tm.s.VirtualSyncLock);
     2813        PDMCritSectLeave(pVM, &pQueue->TimerLock);
    28142814        STAM_PROFILE_STOP(&pQueue->StatDo, s1);
    28152815        ASMAtomicWriteBool(&pQueue->fBeingProcessed, false);
     
    29742974    /* Enter the critical sections to make TMTimerSet/Stop happy. */
    29752975    if (pQueue->enmClock == TMCLOCK_VIRTUAL_SYNC)
    2976         PDMCritSectEnter(&pVM->tm.s.VirtualSyncLock, VERR_IGNORED);
     2976        PDMCritSectEnter(pVM, &pVM->tm.s.VirtualSyncLock, VERR_IGNORED);
    29772977    PPDMCRITSECT pCritSect = pTimer->pCritSect;
    29782978    if (pCritSect)
    2979         PDMCritSectEnter(pCritSect, VERR_IGNORED);
     2979        PDMCritSectEnter(pVM, pCritSect, VERR_IGNORED);
    29802980
    29812981    if (u8State == TMTIMERSTATE_SAVED_PENDING_SCHEDULE)
     
    30053005
    30063006    if (pCritSect)
    3007         PDMCritSectLeave(pCritSect);
     3007        PDMCritSectLeave(pVM, pCritSect);
    30083008    if (pQueue->enmClock == TMCLOCK_VIRTUAL_SYNC)
    3009         PDMCritSectLeave(&pVM->tm.s.VirtualSyncLock);
     3009        PDMCritSectLeave(pVM, &pVM->tm.s.VirtualSyncLock);
    30103010
    30113011    /*
     
    31833183{
    31843184    VMCPU_ASSERT_EMT(pVCpu);
    3185     PDMCritSectEnter(&pVM->tm.s.VirtualSyncLock, VERR_IGNORED); /* Paranoia: Exploiting the virtual sync lock here. */
     3185    PDMCritSectEnter(pVM, &pVM->tm.s.VirtualSyncLock, VERR_IGNORED); /* Paranoia: Exploiting the virtual sync lock here. */
    31863186
    31873187    /*
     
    31893189     */
    31903190    int rc = tmVirtualPauseLocked(pVM);
    3191     AssertRCReturnStmt(rc, PDMCritSectLeave(&pVM->tm.s.VirtualSyncLock), rc);
     3191    AssertRCReturnStmt(rc, PDMCritSectLeave(pVM, &pVM->tm.s.VirtualSyncLock), rc);
    31923192
    31933193    /*
     
    31983198    {
    31993199        rc = tmCpuTickPauseLocked(pVM, pVCpu);
    3200         AssertRCReturnStmt(rc, PDMCritSectLeave(&pVM->tm.s.VirtualSyncLock), rc);
     3200        AssertRCReturnStmt(rc, PDMCritSectLeave(pVM, &pVM->tm.s.VirtualSyncLock), rc);
    32013201    }
    32023202
     
    32243224#endif
    32253225
    3226     PDMCritSectLeave(&pVM->tm.s.VirtualSyncLock);
     3226    PDMCritSectLeave(pVM, &pVM->tm.s.VirtualSyncLock);
    32273227    return VINF_SUCCESS;
    32283228}
     
    32403240{
    32413241    VMCPU_ASSERT_EMT(pVCpu);
    3242     PDMCritSectEnter(&pVM->tm.s.VirtualSyncLock, VERR_IGNORED); /* Paranoia: Exploiting the virtual sync lock here. */
     3242    PDMCritSectEnter(pVM, &pVM->tm.s.VirtualSyncLock, VERR_IGNORED); /* Paranoia: Exploiting the virtual sync lock here. */
    32433243
    32443244#ifndef VBOX_WITHOUT_NS_ACCOUNTING
     
    32613261    {
    32623262        int rc = tmCpuTickResumeLocked(pVM, pVCpu);
    3263         AssertRCReturnStmt(rc, PDMCritSectLeave(&pVM->tm.s.VirtualSyncLock), rc);
     3263        AssertRCReturnStmt(rc, PDMCritSectLeave(pVM, &pVM->tm.s.VirtualSyncLock), rc);
    32643264    }
    32653265
     
    32693269    int rc = tmVirtualResumeLocked(pVM);
    32703270
    3271     PDMCritSectLeave(&pVM->tm.s.VirtualSyncLock);
     3271    PDMCritSectLeave(pVM, &pVM->tm.s.VirtualSyncLock);
    32723272    return rc;
    32733273}
     
    33113311 * TM level and make it affect TMR3UTCNow as well! */
    33123312
    3313     PDMCritSectEnter(&pVM->tm.s.VirtualSyncLock, VERR_IGNORED); /* Paranoia: Exploiting the virtual sync lock here. */
     3313    PDMCritSectEnter(pVM, &pVM->tm.s.VirtualSyncLock, VERR_IGNORED); /* Paranoia: Exploiting the virtual sync lock here. */
    33143314
    33153315    /*
     
    33303330        TMR3NotifyResume(pVM, pVCpu);
    33313331
    3332     PDMCritSectLeave(&pVM->tm.s.VirtualSyncLock);
     3332    PDMCritSectLeave(pVM, &pVM->tm.s.VirtualSyncLock);
    33333333    return VINF_SUCCESS;
    33343334}
     
    39343934        const char * const  pszClock = tmR3Get5CharClockName(pQueue->enmClock);
    39353935        PDMCritSectRwEnterShared(&pQueue->AllocLock, VERR_IGNORED);
    3936         PDMCritSectEnter(&pQueue->TimerLock, VERR_IGNORED);
     3936        PDMCritSectEnter(pVM, &pQueue->TimerLock, VERR_IGNORED);
    39373937
    39383938        for (PTMTIMERR3 pTimer = tmTimerQueueGetHead(pQueue, pQueue);
     
    39543954        }
    39553955
    3956         PDMCritSectLeave(&pQueue->TimerLock);
     3956        PDMCritSectLeave(pVM, &pQueue->TimerLock);
    39573957        PDMCritSectRwLeaveShared(&pQueue->AllocLock);
    39583958    }
  • trunk/src/VBox/VMM/VMMR3/VMM.cpp

    r88347 r90346  
    23712371     */
    23722372    if (VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_PDM_CRITSECT))
    2373         PDMCritSectBothFF(pVCpu);
     2373        PDMCritSectBothFF(pVM, pVCpu);
    23742374
    23752375    switch (pVCpu->vmm.s.enmCallRing3Operation)
     
    23802380        case VMMCALLRING3_PDM_CRIT_SECT_ENTER:
    23812381        {
    2382             pVCpu->vmm.s.rcCallRing3 = PDMR3CritSectEnterEx((PPDMCRITSECT)(uintptr_t)pVCpu->vmm.s.u64CallRing3Arg,
     2382            pVCpu->vmm.s.rcCallRing3 = PDMR3CritSectEnterEx(pVM, (PPDMCRITSECT)(uintptr_t)pVCpu->vmm.s.u64CallRing3Arg,
    23832383                                                            true /*fCallRing3*/);
    23842384            break;
  • trunk/src/VBox/VMM/include/IOMInternal.h

    r89088 r90346  
    584584# define IOM_IS_EXCL_LOCK_OWNER(a_pVM)          PDMCritSectRwIsWriteOwner(&(a_pVM)->iom.s.CritSect)
    585585#else
    586 # define IOM_LOCK_EXCL(a_pVM)                   PDMCritSectEnter(&(a_pVM)->iom.s.CritSect, VERR_SEM_BUSY)
    587 # define IOM_UNLOCK_EXCL(a_pVM)                 do { PDMCritSectLeave(&(a_pVM)->iom.s.CritSect); } while (0)
    588 # define IOM_LOCK_SHARED_EX(a_pVM, a_rcBusy)    PDMCritSectEnter(&(a_pVM)->iom.s.CritSect, (a_rcBusy))
    589 # define IOM_UNLOCK_SHARED(a_pVM)               do { PDMCritSectLeave(&(a_pVM)->iom.s.CritSect); } while (0)
    590 # define IOM_IS_SHARED_LOCK_OWNER(a_pVM)        PDMCritSectIsOwner(&(a_pVM)->iom.s.CritSect)
    591 # define IOM_IS_EXCL_LOCK_OWNER(a_pVM)          PDMCritSectIsOwner(&(a_pVM)->iom.s.CritSect)
     586# define IOM_LOCK_EXCL(a_pVM)                   PDMCritSectEnter((a_pVM), &(a_pVM)->iom.s.CritSect, VERR_SEM_BUSY)
     587# define IOM_UNLOCK_EXCL(a_pVM)                 do { PDMCritSectLeave((a_pVM), &(a_pVM)->iom.s.CritSect); } while (0)
     588# define IOM_LOCK_SHARED_EX(a_pVM, a_rcBusy)    PDMCritSectEnter((a_pVM), &(a_pVM)->iom.s.CritSect, (a_rcBusy))
     589# define IOM_UNLOCK_SHARED(a_pVM)               do { PDMCritSectLeave((a_pVM), &(a_pVM)->iom.s.CritSect); } while (0)
     590# define IOM_IS_SHARED_LOCK_OWNER(a_pVM)        PDMCritSectIsOwner((a_pVM), &(a_pVM)->iom.s.CritSect)
     591# define IOM_IS_EXCL_LOCK_OWNER(a_pVM)          PDMCritSectIsOwner((a_pVM), &(a_pVM)->iom.s.CritSect)
    592592#endif
    593593#define IOM_LOCK_SHARED(a_pVM)                  IOM_LOCK_SHARED_EX(a_pVM, VERR_SEM_BUSY)
  • trunk/src/VBox/VMM/include/PDMInternal.h

    r89621 r90346  
    17001700int         pdmLockEx(PVMCC pVM, int rc);
    17011701void        pdmUnlock(PVMCC pVM);
    1702 bool        pdmLockIsOwner(PCVMCC pVM);
     1702bool        pdmLockIsOwner(PVMCC pVM);
    17031703
    17041704#if defined(VBOX_WITH_IOMMU_AMD) || defined(VBOX_WITH_IOMMU_INTEL)
  • trunk/src/VBox/VMM/include/PGMInternal.h

    r87485 r90346  
    39033903int             pgmLock(PVMCC pVM);
    39043904#endif
    3905 void            pgmUnlock(PVM pVM);
     3905void            pgmUnlock(PVMCC pVM);
    39063906/**
    39073907 * Asserts that the caller owns the PDM lock.
     
    39093909 * @param   a_pVM           Pointer to the VM.
    39103910 */
    3911 #define PGM_LOCK_ASSERT_OWNER(a_pVM)    Assert(PDMCritSectIsOwner(&(a_pVM)->pgm.s.CritSectX))
     3911#define PGM_LOCK_ASSERT_OWNER(a_pVM)    Assert(PDMCritSectIsOwner((a_pVM), &(a_pVM)->pgm.s.CritSectX))
    39123912/**
    39133913 * Asserts that the caller owns the PDM lock.
     
    39163916 * @param   a_pVCpu         The current CPU handle.
    39173917 */
    3918 #define PGM_LOCK_ASSERT_OWNER_EX(a_pVM, a_pVCpu)  Assert(PDMCritSectIsOwnerEx(&(a_pVM)->pgm.s.CritSectX, a_pVCpu))
     3918#define PGM_LOCK_ASSERT_OWNER_EX(a_pVM, a_pVCpu)  Assert(PDMCritSectIsOwnerEx((a_pVCpu), &(a_pVM)->pgm.s.CritSectX))
    39193919
    39203920#ifndef PGM_WITHOUT_MAPPINGS
     
    39663966void            pgmPhysInvalidRamRangeTlbs(PVMCC pVM);
    39673967void            pgmPhysInvalidatePageMapTLB(PVMCC pVM);
    3968 void            pgmPhysInvalidatePageMapTLBEntry(PVM pVM, RTGCPHYS GCPhys);
     3968void            pgmPhysInvalidatePageMapTLBEntry(PVMCC pVM, RTGCPHYS GCPhys);
    39693969PPGMRAMRANGE    pgmPhysGetRangeSlow(PVM pVM, RTGCPHYS GCPhys);
    39703970PPGMRAMRANGE    pgmPhysGetRangeAtOrAboveSlow(PVM pVM, RTGCPHYS GCPhys);
     
    40034003int             pgmPoolHCPhys2Ptr(PVM pVM, RTHCPHYS HCPhys, void **ppv);
    40044004int             pgmPoolSyncCR3(PVMCPUCC pVCpu);
    4005 bool            pgmPoolIsDirtyPageSlow(PVM pVM, RTGCPHYS GCPhys);
     4005bool            pgmPoolIsDirtyPageSlow(PVMCC pVM, RTGCPHYS GCPhys);
    40064006void            pgmPoolInvalidateDirtyPage(PVMCC pVM, RTGCPHYS GCPhysPT);
    40074007int             pgmPoolTrackUpdateGCPhys(PVMCC pVM, RTGCPHYS GCPhysPage, PPGMPAGE pPhysPage, bool fFlushPTEs, bool *pfFlushTLBs);
     
    40184018void            pgmPoolAddDirtyPage(PVMCC pVM, PPGMPOOL pPool, PPGMPOOLPAGE pPage);
    40194019void            pgmPoolResetDirtyPages(PVMCC pVM);
    4020 void            pgmPoolResetDirtyPage(PVM pVM, RTGCPTR GCPtrPage);
     4020void            pgmPoolResetDirtyPage(PVMCC pVM, RTGCPTR GCPtrPage);
    40214021
    40224022int             pgmR3ExitShadowModeBeforePoolFlush(PVMCPU pVCpu);
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