Changeset 90347 in vbox
- Timestamp:
- Jul 26, 2021 8:36:28 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 145911
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmcritsectrw.h
r82968 r90347 56 56 VMMR3DECL(int) PDMR3CritSectRwInit(PVM pVM, PPDMCRITSECTRW pCritSect, RT_SRC_POS_DECL, 57 57 const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR(6, 7); 58 VMMR3DECL(int) PDMR3CritSectRwDelete(P PDMCRITSECTRW pCritSect);58 VMMR3DECL(int) PDMR3CritSectRwDelete(PVM pVM, PPDMCRITSECTRW pCritSect); 59 59 VMMR3DECL(const char *) PDMR3CritSectRwName(PCPDMCRITSECTRW pCritSect); 60 VMMR3DECL(int) PDMR3CritSectRwEnterSharedEx(P PDMCRITSECTRW pThis, bool fCallRing3);61 VMMR3DECL(int) PDMR3CritSectRwEnterExclEx(P PDMCRITSECTRW pThis, bool fCallRing3);60 VMMR3DECL(int) PDMR3CritSectRwEnterSharedEx(PVM pVM, PPDMCRITSECTRW pThis, bool fCallRing3); 61 VMMR3DECL(int) PDMR3CritSectRwEnterExclEx(PVM pVM, PPDMCRITSECTRW pThis, bool fCallRing3); 62 62 63 VMMDECL(int) PDMCritSectRwEnterShared(P PDMCRITSECTRW pCritSect, int rcBusy);64 VMMDECL(int) PDMCritSectRwEnterSharedDebug(P PDMCRITSECTRW pCritSect, int rcBusy, RTHCUINTPTR uId, RT_SRC_POS_DECL);65 VMMDECL(int) PDMCritSectRwTryEnterShared(P PDMCRITSECTRW pCritSect);63 VMMDECL(int) PDMCritSectRwEnterShared(PVMCC pVM, PPDMCRITSECTRW pCritSect, int rcBusy); 64 VMMDECL(int) PDMCritSectRwEnterSharedDebug(PVMCC pVM, PPDMCRITSECTRW pCritSect, int rcBusy, RTHCUINTPTR uId, RT_SRC_POS_DECL); 65 VMMDECL(int) PDMCritSectRwTryEnterShared(PVMCC pVM, PPDMCRITSECTRW pCritSect); 66 66 VMMDECL(int) PDMCritSectRwTryEnterSharedDebug(PPDMCRITSECTRW pCritSect, RTHCUINTPTR uId, RT_SRC_POS_DECL); 67 VMMDECL(int) PDMCritSectRwLeaveShared(P PDMCRITSECTRW pCritSect);68 VMMDECL(int) PDMCritSectRwEnterExcl(P PDMCRITSECTRW pCritSect, int rcBusy);69 VMMDECL(int) PDMCritSectRwEnterExclDebug(P PDMCRITSECTRW pCritSect, int rcBusy, RTHCUINTPTR uId, RT_SRC_POS_DECL);70 VMMDECL(int) PDMCritSectRwTryEnterExcl(P PDMCRITSECTRW pCritSect);71 VMMDECL(int) PDMCritSectRwTryEnterExclDebug(P PDMCRITSECTRW pCritSect, RTHCUINTPTR uId, RT_SRC_POS_DECL);72 VMMDECL(int) PDMCritSectRwLeaveExcl(P PDMCRITSECTRW pCritSect);67 VMMDECL(int) PDMCritSectRwLeaveShared(PVMCC pVM, PPDMCRITSECTRW pCritSect); 68 VMMDECL(int) PDMCritSectRwEnterExcl(PVMCC pVM, PPDMCRITSECTRW pCritSect, int rcBusy); 69 VMMDECL(int) PDMCritSectRwEnterExclDebug(PVMCC pVM, PPDMCRITSECTRW pCritSect, int rcBusy, RTHCUINTPTR uId, RT_SRC_POS_DECL); 70 VMMDECL(int) PDMCritSectRwTryEnterExcl(PVMCC pVM, PPDMCRITSECTRW pCritSect); 71 VMMDECL(int) PDMCritSectRwTryEnterExclDebug(PVMCC pVM, PPDMCRITSECTRW pCritSect, RTHCUINTPTR uId, RT_SRC_POS_DECL); 72 VMMDECL(int) PDMCritSectRwLeaveExcl(PVMCC pVM, PPDMCRITSECTRW pCritSect); 73 73 74 VMMDECL(bool) PDMCritSectRwIsWriteOwner(P PDMCRITSECTRW pCritSect);75 VMMDECL(bool) PDMCritSectRwIsReadOwner(P PDMCRITSECTRW pCritSect, bool fWannaHear);74 VMMDECL(bool) PDMCritSectRwIsWriteOwner(PVMCC pVM, PPDMCRITSECTRW pCritSect); 75 VMMDECL(bool) PDMCritSectRwIsReadOwner(PVMCC pVM, PPDMCRITSECTRW pCritSect, bool fWannaHear); 76 76 VMMDECL(uint32_t) PDMCritSectRwGetWriteRecursion(PPDMCRITSECTRW pCritSect); 77 77 VMMDECL(uint32_t) PDMCritSectRwGetWriterReadRecursion(PPDMCRITSECTRW pCritSect); … … 82 82 #ifdef VBOX_STRICT 83 83 # ifdef IPRT_INCLUDED_asm_h 84 # define PDMCritSectRwEnterExcl( pCritSect, rcBusy) PDMCritSectRwEnterExclDebug(pCritSect, rcBusy, (uintptr_t)ASMReturnAddress(), RT_SRC_POS)85 # define PDMCritSectRwTryEnterExcl( pCritSect) PDMCritSectRwTryEnterExclDebug(pCritSect, (uintptr_t)ASMReturnAddress(), RT_SRC_POS)86 # define PDMCritSectRwEnterShared( pCritSect, rcBusy) PDMCritSectRwEnterSharedDebug(pCritSect, rcBusy, (uintptr_t)ASMReturnAddress(), RT_SRC_POS)87 # define PDMCritSectRwTryEnterShared( pCritSect) PDMCritSectRwTryEnterSharedDebug(pCritSect, (uintptr_t)ASMReturnAddress(), RT_SRC_POS)84 # define PDMCritSectRwEnterExcl(a_pVM, pCritSect, rcBusy) PDMCritSectRwEnterExclDebug((a_pVM), pCritSect, rcBusy, (uintptr_t)ASMReturnAddress(), RT_SRC_POS) 85 # define PDMCritSectRwTryEnterExcl(a_pVM, pCritSect) PDMCritSectRwTryEnterExclDebug((a_pVM), pCritSect, (uintptr_t)ASMReturnAddress(), RT_SRC_POS) 86 # define PDMCritSectRwEnterShared(a_pVM, pCritSect, rcBusy) PDMCritSectRwEnterSharedDebug((a_pVM), pCritSect, rcBusy, (uintptr_t)ASMReturnAddress(), RT_SRC_POS) 87 # define PDMCritSectRwTryEnterShared(a_pVM, pCritSect) PDMCritSectRwTryEnterSharedDebug((a_pVM), pCritSect, (uintptr_t)ASMReturnAddress(), RT_SRC_POS) 88 88 # else 89 # define PDMCritSectRwEnterExcl( pCritSect, rcBusy) PDMCritSectRwEnterExclDebug(pCritSect, rcBusy, 0, RT_SRC_POS)90 # define PDMCritSectRwTryEnterExcl( pCritSect) PDMCritSectRwTryEnterExclDebug(pCritSect, 0, RT_SRC_POS)91 # define PDMCritSectRwEnterShared( pCritSect, rcBusy) PDMCritSectRwEnterSharedDebug(pCritSect, rcBusy, 0, RT_SRC_POS)92 # define PDMCritSectRwTryEnterShared( pCritSect) PDMCritSectRwTryEnterSharedDebug(pCritSect, 0, RT_SRC_POS)89 # define PDMCritSectRwEnterExcl(a_pVM, pCritSect, rcBusy) PDMCritSectRwEnterExclDebug((a_pVM), pCritSect, rcBusy, 0, RT_SRC_POS) 90 # define PDMCritSectRwTryEnterExcl(a_pVM, pCritSect) PDMCritSectRwTryEnterExclDebug((a_pVM), pCritSect, 0, RT_SRC_POS) 91 # define PDMCritSectRwEnterShared(a_pVM, pCritSect, rcBusy) PDMCritSectRwEnterSharedDebug((a_pVM), pCritSect, rcBusy, 0, RT_SRC_POS) 92 # define PDMCritSectRwTryEnterShared(a_pVM, pCritSect) PDMCritSectRwTryEnterSharedDebug((a_pVM), pCritSect, 0, RT_SRC_POS) 93 93 # endif 94 94 #endif -
trunk/src/VBox/VMM/VMMAll/PDMAllCritSectBoth.cpp
r90346 r90347 58 58 # endif 59 59 60 pdmCritSectRwLeaveSharedQueued(p CritSectRw);60 pdmCritSectRwLeaveSharedQueued(pVM, pCritSectRw); 61 61 LogFlow(("PDMR3CritSectFF: %p (R/W)\n", pCritSectRw)); 62 62 } … … 74 74 # endif 75 75 76 pdmCritSectRwLeaveExclQueued(p CritSectRw);76 pdmCritSectRwLeaveExclQueued(pVM, pCritSectRw); 77 77 LogFlow(("PDMR3CritSectFF: %p (R/W)\n", pCritSectRw)); 78 78 } -
trunk/src/VBox/VMM/VMMAll/PDMAllCritSectRw.cpp
r82968 r90347 74 74 * R0 and RC. 75 75 */ 76 DECL_FORCE_INLINE(RTNATIVETHREAD) pdmCritSectRwGetNativeSelf(P CPDMCRITSECTRW pThis)76 DECL_FORCE_INLINE(RTNATIVETHREAD) pdmCritSectRwGetNativeSelf(PVMCC pVM, PCPDMCRITSECTRW pThis) 77 77 { 78 78 #ifdef IN_RING3 79 NOREF(pThis);79 RT_NOREF(pVM, pThis); 80 80 RTNATIVETHREAD hNativeSelf = RTThreadNativeSelf(); 81 81 #else 82 82 AssertMsgReturn(pThis->s.Core.u32Magic == RTCRITSECTRW_MAGIC, ("%RX32\n", pThis->s.Core.u32Magic), 83 83 NIL_RTNATIVETHREAD); 84 PVMC C pVM = pThis->s.CTX_SUFF(pVM); AssertPtr(pVM);85 PVMCPUCC pVCpu = VMMGetCpu(pVM); AssertPtr(pVCpu);86 RTNATIVETHREAD hNativeSelf = pVCpu->hNativeThread;Assert(hNativeSelf != NIL_RTNATIVETHREAD);84 PVMCPUCC pVCpu = VMMGetCpu(pVM); AssertPtr(pVCpu); 85 RTNATIVETHREAD hNativeSelf = pVCpu ? pVCpu->hNativeThread : NIL_RTNATIVETHREAD; 86 Assert(hNativeSelf != NIL_RTNATIVETHREAD); 87 87 #endif 88 88 return hNativeSelf; … … 143 143 * 144 144 * @returns VBox status code. 145 * @param pVM The cross context VM structure. 145 146 * @param pThis Pointer to the read/write critical section. 146 147 * @param rcBusy The busy return code for ring-0 and ring-3. … … 149 150 * @param fNoVal No validation records. 150 151 */ 151 static int pdmCritSectRwEnterShared(PPDMCRITSECTRW pThis, int rcBusy, bool fTryOnly, PCRTLOCKVALSRCPOS pSrcPos, bool fNoVal) 152 static int pdmCritSectRwEnterShared(PVMCC pVM, PPDMCRITSECTRW pThis, int rcBusy, bool fTryOnly, 153 PCRTLOCKVALSRCPOS pSrcPos, bool fNoVal) 152 154 { 153 155 /* … … 156 158 AssertPtr(pThis); 157 159 AssertReturn(pThis->s.Core.u32Magic == RTCRITSECTRW_MAGIC, VERR_SEM_DESTROYED); 160 Assert(pThis->s.CTX_SUFF(pVM) == pVM); 158 161 159 162 #if !defined(PDMCRITSECTRW_STRICT) || !defined(IN_RING3) … … 163 166 #ifdef IN_RING3 164 167 NOREF(rcBusy); 168 NOREF(pVM); 165 169 #endif 166 170 … … 172 176 RTNATIVETHREAD hNativeWriter; 173 177 ASMAtomicUoReadHandle(&pThis->s.Core.hNativeWriter, &hNativeWriter); 174 if (hNativeWriter != NIL_RTTHREAD && hNativeWriter == pdmCritSectRwGetNativeSelf(p This))178 if (hNativeWriter != NIL_RTTHREAD && hNativeWriter == pdmCritSectRwGetNativeSelf(pVM, pThis)) 175 179 rc9 = RTLockValidatorRecExclCheckOrder(pThis->s.Core.pValidatorWrite, hThreadSelf, pSrcPos, RT_INDEFINITE_WAIT); 176 180 else … … 224 228 { 225 229 /* Is the writer perhaps doing a read recursion? */ 226 RTNATIVETHREAD hNativeSelf = pdmCritSectRwGetNativeSelf(p This);230 RTNATIVETHREAD hNativeSelf = pdmCritSectRwGetNativeSelf(pVM, pThis); 227 231 RTNATIVETHREAD hNativeWriter; 228 232 ASMAtomicUoReadHandle(&pThis->s.Core.hNativeWriter, &hNativeWriter); … … 291 295 for (;;) 292 296 { 293 rc = SUPSemEventMultiWaitNoResume(p This->s.CTX_SUFF(pVM)->pSession,297 rc = SUPSemEventMultiWaitNoResume(pVM->pSession, 294 298 (SUPSEMEVENTMULTI)pThis->s.Core.hEvtRead, 295 299 RT_INDEFINITE_WAIT); … … 349 353 if (ASMAtomicXchgBool(&pThis->s.Core.fNeedReset, false)) 350 354 { 351 int rc = SUPSemEventMultiReset(pThis->s.CTX_SUFF(pVM)->pSession, 352 (SUPSEMEVENTMULTI)pThis->s.Core.hEvtRead); 355 int rc = SUPSemEventMultiReset(pVM->pSession, (SUPSEMEVENTMULTI)pThis->s.Core.hEvtRead); 353 356 AssertRCReturn(rc, rc); 354 357 } … … 379 382 if (rcBusy == VINF_SUCCESS) 380 383 { 381 PVMCC pVM = pThis->s.CTX_SUFF(pVM); AssertPtr(pVM); 382 PVMCPUCC pVCpu = VMMGetCpu(pVM); AssertPtr(pVCpu); 384 PVMCPUCC pVCpu = VMMGetCpu(pVM); AssertPtr(pVCpu); 383 385 /** @todo Should actually do this in via VMMR0.cpp instead of going all the way 384 386 * back to ring-3. Goes for both kind of crit sects. */ … … 416 418 * during the operation. 417 419 * 420 * @param pVM The cross context VM structure. 418 421 * @param pThis Pointer to the read/write critical section. 419 422 * @param rcBusy The status code to return when we're in RC or R0 and the … … 424 427 * RTCritSectRwEnterShared. 425 428 */ 426 VMMDECL(int) PDMCritSectRwEnterShared(P PDMCRITSECTRW pThis, int rcBusy)429 VMMDECL(int) PDMCritSectRwEnterShared(PVMCC pVM, PPDMCRITSECTRW pThis, int rcBusy) 427 430 { 428 431 #if !defined(PDMCRITSECTRW_STRICT) || !defined(IN_RING3) 429 return pdmCritSectRwEnterShared(p This, rcBusy, false /*fTryOnly*/, NULL, false /*fNoVal*/);432 return pdmCritSectRwEnterShared(pVM, pThis, rcBusy, false /*fTryOnly*/, NULL, false /*fNoVal*/); 430 433 #else 431 434 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API(); 432 return pdmCritSectRwEnterShared(p This, rcBusy, false /*fTryOnly*/, &SrcPos, false /*fNoVal*/);435 return pdmCritSectRwEnterShared(pVM, pThis, rcBusy, false /*fTryOnly*/, &SrcPos, false /*fNoVal*/); 433 436 #endif 434 437 } … … 445 448 * during the operation. 446 449 * 450 * @param pVM The cross context VM structure. 447 451 * @param pThis Pointer to the read/write critical section. 448 452 * @param rcBusy The status code to return when we're in RC or R0 and the … … 455 459 * RTCritSectRwEnterSharedDebug. 456 460 */ 457 VMMDECL(int) PDMCritSectRwEnterSharedDebug(P PDMCRITSECTRW pThis, int rcBusy, RTHCUINTPTR uId, RT_SRC_POS_DECL)461 VMMDECL(int) PDMCritSectRwEnterSharedDebug(PVMCC pVM, PPDMCRITSECTRW pThis, int rcBusy, RTHCUINTPTR uId, RT_SRC_POS_DECL) 458 462 { 459 463 NOREF(uId); NOREF(pszFile); NOREF(iLine); NOREF(pszFunction); 460 464 #if !defined(PDMCRITSECTRW_STRICT) || !defined(IN_RING3) 461 return pdmCritSectRwEnterShared(p This, rcBusy, false /*fTryOnly*/, NULL, false /*fNoVal*/);465 return pdmCritSectRwEnterShared(pVM, pThis, rcBusy, false /*fTryOnly*/, NULL, false /*fNoVal*/); 462 466 #else 463 467 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API(); 464 return pdmCritSectRwEnterShared(p This, rcBusy, false /*fTryOnly*/, &SrcPos, false /*fNoVal*/);468 return pdmCritSectRwEnterShared(pVM, pThis, rcBusy, false /*fTryOnly*/, &SrcPos, false /*fNoVal*/); 465 469 #endif 466 470 } … … 477 481 * during the operation. 478 482 * 483 * @param pVM The cross context VM structure. 479 484 * @param pThis Pointer to the read/write critical section. 480 485 * @sa PDMCritSectRwTryEnterSharedDebug, PDMCritSectRwEnterShared, … … 482 487 * RTCritSectRwTryEnterShared. 483 488 */ 484 VMMDECL(int) PDMCritSectRwTryEnterShared(P PDMCRITSECTRW pThis)489 VMMDECL(int) PDMCritSectRwTryEnterShared(PVMCC pVM, PPDMCRITSECTRW pThis) 485 490 { 486 491 #if !defined(PDMCRITSECTRW_STRICT) || !defined(IN_RING3) 487 return pdmCritSectRwEnterShared(p This, VERR_SEM_BUSY, true /*fTryOnly*/, NULL, false /*fNoVal*/);492 return pdmCritSectRwEnterShared(pVM, pThis, VERR_SEM_BUSY, true /*fTryOnly*/, NULL, false /*fNoVal*/); 488 493 #else 489 494 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API(); 490 return pdmCritSectRwEnterShared(p This, VERR_SEM_BUSY, true /*fTryOnly*/, &SrcPos, false /*fNoVal*/);495 return pdmCritSectRwEnterShared(pVM, pThis, VERR_SEM_BUSY, true /*fTryOnly*/, &SrcPos, false /*fNoVal*/); 491 496 #endif 492 497 } … … 503 508 * during the operation. 504 509 * 510 * @param pVM The cross context VM structure. 505 511 * @param pThis Pointer to the read/write critical section. 506 512 * @param uId Where we're entering the section. … … 510 516 * RTCritSectRwTryEnterSharedDebug. 511 517 */ 512 VMMDECL(int) PDMCritSectRwTryEnterSharedDebug(P PDMCRITSECTRW pThis, RTHCUINTPTR uId, RT_SRC_POS_DECL)518 VMMDECL(int) PDMCritSectRwTryEnterSharedDebug(PVMCC pVM, PPDMCRITSECTRW pThis, RTHCUINTPTR uId, RT_SRC_POS_DECL) 513 519 { 514 520 NOREF(uId); NOREF(pszFile); NOREF(iLine); NOREF(pszFunction); 515 521 #if !defined(PDMCRITSECTRW_STRICT) || !defined(IN_RING3) 516 return pdmCritSectRwEnterShared(p This, VERR_SEM_BUSY, true /*fTryOnly*/, NULL, false /*fNoVal*/);522 return pdmCritSectRwEnterShared(pVM, pThis, VERR_SEM_BUSY, true /*fTryOnly*/, NULL, false /*fNoVal*/); 517 523 #else 518 524 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API(); 519 return pdmCritSectRwEnterShared(p This, VERR_SEM_BUSY, true /*fTryOnly*/, &SrcPos, false /*fNoVal*/);525 return pdmCritSectRwEnterShared(pVM, pThis, VERR_SEM_BUSY, true /*fTryOnly*/, &SrcPos, false /*fNoVal*/); 520 526 #endif 521 527 } … … 530 536 * during the operation. 531 537 * 538 * @param pVM The cross context VM structure. 532 539 * @param pThis Pointer to the read/write critical section. 533 540 * @param fCallRing3 Whether this is a VMMRZCallRing3()request. 534 541 */ 535 VMMR3DECL(int) PDMR3CritSectRwEnterSharedEx(P PDMCRITSECTRW pThis, bool fCallRing3)536 { 537 return pdmCritSectRwEnterShared(p This, VERR_SEM_BUSY, false /*fTryAgain*/, NULL, fCallRing3);542 VMMR3DECL(int) PDMR3CritSectRwEnterSharedEx(PVM pVM, PPDMCRITSECTRW pThis, bool fCallRing3) 543 { 544 return pdmCritSectRwEnterShared(pVM, pThis, VERR_SEM_BUSY, false /*fTryAgain*/, NULL, fCallRing3); 538 545 } 539 546 #endif … … 546 553 * @retval VERR_SEM_DESTROYED if the critical section is delete before or 547 554 * during the operation. 555 * @param pVM The cross context VM structure. 548 556 * @param pThis Pointer to the read/write critical section. 549 557 * @param fNoVal No validation records (i.e. queued release). … … 552 560 * PDMCritSectRwLeaveExcl, RTCritSectRwLeaveShared. 553 561 */ 554 static int pdmCritSectRwLeaveSharedWorker(P PDMCRITSECTRW pThis, bool fNoVal)562 static int pdmCritSectRwLeaveSharedWorker(PVMCC pVM, PPDMCRITSECTRW pThis, bool fNoVal) 555 563 { 556 564 /* … … 559 567 AssertPtr(pThis); 560 568 AssertReturn(pThis->s.Core.u32Magic == RTCRITSECTRW_MAGIC, VERR_SEM_DESTROYED); 569 Assert(pThis->s.CTX_SUFF(pVM) == pVM); 561 570 562 571 #if !defined(PDMCRITSECTRW_STRICT) || !defined(IN_RING3) … … 609 618 if (ASMAtomicCmpXchgU64(&pThis->s.Core.u64State, u64State, u64OldState)) 610 619 { 611 int rc = SUPSemEventSignal(p This->s.CTX_SUFF(pVM)->pSession, (SUPSEMEVENT)pThis->s.Core.hEvtWrite);620 int rc = SUPSemEventSignal(pVM->pSession, (SUPSEMEVENT)pThis->s.Core.hEvtWrite); 612 621 AssertRC(rc); 613 622 break; … … 621 630 { 622 631 /* Queue the exit request (ring-3). */ 623 PVMCC pVM = pThis->s.CTX_SUFF(pVM); AssertPtr(pVM);624 632 PVMCPUCC pVCpu = VMMGetCpu(pVM); AssertPtr(pVCpu); 625 633 uint32_t i = pVCpu->pdm.s.cQueuedCritSectRwShrdLeaves++; … … 643 651 else 644 652 { 645 RTNATIVETHREAD hNativeSelf = pdmCritSectRwGetNativeSelf(p This);653 RTNATIVETHREAD hNativeSelf = pdmCritSectRwGetNativeSelf(pVM, pThis); 646 654 RTNATIVETHREAD hNativeWriter; 647 655 ASMAtomicUoReadHandle(&pThis->s.Core.hNativeWriter, &hNativeWriter); … … 668 676 * @retval VERR_SEM_DESTROYED if the critical section is delete before or 669 677 * during the operation. 678 * @param pVM The cross context VM structure. 670 679 * @param pThis Pointer to the read/write critical section. 671 680 * @sa PDMCritSectRwEnterShared, PDMCritSectRwTryEnterShared, … … 673 682 * PDMCritSectRwLeaveExcl, RTCritSectRwLeaveShared. 674 683 */ 675 VMMDECL(int) PDMCritSectRwLeaveShared(P PDMCRITSECTRW pThis)676 { 677 return pdmCritSectRwLeaveSharedWorker(p This, false /*fNoVal*/);684 VMMDECL(int) PDMCritSectRwLeaveShared(PVMCC pVM, PPDMCRITSECTRW pThis) 685 { 686 return pdmCritSectRwLeaveSharedWorker(pVM, pThis, false /*fNoVal*/); 678 687 } 679 688 … … 683 692 * PDMCritSectBothFF interface. 684 693 * 685 * @param pThis Pointer to the read/write critical section. 686 */ 687 void pdmCritSectRwLeaveSharedQueued(PPDMCRITSECTRW pThis) 688 { 689 pdmCritSectRwLeaveSharedWorker(pThis, true /*fNoVal*/); 694 * @param pVM The cross context VM structure. 695 * @param pThis Pointer to the read/write critical section. 696 */ 697 void pdmCritSectRwLeaveSharedQueued(PVMCC pVM, PPDMCRITSECTRW pThis) 698 { 699 pdmCritSectRwLeaveSharedWorker(pVM, pThis, true /*fNoVal*/); 690 700 } 691 701 #endif … … 696 706 * 697 707 * @returns VBox status code. 708 * @param pVM The cross context VM structure. 698 709 * @param pThis Pointer to the read/write critical section. 699 710 * @param rcBusy The busy return code for ring-0 and ring-3. … … 702 713 * @param fNoVal No validation records. 703 714 */ 704 static int pdmCritSectRwEnterExcl(PPDMCRITSECTRW pThis, int rcBusy, bool fTryOnly, PCRTLOCKVALSRCPOS pSrcPos, bool fNoVal) 715 static int pdmCritSectRwEnterExcl(PVMCC pVM, PPDMCRITSECTRW pThis, int rcBusy, bool fTryOnly, 716 PCRTLOCKVALSRCPOS pSrcPos, bool fNoVal) 705 717 { 706 718 /* … … 709 721 AssertPtr(pThis); 710 722 AssertReturn(pThis->s.Core.u32Magic == RTCRITSECTRW_MAGIC, VERR_SEM_DESTROYED); 723 Assert(pThis->s.CTX_SUFF(pVM) == pVM); 711 724 712 725 #if !defined(PDMCRITSECTRW_STRICT) || !defined(IN_RING3) … … 716 729 #ifdef IN_RING3 717 730 NOREF(rcBusy); 731 NOREF(pVM); 718 732 #endif 719 733 … … 732 746 * Check if we're already the owner and just recursing. 733 747 */ 734 RTNATIVETHREAD hNativeSelf = pdmCritSectRwGetNativeSelf(p This);748 RTNATIVETHREAD hNativeSelf = pdmCritSectRwGetNativeSelf(pVM, pThis); 735 749 RTNATIVETHREAD hNativeWriter; 736 750 ASMAtomicUoReadHandle(&pThis->s.Core.hNativeWriter, &hNativeWriter); … … 852 866 for (;;) 853 867 { 854 rc = SUPSemEventWaitNoResume(p This->s.CTX_SUFF(pVM)->pSession,868 rc = SUPSemEventWaitNoResume(pVM->pSession, 855 869 (SUPSEMEVENT)pThis->s.Core.hEvtWrite, 856 870 RT_INDEFINITE_WAIT); … … 922 936 { 923 937 Assert(!fTryOnly); 924 PVMCC pVM = pThis->s.CTX_SUFF(pVM); AssertPtr(pVM); 925 PVMCPUCC pVCpu = VMMGetCpu(pVM); AssertPtr(pVCpu); 938 PVMCPUCC pVCpu = VMMGetCpu(pVM); AssertPtr(pVCpu); 926 939 /** @todo Should actually do this in via VMMR0.cpp instead of going all the way 927 940 * back to ring-3. Goes for both kind of crit sects. */ … … 960 973 * during the operation. 961 974 * 975 * @param pVM The cross context VM structure. 962 976 * @param pThis Pointer to the read/write critical section. 963 977 * @param rcBusy The status code to return when we're in RC or R0 and the … … 969 983 * RTCritSectRwEnterExcl. 970 984 */ 971 VMMDECL(int) PDMCritSectRwEnterExcl(P PDMCRITSECTRW pThis, int rcBusy)985 VMMDECL(int) PDMCritSectRwEnterExcl(PVMCC pVM, PPDMCRITSECTRW pThis, int rcBusy) 972 986 { 973 987 #if !defined(PDMCRITSECTRW_STRICT) || !defined(IN_RING3) 974 return pdmCritSectRwEnterExcl(p This, rcBusy, false /*fTryAgain*/, NULL, false /*fNoVal*/);988 return pdmCritSectRwEnterExcl(pVM, pThis, rcBusy, false /*fTryAgain*/, NULL, false /*fNoVal*/); 975 989 #else 976 990 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API(); 977 return pdmCritSectRwEnterExcl(p This, rcBusy, false /*fTryAgain*/, &SrcPos, false /*fNoVal*/);991 return pdmCritSectRwEnterExcl(pVM, pThis, rcBusy, false /*fTryAgain*/, &SrcPos, false /*fNoVal*/); 978 992 #endif 979 993 } … … 990 1004 * during the operation. 991 1005 * 1006 * @param pVM The cross context VM structure. 992 1007 * @param pThis Pointer to the read/write critical section. 993 1008 * @param rcBusy The status code to return when we're in RC or R0 and the … … 1001 1016 * RTCritSectRwEnterExclDebug. 1002 1017 */ 1003 VMMDECL(int) PDMCritSectRwEnterExclDebug(P PDMCRITSECTRW pThis, int rcBusy, RTHCUINTPTR uId, RT_SRC_POS_DECL)1018 VMMDECL(int) PDMCritSectRwEnterExclDebug(PVMCC pVM, PPDMCRITSECTRW pThis, int rcBusy, RTHCUINTPTR uId, RT_SRC_POS_DECL) 1004 1019 { 1005 1020 NOREF(uId); NOREF(pszFile); NOREF(iLine); NOREF(pszFunction); 1006 1021 #if !defined(PDMCRITSECTRW_STRICT) || !defined(IN_RING3) 1007 return pdmCritSectRwEnterExcl(p This, rcBusy, false /*fTryAgain*/, NULL, false /*fNoVal*/);1022 return pdmCritSectRwEnterExcl(pVM, pThis, rcBusy, false /*fTryAgain*/, NULL, false /*fNoVal*/); 1008 1023 #else 1009 1024 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API(); 1010 return pdmCritSectRwEnterExcl(p This, rcBusy, false /*fTryAgain*/, &SrcPos, false /*fNoVal*/);1025 return pdmCritSectRwEnterExcl(pVM, pThis, rcBusy, false /*fTryAgain*/, &SrcPos, false /*fNoVal*/); 1011 1026 #endif 1012 1027 } … … 1022 1037 * during the operation. 1023 1038 * 1039 * @param pVM The cross context VM structure. 1024 1040 * @param pThis Pointer to the read/write critical section. 1025 1041 * @sa PDMCritSectRwEnterExcl, PDMCritSectRwTryEnterExclDebug, … … 1028 1044 * RTCritSectRwTryEnterExcl. 1029 1045 */ 1030 VMMDECL(int) PDMCritSectRwTryEnterExcl(P PDMCRITSECTRW pThis)1046 VMMDECL(int) PDMCritSectRwTryEnterExcl(PVMCC pVM, PPDMCRITSECTRW pThis) 1031 1047 { 1032 1048 #if !defined(PDMCRITSECTRW_STRICT) || !defined(IN_RING3) 1033 return pdmCritSectRwEnterExcl(p This, VERR_SEM_BUSY, true /*fTryAgain*/, NULL, false /*fNoVal*/);1049 return pdmCritSectRwEnterExcl(pVM, pThis, VERR_SEM_BUSY, true /*fTryAgain*/, NULL, false /*fNoVal*/); 1034 1050 #else 1035 1051 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API(); 1036 return pdmCritSectRwEnterExcl(p This, VERR_SEM_BUSY, true /*fTryAgain*/, &SrcPos, false /*fNoVal*/);1052 return pdmCritSectRwEnterExcl(pVM, pThis, VERR_SEM_BUSY, true /*fTryAgain*/, &SrcPos, false /*fNoVal*/); 1037 1053 #endif 1038 1054 } … … 1048 1064 * during the operation. 1049 1065 * 1066 * @param pVM The cross context VM structure. 1050 1067 * @param pThis Pointer to the read/write critical section. 1051 1068 * @param uId Where we're entering the section. … … 1056 1073 * RTCritSectRwTryEnterExclDebug. 1057 1074 */ 1058 VMMDECL(int) PDMCritSectRwTryEnterExclDebug(P PDMCRITSECTRW pThis, RTHCUINTPTR uId, RT_SRC_POS_DECL)1075 VMMDECL(int) PDMCritSectRwTryEnterExclDebug(PVMCC pVM, PPDMCRITSECTRW pThis, RTHCUINTPTR uId, RT_SRC_POS_DECL) 1059 1076 { 1060 1077 NOREF(uId); NOREF(pszFile); NOREF(iLine); NOREF(pszFunction); 1061 1078 #if !defined(PDMCRITSECTRW_STRICT) || !defined(IN_RING3) 1062 return pdmCritSectRwEnterExcl(p This, VERR_SEM_BUSY, true /*fTryAgain*/, NULL, false /*fNoVal*/);1079 return pdmCritSectRwEnterExcl(pVM, pThis, VERR_SEM_BUSY, true /*fTryAgain*/, NULL, false /*fNoVal*/); 1063 1080 #else 1064 1081 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API(); 1065 return pdmCritSectRwEnterExcl(p This, VERR_SEM_BUSY, true /*fTryAgain*/, &SrcPos, false /*fNoVal*/);1082 return pdmCritSectRwEnterExcl(pVM, pThis, VERR_SEM_BUSY, true /*fTryAgain*/, &SrcPos, false /*fNoVal*/); 1066 1083 #endif 1067 1084 } … … 1076 1093 * during the operation. 1077 1094 * 1095 * @param pVM The cross context VM structure. 1078 1096 * @param pThis Pointer to the read/write critical section. 1079 1097 * @param fCallRing3 Whether this is a VMMRZCallRing3()request. 1080 1098 */ 1081 VMMR3DECL(int) PDMR3CritSectRwEnterExclEx(P PDMCRITSECTRW pThis, bool fCallRing3)1082 { 1083 return pdmCritSectRwEnterExcl(p This, VERR_SEM_BUSY, false /*fTryAgain*/, NULL, fCallRing3 /*fNoVal*/);1099 VMMR3DECL(int) PDMR3CritSectRwEnterExclEx(PVM pVM, PPDMCRITSECTRW pThis, bool fCallRing3) 1100 { 1101 return pdmCritSectRwEnterExcl(pVM, pThis, VERR_SEM_BUSY, false /*fTryAgain*/, NULL, fCallRing3 /*fNoVal*/); 1084 1102 } 1085 1103 #endif /* IN_RING3 */ … … 1092 1110 * @retval VERR_SEM_DESTROYED if the critical section is delete before or 1093 1111 * during the operation. 1112 * @param pVM The cross context VM structure. 1094 1113 * @param pThis Pointer to the read/write critical section. 1095 1114 * @param fNoVal No validation records (i.e. queued release). 1096 1115 * @sa PDMCritSectRwLeaveShared, RTCritSectRwLeaveExcl. 1097 1116 */ 1098 static int pdmCritSectRwLeaveExclWorker(P PDMCRITSECTRW pThis, bool fNoVal)1117 static int pdmCritSectRwLeaveExclWorker(PVMCC pVM, PPDMCRITSECTRW pThis, bool fNoVal) 1099 1118 { 1100 1119 /* … … 1103 1122 AssertPtr(pThis); 1104 1123 AssertReturn(pThis->s.Core.u32Magic == RTCRITSECTRW_MAGIC, VERR_SEM_DESTROYED); 1124 Assert(pThis->s.CTX_SUFF(pVM) == pVM); 1105 1125 1106 1126 #if !defined(PDMCRITSECTRW_STRICT) || !defined(IN_RING3) … … 1108 1128 #endif 1109 1129 1110 RTNATIVETHREAD hNativeSelf = pdmCritSectRwGetNativeSelf(p This);1130 RTNATIVETHREAD hNativeSelf = pdmCritSectRwGetNativeSelf(pVM, pThis); 1111 1131 RTNATIVETHREAD hNativeWriter; 1112 1132 ASMAtomicUoReadHandle(&pThis->s.Core.hNativeWriter, &hNativeWriter); … … 1161 1181 if (c > 0) 1162 1182 { 1163 int rc = SUPSemEventSignal(p This->s.CTX_SUFF(pVM)->pSession, (SUPSEMEVENT)pThis->s.Core.hEvtWrite);1183 int rc = SUPSemEventSignal(pVM->pSession, (SUPSEMEVENT)pThis->s.Core.hEvtWrite); 1164 1184 AssertRC(rc); 1165 1185 } … … 1176 1196 Assert(!pThis->s.Core.fNeedReset); 1177 1197 ASMAtomicWriteBool(&pThis->s.Core.fNeedReset, true); 1178 int rc = SUPSemEventMultiSignal(p This->s.CTX_SUFF(pVM)->pSession, (SUPSEMEVENTMULTI)pThis->s.Core.hEvtRead);1198 int rc = SUPSemEventMultiSignal(pVM->pSession, (SUPSEMEVENTMULTI)pThis->s.Core.hEvtRead); 1179 1199 AssertRC(rc); 1180 1200 break; … … 1197 1217 * so queue the exit request (ring-3). 1198 1218 */ 1199 PVMCC pVM = pThis->s.CTX_SUFF(pVM); AssertPtr(pVM); 1200 PVMCPUCC pVCpu = VMMGetCpu(pVM); AssertPtr(pVCpu); 1219 PVMCPUCC pVCpu = VMMGetCpu(pVM); AssertPtr(pVCpu); 1201 1220 uint32_t i = pVCpu->pdm.s.cQueuedCritSectRwExclLeaves++; 1202 1221 LogFlow(("PDMCritSectRwLeaveShared: [%d]=%p => R3\n", i, pThis)); … … 1239 1258 * @retval VERR_SEM_DESTROYED if the critical section is delete before or 1240 1259 * during the operation. 1260 * @param pVM The cross context VM structure. 1241 1261 * @param pThis Pointer to the read/write critical section. 1242 1262 * @sa PDMCritSectRwLeaveShared, RTCritSectRwLeaveExcl. 1243 1263 */ 1244 VMMDECL(int) PDMCritSectRwLeaveExcl(P PDMCRITSECTRW pThis)1245 { 1246 return pdmCritSectRwLeaveExclWorker(p This, false /*fNoVal*/);1264 VMMDECL(int) PDMCritSectRwLeaveExcl(PVMCC pVM, PPDMCRITSECTRW pThis) 1265 { 1266 return pdmCritSectRwLeaveExclWorker(pVM, pThis, false /*fNoVal*/); 1247 1267 } 1248 1268 … … 1252 1272 * PDMCritSectBothFF interface. 1253 1273 * 1254 * @param pThis Pointer to the read/write critical section. 1255 */ 1256 void pdmCritSectRwLeaveExclQueued(PPDMCRITSECTRW pThis) 1257 { 1258 pdmCritSectRwLeaveExclWorker(pThis, true /*fNoVal*/); 1274 * @param pVM The cross context VM structure. 1275 * @param pThis Pointer to the read/write critical section. 1276 */ 1277 void pdmCritSectRwLeaveExclQueued(PVMCC pVM, PPDMCRITSECTRW pThis) 1278 { 1279 pdmCritSectRwLeaveExclWorker(pVM, pThis, true /*fNoVal*/); 1259 1280 } 1260 1281 #endif … … 1266 1287 * @retval true if owner. 1267 1288 * @retval false if not owner. 1289 * @param pVM The cross context VM structure. 1268 1290 * @param pThis Pointer to the read/write critical section. 1269 1291 * @sa PDMCritSectRwIsReadOwner, PDMCritSectIsOwner, 1270 1292 * RTCritSectRwIsWriteOwner. 1271 1293 */ 1272 VMMDECL(bool) PDMCritSectRwIsWriteOwner(P PDMCRITSECTRW pThis)1294 VMMDECL(bool) PDMCritSectRwIsWriteOwner(PVMCC pVM, PPDMCRITSECTRW pThis) 1273 1295 { 1274 1296 /* … … 1285 1307 if (hNativeWriter == NIL_RTNATIVETHREAD) 1286 1308 return false; 1287 return hNativeWriter == pdmCritSectRwGetNativeSelf(p This);1309 return hNativeWriter == pdmCritSectRwGetNativeSelf(pVM, pThis); 1288 1310 } 1289 1311 … … 1303 1325 * 1304 1326 * @returns @c true if reader, @c false if not. 1327 * @param pVM The cross context VM structure. 1305 1328 * @param pThis Pointer to the read/write critical section. 1306 1329 * @param fWannaHear What you'd like to hear when lock validation is not … … 1308 1331 * @sa PDMCritSectRwIsWriteOwner, RTCritSectRwIsReadOwner. 1309 1332 */ 1310 VMMDECL(bool) PDMCritSectRwIsReadOwner(P PDMCRITSECTRW pThis, bool fWannaHear)1333 VMMDECL(bool) PDMCritSectRwIsReadOwner(PVMCC pVM, PPDMCRITSECTRW pThis, bool fWannaHear) 1311 1334 { 1312 1335 /* … … 1330 1353 if (hWriter == NIL_RTNATIVETHREAD) 1331 1354 return false; 1332 return hWriter == pdmCritSectRwGetNativeSelf(p This);1355 return hWriter == pdmCritSectRwGetNativeSelf(pVM, pThis); 1333 1356 } 1334 1357 -
trunk/src/VBox/VMM/VMMR0/TMR0.cpp
r87814 r90347 97 97 PTMTIMERQUEUER0 pQueueR0 = &pGVM->tmr0.s.aTimerQueues[idxQueue]; 98 98 PTMTIMERQUEUE pQueueShared = &pGVM->tm.s.aTimerQueues[idxQueue]; 99 AssertMsgReturn(PDMCritSectRwIsWriteOwner( &pQueueShared->AllocLock),99 AssertMsgReturn(PDMCritSectRwIsWriteOwner(pGVM, &pQueueShared->AllocLock), 100 100 ("queue=%s %.*Rhxs\n", pQueueShared->szName, sizeof(pQueueShared->AllocLock), &pQueueShared->AllocLock), 101 101 VERR_NOT_OWNER); -
trunk/src/VBox/VMM/VMMR3/PDMCritSect.cpp
r90346 r90347 770 770 * 771 771 * @returns VBox status code. 772 * @param pVM The cross context VM structure. 772 773 * @param pCritSect The PDM read/write critical section to destroy. 773 774 */ 774 VMMR3DECL(int) PDMR3CritSectRwDelete(P PDMCRITSECTRW pCritSect)775 VMMR3DECL(int) PDMR3CritSectRwDelete(PVM pVM, PPDMCRITSECTRW pCritSect) 775 776 { 776 777 if (!PDMCritSectRwIsInitialized(pCritSect)) … … 780 781 * Find and unlink it. 781 782 */ 782 PVM pVM = pCritSect->s.pVMR3;783 Assert(pCritSect->s.pVMR3 == pVM); 783 784 PUVM pUVM = pVM->pUVM; 784 785 AssertReleaseReturn(pVM, VERR_PDM_CRITSECT_IPE); … … 1005 1006 { 1006 1007 if ( pCur->Core.hNativeWriter == hNativeThread 1007 || PDMCritSectRwIsReadOwner( (PPDMCRITSECTRW)pCur, false /*fWannaHear*/) )1008 || PDMCritSectRwIsReadOwner(pVM, (PPDMCRITSECTRW)pCur, false /*fWannaHear*/) ) 1008 1009 { 1009 1010 cCritSects++; -
trunk/src/VBox/VMM/VMMR3/TM.cpp
r90346 r90347 1134 1134 if (s_aExtra[i].cExtra > pQueue->cTimersFree) 1135 1135 { 1136 PDMCritSectRwEnterExcl( &pQueue->AllocLock, VERR_IGNORED);1136 PDMCritSectRwEnterExcl(pVM, &pQueue->AllocLock, VERR_IGNORED); 1137 1137 uint32_t cTimersAlloc = pQueue->cTimersAlloc + s_aExtra[i].cExtra - pQueue->cTimersFree; 1138 1138 rc = VMMR3CallR0Emt(pVM, VMMGetCpu(pVM), VMMR0_DO_TM_GROW_TIMER_QUEUE, 1139 1139 RT_MAKE_U64(cTimersAlloc, s_aExtra[i].idxQueue), NULL); 1140 1140 AssertLogRelMsgReturn(RT_SUCCESS(rc), ("rc=%Rrc cTimersAlloc=%u %s\n", rc, cTimersAlloc, pQueue->szName), rc); 1141 PDMCritSectRwLeaveExcl( &pQueue->AllocLock);1141 PDMCritSectRwLeaveExcl(pVM, &pQueue->AllocLock); 1142 1142 } 1143 1143 } … … 1617 1617 */ 1618 1618 PTMTIMERQUEUE pQueue = &pVM->tm.s.aTimerQueues[enmClock]; 1619 int rc = PDMCritSectRwEnterExcl( &pQueue->AllocLock, VERR_IGNORED);1619 int rc = PDMCritSectRwEnterExcl(pVM, &pQueue->AllocLock, VERR_IGNORED); 1620 1620 AssertRCReturn(rc, rc); 1621 1621 … … 1630 1630 rc = VMMR3CallR0Emt(pVM, VMMGetCpu(pVM), VMMR0_DO_TM_GROW_TIMER_QUEUE, 1631 1631 RT_MAKE_U64(cTimersAlloc, (uint64_t)(pQueue - &pVM->tm.s.aTimerQueues[0])), NULL); 1632 AssertLogRelRCReturnStmt(rc, PDMCritSectRwLeaveExcl( &pQueue->AllocLock), rc);1633 AssertReturnStmt(pQueue->cTimersAlloc >= cTimersAlloc, PDMCritSectRwLeaveExcl( &pQueue->AllocLock), VERR_TM_IPE_3);1632 AssertLogRelRCReturnStmt(rc, PDMCritSectRwLeaveExcl(pVM, &pQueue->AllocLock), rc); 1633 AssertReturnStmt(pQueue->cTimersAlloc >= cTimersAlloc, PDMCritSectRwLeaveExcl(pVM, &pQueue->AllocLock), VERR_TM_IPE_3); 1634 1634 } 1635 1635 … … 1657 1657 AssertLogRelMsgReturnStmt(pTimer != NULL, ("cTimersFree=%u cTimersAlloc=%u enmClock=%s\n", pQueue->cTimersFree, 1658 1658 pQueue->cTimersAlloc, pQueue->szName), 1659 PDMCritSectRwLeaveExcl( &pQueue->AllocLock), VERR_INTERNAL_ERROR_3);1659 PDMCritSectRwLeaveExcl(pVM, &pQueue->AllocLock), VERR_INTERNAL_ERROR_3); 1660 1660 pQueue->cTimersFree -= 1; 1661 1661 … … 1686 1686 #endif 1687 1687 1688 PDMCritSectRwLeaveExcl( &pQueue->AllocLock);1688 PDMCritSectRwLeaveExcl(pVM, &pQueue->AllocLock); 1689 1689 1690 1690 #ifdef VBOX_WITH_STATISTICS … … 1885 1885 * like create does. All the work is done here. 1886 1886 */ 1887 PDMCritSectRwEnterExcl( &pQueue->AllocLock, VERR_IGNORED);1887 PDMCritSectRwEnterExcl(pVM, &pQueue->AllocLock, VERR_IGNORED); 1888 1888 PDMCritSectEnter(pVM, &pQueue->TimerLock, VERR_IGNORED); 1889 1889 … … 1925 1925 AssertMsgFailed(("%p:.enmState=%s %s\n", pTimer, tmTimerState(enmState), pTimer->szName)); 1926 1926 PDMCritSectLeave(pVM, &pQueue->TimerLock); 1927 PDMCritSectRwLeaveExcl( &pQueue->AllocLock);1927 PDMCritSectRwLeaveExcl(pVM, &pQueue->AllocLock); 1928 1928 1929 1929 AssertMsgReturn(cRetries > 0, ("Failed waiting for stable state. state=%d (%s)\n", pTimer->enmState, pTimer->szName), … … 1932 1932 RTThreadSleep(1); 1933 1933 1934 PDMCritSectRwEnterExcl( &pQueue->AllocLock, VERR_IGNORED);1934 PDMCritSectRwEnterExcl(pVM, &pQueue->AllocLock, VERR_IGNORED); 1935 1935 PDMCritSectEnter(pVM, &pQueue->TimerLock, VERR_IGNORED); 1936 1936 continue; … … 1942 1942 case TMTIMERSTATE_DESTROY: 1943 1943 PDMCritSectLeave(pVM, &pQueue->TimerLock); 1944 PDMCritSectRwLeaveExcl( &pQueue->AllocLock);1944 PDMCritSectRwLeaveExcl(pVM, &pQueue->AllocLock); 1945 1945 AssertLogRelMsgFailedReturn(("pTimer=%p %s\n", pTimer, tmTimerState(enmState)), VERR_TM_INVALID_STATE); 1946 1946 … … 1948 1948 AssertMsgFailed(("Unknown timer state %d (%s)\n", enmState, pTimer->szName)); 1949 1949 PDMCritSectLeave(pVM, &pQueue->TimerLock); 1950 PDMCritSectRwLeaveExcl( &pQueue->AllocLock);1950 PDMCritSectRwLeaveExcl(pVM, &pQueue->AllocLock); 1951 1951 return VERR_TM_UNKNOWN_STATE; 1952 1952 } … … 1962 1962 AssertMsgFailed(("%p:.enmState=%s %s\n", pTimer, tmTimerState(enmState), pTimer->szName)); 1963 1963 PDMCritSectLeave(pVM, &pQueue->TimerLock); 1964 PDMCritSectRwLeaveExcl( &pQueue->AllocLock);1964 PDMCritSectRwLeaveExcl(pVM, &pQueue->AllocLock); 1965 1965 1966 1966 AssertMsgReturn(cRetries > 0, ("Failed waiting for stable state. state=%d (%s)\n", pTimer->enmState, pTimer->szName), 1967 1967 VERR_TM_UNSTABLE_STATE); 1968 1968 1969 PDMCritSectRwEnterExcl( &pQueue->AllocLock, VERR_IGNORED);1969 PDMCritSectRwEnterExcl(pVM, &pQueue->AllocLock, VERR_IGNORED); 1970 1970 PDMCritSectEnter(pVM, &pQueue->TimerLock, VERR_IGNORED); 1971 1971 } … … 2026 2026 #endif 2027 2027 PDMCritSectLeave(pVM, &pQueue->TimerLock); 2028 PDMCritSectRwLeaveExcl( &pQueue->AllocLock);2028 PDMCritSectRwLeaveExcl(pVM, &pQueue->AllocLock); 2029 2029 return VINF_SUCCESS; 2030 2030 } … … 2064 2064 { 2065 2065 PTMTIMERQUEUE pQueue = &pVM->tm.s.aTimerQueues[idxQueue]; 2066 PDMCritSectRwEnterShared( &pQueue->AllocLock, VERR_IGNORED);2066 PDMCritSectRwEnterShared(pVM, &pQueue->AllocLock, VERR_IGNORED); 2067 2067 uint32_t idxTimer = pQueue->cTimersAlloc; 2068 2068 while (idxTimer-- > 0) … … 2073 2073 && pTimer->enmState < TMTIMERSTATE_DESTROY) 2074 2074 { 2075 PDMCritSectRwLeaveShared( &pQueue->AllocLock);2075 PDMCritSectRwLeaveShared(pVM, &pQueue->AllocLock); 2076 2076 2077 2077 int rc = tmR3TimerDestroy(pVM, pQueue, pTimer); 2078 2078 AssertRC(rc); 2079 2079 2080 PDMCritSectRwEnterShared( &pQueue->AllocLock, VERR_IGNORED);2080 PDMCritSectRwEnterShared(pVM, &pQueue->AllocLock, VERR_IGNORED); 2081 2081 } 2082 2082 } 2083 PDMCritSectRwLeaveShared( &pQueue->AllocLock);2083 PDMCritSectRwLeaveShared(pVM, &pQueue->AllocLock); 2084 2084 } 2085 2085 … … 2105 2105 { 2106 2106 PTMTIMERQUEUE pQueue = &pVM->tm.s.aTimerQueues[idxQueue]; 2107 PDMCritSectRwEnterShared( &pQueue->AllocLock, VERR_IGNORED);2107 PDMCritSectRwEnterShared(pVM, &pQueue->AllocLock, VERR_IGNORED); 2108 2108 uint32_t idxTimer = pQueue->cTimersAlloc; 2109 2109 while (idxTimer-- > 0) … … 2114 2114 && pTimer->enmState < TMTIMERSTATE_DESTROY) 2115 2115 { 2116 PDMCritSectRwLeaveShared( &pQueue->AllocLock);2116 PDMCritSectRwLeaveShared(pVM, &pQueue->AllocLock); 2117 2117 2118 2118 int rc = tmR3TimerDestroy(pVM, pQueue, pTimer); 2119 2119 AssertRC(rc); 2120 2120 2121 PDMCritSectRwEnterShared( &pQueue->AllocLock, VERR_IGNORED);2121 PDMCritSectRwEnterShared(pVM, &pQueue->AllocLock, VERR_IGNORED); 2122 2122 } 2123 2123 } 2124 PDMCritSectRwLeaveShared( &pQueue->AllocLock);2124 PDMCritSectRwLeaveShared(pVM, &pQueue->AllocLock); 2125 2125 } 2126 2126 … … 2146 2146 { 2147 2147 PTMTIMERQUEUE pQueue = &pVM->tm.s.aTimerQueues[idxQueue]; 2148 PDMCritSectRwEnterShared( &pQueue->AllocLock, VERR_IGNORED);2148 PDMCritSectRwEnterShared(pVM, &pQueue->AllocLock, VERR_IGNORED); 2149 2149 uint32_t idxTimer = pQueue->cTimersAlloc; 2150 2150 while (idxTimer-- > 0) … … 2155 2155 && pTimer->enmState < TMTIMERSTATE_DESTROY) 2156 2156 { 2157 PDMCritSectRwLeaveShared( &pQueue->AllocLock);2157 PDMCritSectRwLeaveShared(pVM, &pQueue->AllocLock); 2158 2158 2159 2159 int rc = tmR3TimerDestroy(pVM, pQueue, pTimer); 2160 2160 AssertRC(rc); 2161 2161 2162 PDMCritSectRwEnterShared( &pQueue->AllocLock, VERR_IGNORED);2162 PDMCritSectRwEnterShared(pVM, &pQueue->AllocLock, VERR_IGNORED); 2163 2163 } 2164 2164 } 2165 PDMCritSectRwLeaveShared( &pQueue->AllocLock);2165 PDMCritSectRwLeaveShared(pVM, &pQueue->AllocLock); 2166 2166 } 2167 2167 … … 3883 3883 PTMTIMERQUEUE const pQueue = &pVM->tm.s.aTimerQueues[idxQueue]; 3884 3884 const char * const pszClock = tmR3Get5CharClockName(pQueue->enmClock); 3885 PDMCritSectRwEnterShared( &pQueue->AllocLock, VERR_IGNORED);3885 PDMCritSectRwEnterShared(pVM, &pQueue->AllocLock, VERR_IGNORED); 3886 3886 for (uint32_t idxTimer = 0; idxTimer < pQueue->cTimersAlloc; idxTimer++) 3887 3887 { … … 3902 3902 pTimer->szName); 3903 3903 } 3904 PDMCritSectRwLeaveShared( &pQueue->AllocLock);3904 PDMCritSectRwLeaveShared(pVM, &pQueue->AllocLock); 3905 3905 } 3906 3906 } … … 3933 3933 PTMTIMERQUEUE const pQueue = &pVM->tm.s.aTimerQueues[idxQueue]; 3934 3934 const char * const pszClock = tmR3Get5CharClockName(pQueue->enmClock); 3935 PDMCritSectRwEnterShared( &pQueue->AllocLock, VERR_IGNORED);3935 PDMCritSectRwEnterShared(pVM, &pQueue->AllocLock, VERR_IGNORED); 3936 3936 PDMCritSectEnter(pVM, &pQueue->TimerLock, VERR_IGNORED); 3937 3937 … … 3955 3955 3956 3956 PDMCritSectLeave(pVM, &pQueue->TimerLock); 3957 PDMCritSectRwLeaveShared( &pQueue->AllocLock);3957 PDMCritSectRwLeaveShared(pVM, &pQueue->AllocLock); 3958 3958 } 3959 3959 } -
trunk/src/VBox/VMM/VMMR3/VMM.cpp
r90346 r90347 2390 2390 case VMMCALLRING3_PDM_CRIT_SECT_RW_ENTER_EXCL: 2391 2391 { 2392 pVCpu->vmm.s.rcCallRing3 = PDMR3CritSectRwEnterExclEx( (PPDMCRITSECTRW)(uintptr_t)pVCpu->vmm.s.u64CallRing3Arg,2393 2392 pVCpu->vmm.s.rcCallRing3 = PDMR3CritSectRwEnterExclEx(pVM, (PPDMCRITSECTRW)(uintptr_t)pVCpu->vmm.s.u64CallRing3Arg, 2393 true /*fCallRing3*/); 2394 2394 break; 2395 2395 } … … 2400 2400 case VMMCALLRING3_PDM_CRIT_SECT_RW_ENTER_SHARED: 2401 2401 { 2402 pVCpu->vmm.s.rcCallRing3 = PDMR3CritSectRwEnterSharedEx( (PPDMCRITSECTRW)(uintptr_t)pVCpu->vmm.s.u64CallRing3Arg,2402 pVCpu->vmm.s.rcCallRing3 = PDMR3CritSectRwEnterSharedEx(pVM, (PPDMCRITSECTRW)(uintptr_t)pVCpu->vmm.s.u64CallRing3Arg, 2403 2403 true /*fCallRing3*/); 2404 2404 break; -
trunk/src/VBox/VMM/include/IOMInternal.h
r90346 r90347 571 571 /* IOM locking helpers. */ 572 572 #ifdef IOM_WITH_CRIT_SECT_RW 573 # define IOM_LOCK_EXCL(a_pVM) PDMCritSectRwEnterExcl( &(a_pVM)->iom.s.CritSect, VERR_SEM_BUSY)574 # define IOM_UNLOCK_EXCL(a_pVM) do { PDMCritSectRwLeaveExcl( &(a_pVM)->iom.s.CritSect); } while (0)573 # define IOM_LOCK_EXCL(a_pVM) PDMCritSectRwEnterExcl((a_pVM), &(a_pVM)->iom.s.CritSect, VERR_SEM_BUSY) 574 # define IOM_UNLOCK_EXCL(a_pVM) do { PDMCritSectRwLeaveExcl((a_pVM), &(a_pVM)->iom.s.CritSect); } while (0) 575 575 # if 0 /* (in case needed for debugging) */ 576 576 # define IOM_LOCK_SHARED_EX(a_pVM, a_rcBusy) PDMCritSectRwEnterExcl(&(a_pVM)->iom.s.CritSect, (a_rcBusy)) … … 578 578 # define IOM_IS_SHARED_LOCK_OWNER(a_pVM) PDMCritSectRwIsWriteOwner(&(a_pVM)->iom.s.CritSect) 579 579 # else 580 # define IOM_LOCK_SHARED_EX(a_pVM, a_rcBusy) PDMCritSectRwEnterShared( &(a_pVM)->iom.s.CritSect, (a_rcBusy))581 # define IOM_UNLOCK_SHARED(a_pVM) do { PDMCritSectRwLeaveShared( &(a_pVM)->iom.s.CritSect); } while (0)582 # define IOM_IS_SHARED_LOCK_OWNER(a_pVM) PDMCritSectRwIsReadOwner( &(a_pVM)->iom.s.CritSect, true)580 # define IOM_LOCK_SHARED_EX(a_pVM, a_rcBusy) PDMCritSectRwEnterShared((a_pVM), &(a_pVM)->iom.s.CritSect, (a_rcBusy)) 581 # define IOM_UNLOCK_SHARED(a_pVM) do { PDMCritSectRwLeaveShared((a_pVM), &(a_pVM)->iom.s.CritSect); } while (0) 582 # define IOM_IS_SHARED_LOCK_OWNER(a_pVM) PDMCritSectRwIsReadOwner((a_pVM), &(a_pVM)->iom.s.CritSect, true) 583 583 # endif 584 # define IOM_IS_EXCL_LOCK_OWNER(a_pVM) PDMCritSectRwIsWriteOwner( &(a_pVM)->iom.s.CritSect)584 # define IOM_IS_EXCL_LOCK_OWNER(a_pVM) PDMCritSectRwIsWriteOwner((a_pVM), &(a_pVM)->iom.s.CritSect) 585 585 #else 586 586 # define IOM_LOCK_EXCL(a_pVM) PDMCritSectEnter((a_pVM), &(a_pVM)->iom.s.CritSect, VERR_SEM_BUSY) -
trunk/src/VBox/VMM/include/PDMInternal.h
r90346 r90347 1716 1716 1717 1717 #if defined(IN_RING3) || defined(IN_RING0) 1718 void pdmCritSectRwLeaveSharedQueued(P PDMCRITSECTRW pThis);1719 void pdmCritSectRwLeaveExclQueued(P PDMCRITSECTRW pThis);1718 void pdmCritSectRwLeaveSharedQueued(PVMCC pVM, PPDMCRITSECTRW pThis); 1719 void pdmCritSectRwLeaveExclQueued(PVMCC pVM, PPDMCRITSECTRW pThis); 1720 1720 #endif 1721 1721
Note:
See TracChangeset
for help on using the changeset viewer.