Changeset 90348 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Jul 26, 2021 9:01:38 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 145912
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp ¶
r90346 r90348 146 146 * The wait loop. 147 147 */ 148 PSUPDRVSESSION pSession = p CritSect->s.CTX_SUFF(pVM)->pSession;148 PSUPDRVSESSION pSession = pVM->pSession; 149 149 SUPSEMEVENT hEvent = (SUPSEMEVENT)pCritSect->s.Core.EventSem; 150 150 # ifdef IN_RING3 … … 248 248 return VINF_SUCCESS; 249 249 250 Assert(pCritSect->s.CTX_SUFF(pVM) == pVM); RT_NOREF(pVM);251 250 RTNATIVETHREAD hNativeSelf = pdmCritSectGetNativeSelf(pVM, pCritSect); 252 251 /* ... not owned ... */ … … 460 459 return VINF_SUCCESS; 461 460 462 Assert(pCritSect->s.CTX_SUFF(pVM) == pVM);463 461 RTNATIVETHREAD hNativeSelf = pdmCritSectGetNativeSelf(pVM, pCritSect); 464 462 /* ... not owned ... */ … … 596 594 * Always check that the caller is the owner (screw performance). 597 595 */ 598 Assert(pCritSect->s.CTX_SUFF(pVM) == pVM); RT_NOREF(pVM);599 596 RTNATIVETHREAD const hNativeSelf = pdmCritSectGetNativeSelf(pVM, pCritSect); 600 597 AssertReleaseMsgReturn(pCritSect->s.Core.NativeThreadOwner == hNativeSelf, -
trunk/src/VBox/VMM/VMMAll/PDMAllCritSectRw.cpp ¶
r90347 r90348 127 127 * Go back to ring-3 so the kernel can do signals, APCs and other fun things. 128 128 * 129 * @param p This Pointer to the read/write critical section.130 */ 131 static void pdmR0CritSectRwYieldToRing3(P PDMCRITSECTRW pThis)132 { 133 PVMC C pVM = pThis->s.CTX_SUFF(pVM); AssertPtr(pVM);134 PVMCPUCC pVCpu = VMMGetCpu(pVM); AssertPtr(pVCpu);129 * @param pVM The cross context VM structure. 130 */ 131 static void pdmR0CritSectRwYieldToRing3(PVMCC pVM) 132 { 133 PVMCPUCC pVCpu = VMMGetCpu(pVM); 134 AssertPtrReturnVoid(pVCpu); 135 135 int rc = VMMRZCallRing3(pVM, pVCpu, VMMCALLRING3_VM_R0_PREEMPT, NULL); 136 136 AssertRC(rc); … … 158 158 AssertPtr(pThis); 159 159 AssertReturn(pThis->s.Core.u32Magic == RTCRITSECTRW_MAGIC, VERR_SEM_DESTROYED); 160 Assert(pThis->s.CTX_SUFF(pVM) == pVM);161 160 162 161 #if !defined(PDMCRITSECTRW_STRICT) || !defined(IN_RING3) … … 302 301 break; 303 302 # ifdef IN_RING0 304 pdmR0CritSectRwYieldToRing3(p This);303 pdmR0CritSectRwYieldToRing3(pVM); 305 304 # endif 306 305 } … … 567 566 AssertPtr(pThis); 568 567 AssertReturn(pThis->s.Core.u32Magic == RTCRITSECTRW_MAGIC, VERR_SEM_DESTROYED); 569 Assert(pThis->s.CTX_SUFF(pVM) == pVM);570 568 571 569 #if !defined(PDMCRITSECTRW_STRICT) || !defined(IN_RING3) … … 721 719 AssertPtr(pThis); 722 720 AssertReturn(pThis->s.Core.u32Magic == RTCRITSECTRW_MAGIC, VERR_SEM_DESTROYED); 723 Assert(pThis->s.CTX_SUFF(pVM) == pVM);724 721 725 722 #if !defined(PDMCRITSECTRW_STRICT) || !defined(IN_RING3) … … 873 870 break; 874 871 # ifdef IN_RING0 875 pdmR0CritSectRwYieldToRing3(p This);872 pdmR0CritSectRwYieldToRing3(pVM); 876 873 # endif 877 874 } … … 1122 1119 AssertPtr(pThis); 1123 1120 AssertReturn(pThis->s.Core.u32Magic == RTCRITSECTRW_MAGIC, VERR_SEM_DESTROYED); 1124 Assert(pThis->s.CTX_SUFF(pVM) == pVM);1125 1121 1126 1122 #if !defined(PDMCRITSECTRW_STRICT) || !defined(IN_RING3) -
trunk/src/VBox/VMM/VMMR0/PDMR0DevHlp.cpp ¶
r90346 r90348 845 845 AssertReturn(PDMCritSectIsInitialized(pCritSect), VERR_INVALID_PARAMETER); 846 846 PGVM pGVM = pDevIns->Internal.s.pGVM; 847 AssertReturn(pCritSect->s.pVMR0 == pGVM, VERR_INVALID_PARAMETER);848 847 849 848 VM_ASSERT_EMT(pGVM); -
trunk/src/VBox/VMM/VMMR3/MMHyper.cpp ¶
r90346 r90348 215 215 { 216 216 if (pVM->mm.s.pHyperHeapR3) 217 PDMR3CritSectDelete( &pVM->mm.s.pHyperHeapR3->Lock);217 PDMR3CritSectDelete(pVM, &pVM->mm.s.pHyperHeapR3->Lock); 218 218 219 219 return VINF_SUCCESS; -
trunk/src/VBox/VMM/VMMR3/PDM.cpp ¶
r90346 r90348 585 585 586 586 /* 587 * Critical sections.588 */589 pdmR3CritSectBothRelocate(pVM);590 591 /*592 587 * The registered PIC. 593 588 */ … … 894 889 * Destroy the PDM lock. 895 890 */ 896 PDMR3CritSectDelete( &pVM->pdm.s.CritSect);891 PDMR3CritSectDelete(pVM, &pVM->pdm.s.CritSect); 897 892 /* The MiscCritSect is deleted by PDMR3CritSectBothTerm later. */ 898 893 -
trunk/src/VBox/VMM/VMMR3/PDMCritSect.cpp ¶
r90347 r90348 58 58 "Number of times a critical section leave request needed to be queued for ring-3 execution."); 59 59 return VINF_SUCCESS; 60 }61 62 63 /**64 * Relocates all the critical sections.65 *66 * @param pVM The cross context VM structure.67 */68 void pdmR3CritSectBothRelocate(PVM pVM)69 {70 PUVM pUVM = pVM->pUVM;71 RTCritSectEnter(&pUVM->pdm.s.ListCritSect);72 73 for (PPDMCRITSECTINT pCur = pUVM->pdm.s.pCritSects;74 pCur;75 pCur = pCur->pNext)76 pCur->pVMRC = pVM->pVMRC;77 78 for (PPDMCRITSECTRWINT pCur = pUVM->pdm.s.pRwCritSects;79 pCur;80 pCur = pCur->pNext)81 pCur->pVMRC = pVM->pVMRC;82 83 RTCritSectLeave(&pUVM->pdm.s.ListCritSect);84 60 } 85 61 … … 182 158 pCritSect->Core.cLockers = -1; 183 159 pCritSect->Core.NativeThreadOwner = NIL_RTNATIVETHREAD; 184 pCritSect->pVMR3 = pVM;185 pCritSect->pVMR0 = pVM->pVMR0ForCall;186 pCritSect->pVMRC = pVM->pVMRC;187 160 pCritSect->pvKey = pvKey; 188 161 pCritSect->fAutomaticDefaultCritsect = false; … … 279 252 pCritSect->Core.HCPtrPadding = NIL_RTHCPTR; 280 253 #endif 281 pCritSect->pVMR3 = pVM;282 pCritSect->pVMR0 = pVM->pVMR0ForCall;283 pCritSect->pVMRC = pVM->pVMRC;284 254 pCritSect->pvKey = pvKey; 285 255 pCritSect->pszName = pszName; … … 534 504 pCritSect->pNext = NULL; 535 505 pCritSect->pvKey = NULL; 536 pCritSect->pVMR3 = NULL;537 pCritSect->pVMR0 = NIL_RTR0PTR;538 pCritSect->pVMRC = NIL_RTRCPTR;539 506 if (!fFinal) 540 507 STAMR3DeregisterF(pVM->pUVM, "/PDM/CritSects/%s/*", pCritSect->pszName); … … 605 572 pCritSect->pNext = NULL; 606 573 pCritSect->pvKey = NULL; 607 pCritSect->pVMR3 = NULL;608 pCritSect->pVMR0 = NIL_RTR0PTR;609 pCritSect->pVMRC = NIL_RTRCPTR;610 574 if (!fFinal) 611 575 STAMR3DeregisterF(pVM->pUVM, "/PDM/CritSectsRw/%s/*", pCritSect->pszName); … … 731 695 * 732 696 * @returns VBox status code. 733 * @param pCritSect The PDM critical section to destroy. 734 */ 735 VMMR3DECL(int) PDMR3CritSectDelete(PPDMCRITSECT pCritSect) 697 * @param pVM The cross context VM structure. 698 * @param pCritSect The PDM critical section to destroy. 699 */ 700 VMMR3DECL(int) PDMR3CritSectDelete(PVM pVM, PPDMCRITSECT pCritSect) 736 701 { 737 702 if (!RTCritSectIsInitialized(&pCritSect->s.Core)) … … 741 706 * Find and unlink it. 742 707 */ 743 PVM pVM = pCritSect->s.pVMR3;744 708 PUVM pUVM = pVM->pUVM; 745 709 AssertReleaseReturn(pVM, VERR_PDM_CRITSECT_IPE); … … 781 745 * Find and unlink it. 782 746 */ 783 Assert(pCritSect->s.pVMR3 == pVM);784 747 PUVM pUVM = pVM->pUVM; 785 748 AssertReleaseReturn(pVM, VERR_PDM_CRITSECT_IPE); -
trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp ¶
r90346 r90348 2737 2737 AssertReturn(PDMCritSectIsInitialized(pCritSect), VERR_INVALID_PARAMETER); 2738 2738 PVM pVM = pDevIns->Internal.s.pVMR3; 2739 AssertReturn(pCritSect->s.pVMR3 == pVM, VERR_INVALID_PARAMETER);2740 2739 2741 2740 VM_ASSERT_EMT(pVM); … … 2768 2767 } 2769 2768 2770 PDMR3CritSectDelete(p OldCritSect);2769 PDMR3CritSectDelete(pVM, pOldCritSect); 2771 2770 Assert((uintptr_t)pOldCritSect - (uintptr_t)pDevIns < pDevIns->cbRing3); 2772 2771 … … 2872 2871 { 2873 2872 PDMDEV_ASSERT_DEVINS(pDevIns); 2874 RT_NOREF(pDevIns); 2875 return PDMR3CritSectDelete(pCritSect); 2873 return PDMR3CritSectDelete(pDevIns->Internal.s.pVMR3, pCritSect); 2876 2874 } 2877 2875 -
trunk/src/VBox/VMM/VMMR3/PDMDriver.cpp ¶
r90346 r90348 1909 1909 { 1910 1910 PDMDRV_ASSERT_DRVINS(pDrvIns); 1911 RT_NOREF(pDrvIns); 1912 return PDMR3CritSectDelete(pCritSect); 1911 return PDMR3CritSectDelete(pDrvIns->Internal.s.pVMR3, pCritSect); 1913 1912 } 1914 1913 -
trunk/src/VBox/VMM/VMMR3/PDMNetShaper.cpp ¶
r90346 r90348 153 153 if (!pBwGroup) 154 154 { 155 rc = MMHyperAlloc(pShaper->pVM, sizeof(PDMNSBWGROUP), 64,156 155 PVM const pVM = pShaper->pVM; 156 rc = MMHyperAlloc(pVM, sizeof(PDMNSBWGROUP), 64, MM_TAG_PDM_NET_SHAPER, (void **)&pBwGroup); 157 157 if (RT_SUCCESS(rc)) 158 158 { 159 rc = PDMR3CritSectInit(p Shaper->pVM, &pBwGroup->Lock, RT_SRC_POS, "BWGRP-%s", pszBwGroup);159 rc = PDMR3CritSectInit(pVM, &pBwGroup->Lock, RT_SRC_POS, "BWGRP-%s", pszBwGroup); 160 160 if (RT_SUCCESS(rc)) 161 161 { 162 pBwGroup->pszNameR3 = MMR3HeapStrDup(p Shaper->pVM, MM_TAG_PDM_NET_SHAPER, pszBwGroup);162 pBwGroup->pszNameR3 = MMR3HeapStrDup(pVM, MM_TAG_PDM_NET_SHAPER, pszBwGroup); 163 163 if (pBwGroup->pszNameR3) 164 164 { … … 176 176 return VINF_SUCCESS; 177 177 } 178 PDMR3CritSectDelete( &pBwGroup->Lock);178 PDMR3CritSectDelete(pVM, &pBwGroup->Lock); 179 179 } 180 MMHyperFree(p Shaper->pVM, pBwGroup);180 MMHyperFree(pVM, pBwGroup); 181 181 } 182 182 else … … 191 191 192 192 193 static void pdmNsBwGroupTerminate(P PDMNSBWGROUP pBwGroup)193 static void pdmNsBwGroupTerminate(PVM pVM, PPDMNSBWGROUP pBwGroup) 194 194 { 195 195 Assert(pBwGroup->cRefs == 0); 196 196 if (PDMCritSectIsInitialized(&pBwGroup->Lock)) 197 PDMR3CritSectDelete( &pBwGroup->Lock);197 PDMR3CritSectDelete(pVM, &pBwGroup->Lock); 198 198 } 199 199 … … 469 469 PPDMNSBWGROUP pFree = pBwGroup; 470 470 pBwGroup = pBwGroup->pNextR3; 471 pdmNsBwGroupTerminate(p Free);471 pdmNsBwGroupTerminate(pVM, pFree); 472 472 MMR3HeapFree(pFree->pszNameR3); 473 473 MMHyperFree(pVM, pFree); -
trunk/src/VBox/VMM/VMMR3/PGM.cpp ¶
r90346 r90348 1064 1064 1065 1065 /* Almost no cleanup necessary, MM frees all memory. */ 1066 PDMR3CritSectDelete( &pVM->pgm.s.CritSectX);1066 PDMR3CritSectDelete(pVM, &pVM->pgm.s.CritSectX); 1067 1067 1068 1068 return rc; … … 2139 2139 2140 2140 PGMDeregisterStringFormatTypes(); 2141 return PDMR3CritSectDelete( &pVM->pgm.s.CritSectX);2141 return PDMR3CritSectDelete(pVM, &pVM->pgm.s.CritSectX); 2142 2142 } 2143 2143 -
trunk/src/VBox/VMM/include/PDMInternal.h ¶
r90347 r90348 423 423 * PDMR3CritSectInit() sets this to point to the critsect itself. */ 424 424 RTR3PTR pvKey; 425 /** Pointer to the VM - R3Ptr. */426 PVMR3 pVMR3;427 /** Pointer to the VM - R0Ptr. */428 R0PTRTYPE(PVMCC) pVMR0;429 /** Pointer to the VM - GCPtr. */430 PVMRC pVMRC;431 425 /** Set if this critical section is the automatically created default 432 426 * section of a device. */ … … 436 430 bool fUsedByTimerOrSimilar; 437 431 /** Alignment padding. */ 438 bool afPadding[2 ];432 bool afPadding[2+4]; 439 433 /** Support driver event semaphore that is scheduled to be signaled upon leaving 440 434 * the critical section. This is only for Ring-3 and Ring-0. */ … … 476 470 * PDMR3CritSectInit() sets this to point to the critsect itself. */ 477 471 RTR3PTR pvKey; 478 /** Pointer to the VM - R3Ptr. */479 PVMR3 pVMR3;480 /** Pointer to the VM - R0Ptr. */481 R0PTRTYPE(PVMCC) pVMR0;482 /** Pointer to the VM - GCPtr. */483 PVMRC pVMRC;484 #if HC_ARCH_BITS == 64485 /** Alignment padding. */486 RTRCPTR RCPtrPadding;487 #endif488 472 /** The lock name. */ 489 473 R3PTRTYPE(const char *) pszName; … … 1615 1599 1616 1600 int pdmR3CritSectBothInitStats(PVM pVM); 1617 void pdmR3CritSectBothRelocate(PVM pVM);1618 1601 int pdmR3CritSectBothDeleteDevice(PVM pVM, PPDMDEVINS pDevIns); 1619 1602 int pdmR3CritSectBothDeleteDriver(PVM pVM, PPDMDRVINS pDrvIns);
Note:
See TracChangeset
for help on using the changeset viewer.