- Timestamp:
- Aug 12, 2021 5:07:35 PM (3 years ago)
- File:
-
- 1 edited
-
trunk/src/VBox/VMM/VMMAll/PDMAllCritSectRw.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PDMAllCritSectRw.cpp
r90665 r90667 652 652 * Check the direction and take action accordingly. 653 653 */ 654 #ifdef IN_RING0 655 PVMCPUCC pVCpu = NULL; 656 #endif 654 657 uint64_t u64State = PDMCRITSECTRW_READ_STATE(&pThis->s.Core.u.s.u64State); 655 658 uint64_t u64OldState = u64State; … … 685 688 #if defined(IN_RING3) || defined(IN_RING0) 686 689 # ifdef IN_RING0 687 if ( RTThreadPreemptIsEnabled(NIL_RTTHREAD) 688 && ASMIntAreEnabled()) 690 Assert(RTSemEventIsSignalSafe() == RTSemEventMultiIsSignalSafe()); 691 if (!pVCpu) 692 pVCpu = VMMGetCpu(pVM); 693 if ( pVCpu == NULL /* non-EMT access, if we implement it must be able to block */ 694 || VMMRZCallRing3IsEnabled(pVCpu) 695 || RTSemEventIsSignalSafe() 696 || ( VMMR0ThreadCtxHookIsEnabled(pVCpu) /* Doesn't matter if Signal() blocks if we have hooks, ... */ 697 && RTThreadPreemptIsEnabled(NIL_RTTHREAD) /* ... and preemption is still enabled, */ 698 && ASMIntAreEnabled()) /* ... and interrupts hasn't yet been disabled. Special pre-GC HM env. */ 699 ) 689 700 # endif 690 701 { … … 694 705 if (ASMAtomicCmpXchgU64(&pThis->s.Core.u.s.u64State, u64State, u64OldState)) 695 706 { 696 int rc = SUPSemEventSignal(pVM->pSession, (SUPSEMEVENT)pThis->s.Core.hEvtWrite); 707 int rc; 708 # ifdef IN_RING0 709 STAM_REL_COUNTER_INC(&pThis->s.StatContentionRZLeaveShared); 710 if (!RTSemEventIsSignalSafe() && pVCpu != NULL) 711 { 712 VMMR0EMTBLOCKCTX Ctx; 713 rc = VMMR0EmtPrepareToBlock(pVCpu, VINF_SUCCESS, __FUNCTION__, pThis, &Ctx); 714 VMM_ASSERT_RELEASE_MSG_RETURN(pVM, RT_SUCCESS(rc), ("rc=%Rrc\n", rc), rc); 715 716 rc = SUPSemEventSignal(pVM->pSession, (SUPSEMEVENT)pThis->s.Core.hEvtWrite); 717 718 VMMR0EmtResumeAfterBlocking(pVCpu, &Ctx); 719 } 720 else 721 # endif 722 rc = SUPSemEventSignal(pVM->pSession, (SUPSEMEVENT)pThis->s.Core.hEvtWrite); 697 723 AssertRC(rc); 698 break;724 return rc; 699 725 } 700 726 } … … 706 732 { 707 733 /* Queue the exit request (ring-3). */ 708 PVMCPUCC pVCpu = VMMGetCpu(pVM); AssertPtr(pVCpu); 734 # ifndef IN_RING0 735 PVMCPUCC pVCpu = VMMGetCpu(pVM); AssertPtr(pVCpu); 736 # endif 709 737 uint32_t i = pVCpu->pdm.s.cQueuedCritSectRwShrdLeaves++; 710 738 LogFlow(("PDMCritSectRwLeaveShared: [%d]=%p => R3 c=%d (%#llx)\n", i, pThis, c, u64State)); … … 728 756 729 757 ASMNopPause(); 758 if (RT_LIKELY(pThis->s.Core.u32Magic == RTCRITSECTRW_MAGIC)) 759 { } 760 else 761 return VERR_SEM_DESTROYED; 762 ASMNopPause(); 763 730 764 u64State = PDMCRITSECTRW_READ_STATE(&pThis->s.Core.u.s.u64State); 731 765 u64OldState = u64State;
Note:
See TracChangeset
for help on using the changeset viewer.

