- Timestamp:
- Jun 13, 2015 2:58:10 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 101002
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmcritsect.h
r56291 r56402 63 63 VMMR3DECL(bool) PDMR3CritSectYield(PPDMCRITSECT pCritSect); 64 64 VMMR3DECL(const char *) PDMR3CritSectName(PCPDMCRITSECT pCritSect); 65 VMMR3DECL(int) PDMR3CritSectScheduleExitEvent(PPDMCRITSECT pCritSect, RTSEMEVENT EventToSignal);66 65 VMMR3DECL(int) PDMR3CritSectDelete(PPDMCRITSECT pCritSect); 66 #if defined(IN_RING0) || defined(IN_RING3) 67 VMMDECL(int) PDMHCCritSectScheduleExitEvent(PPDMCRITSECT pCritSect, SUPSEMEVENT hEventToSignal); 68 #endif 67 69 68 70 VMMDECL(int) PDMCritSectEnter(PPDMCRITSECT pCritSect, int rcBusy); -
trunk/include/iprt/critsect.h
r56291 r56402 211 211 RTDECL(int) RTCritSectTryEnterDebug(PRTCRITSECT pCritSect, RTHCUINTPTR uId, RT_SRC_POS_DECL); 212 212 213 # ifdef IN_RING3 /* Crazy APIs: ring-3 only. */213 # ifdef IN_RING3 /* Crazy APIs: ring-3 only. */ 214 214 215 215 /** … … 252 252 RTDECL(int) RTCritSectEnterMultipleDebug(size_t cCritSects, PRTCRITSECT *papCritSects, RTUINTPTR uId, RT_SRC_POS_DECL); 253 253 254 # endif /* IN_RING3 */254 # endif /* IN_RING3 */ 255 255 256 256 /** -
trunk/src/VBox/Devices/Storage/DevATA.cpp
r56400 r56402 15 15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 16 16 */ 17 17 18 18 19 /******************************************************************************* … … 35 36 #define ATA_SAVED_STATE_VERSION_WITHOUT_EVENT_STATUS 17 36 37 /** @} */ 38 37 39 38 40 /******************************************************************************* … … 56 58 #include <VBox/vmm/pgm.h> 57 59 60 #include <VBox/sup.h> 58 61 #include <VBox/scsi.h> 59 62 … … 62 65 #include "ATAPIPassthrough.h" 63 66 #include "VBoxDD.h" 67 64 68 65 69 /******************************************************************************* … … 423 427 RTTHREAD AsyncIOThread; 424 428 /** The event semaphore the thread is waiting on for requests. */ 425 RTSEMEVENT AsyncIOSem; 429 SUPSEMEVENT hAsyncIOSem; 430 /** The support driver session handle. */ 431 PSUPDRVSESSION pSupDrvSession; 426 432 /** The request queue for the AIO thread. One element is always unused. */ 427 433 ATARequest aAsyncIORequests[4]; … … 439 445 /** The event semaphore the thread is waiting on during suspended I/O. */ 440 446 RTSEMEVENT SuspendIOSem; 441 #if HC_ARCH_BITS == 32447 #if 0 /*HC_ARCH_BITS == 32*/ 442 448 uint32_t Alignment0; 443 449 #endif … … 728 734 AssertRC(rc); 729 735 730 rc = PDM R3CritSectScheduleExitEvent(&pCtl->lock, pCtl->AsyncIOSem);736 rc = PDMHCCritSectScheduleExitEvent(&pCtl->lock, pCtl->hAsyncIOSem); 731 737 if (RT_FAILURE(rc)) 732 738 { 733 rc = RTSemEventSignal(pCtl->AsyncIOSem);739 rc = SUPSemEventSignal(pCtl->pSupDrvSession, pCtl->hAsyncIOSem); 734 740 AssertRC(rc); 735 741 } … … 5096 5102 if (pCtl->fSignalIdle) 5097 5103 ataR3AsyncSignalIdle(pCtl); 5098 rc = RTSemEventWait(pCtl->AsyncIOSem, RT_INDEFINITE_WAIT);5104 rc = SUPSemEventWaitNoResume(pCtl->pSupDrvSession, pCtl->hAsyncIOSem, RT_INDEFINITE_WAIT); 5099 5105 /* Continue if we got a signal by RTThreadPoke(). 5100 5106 * We will get notified if there is a request to process. … … 7020 7026 { 7021 7027 ASMAtomicWriteU32(&pThis->aCts[i].fShutdown, true); 7022 rc = RTSemEventSignal(pThis->aCts[i].AsyncIOSem);7028 rc = SUPSemEventSignal(pThis->aCts[i].pSupDrvSession, pThis->aCts[i].hAsyncIOSem); 7023 7029 AssertRC(rc); 7024 7030 rc = RTSemEventSignal(pThis->aCts[i].SuspendIOSem); … … 7051 7057 if (PDMCritSectIsInitialized(&pThis->aCts[i].AsyncIORequestLock)) 7052 7058 PDMR3CritSectDelete(&pThis->aCts[i].AsyncIORequestLock); 7053 if (pThis->aCts[i]. AsyncIOSem != NIL_RTSEMEVENT)7054 { 7055 RTSemEventDestroy(pThis->aCts[i].AsyncIOSem);7056 pThis->aCts[i]. AsyncIOSem = NIL_RTSEMEVENT;7059 if (pThis->aCts[i].hAsyncIOSem != NIL_SUPSEMEVENT) 7060 { 7061 SUPSemEventClose(pThis->aCts[i].pSupDrvSession, pThis->aCts[i].hAsyncIOSem); 7062 pThis->aCts[i].hAsyncIOSem = NIL_SUPSEMEVENT; 7057 7063 } 7058 7064 if (pThis->aCts[i].SuspendIOSem != NIL_RTSEMEVENT) … … 7138 7144 for (uint32_t i = 0; i < RT_ELEMENTS(pThis->aCts); i++) 7139 7145 { 7140 pThis->aCts[i]. AsyncIOSem = NIL_RTSEMEVENT;7146 pThis->aCts[i].hAsyncIOSem = NIL_SUPSEMEVENT; 7141 7147 pThis->aCts[i].SuspendIOSem = NIL_RTSEMEVENT; 7142 7148 pThis->aCts[i].AsyncIOThread = NIL_RTTHREAD; … … 7428 7434 */ 7429 7435 pCtl->uAsyncIOState = ATA_AIO_NEW; 7430 rc = RTSemEventCreate(&pCtl->AsyncIOSem); 7436 pCtl->pSupDrvSession = PDMDevHlpGetSupDrvSession(pDevIns); 7437 rc = SUPSemEventCreate(pCtl->pSupDrvSession, &pCtl->hAsyncIOSem); 7431 7438 AssertLogRelRCReturn(rc, rc); 7432 7439 rc = RTSemEventCreate(&pCtl->SuspendIOSem); … … 7437 7444 RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "ATA-%u", i); 7438 7445 AssertLogRelRCReturn(rc, rc); 7439 Assert( pCtl->AsyncIOThread != NIL_RTTHREAD && pCtl-> AsyncIOSem != NIL_RTSEMEVENT7446 Assert( pCtl->AsyncIOThread != NIL_RTTHREAD && pCtl->hAsyncIOSem != NIL_SUPSEMEVENT 7440 7447 && pCtl->SuspendIOSem != NIL_RTSEMEVENT && PDMCritSectIsInitialized(&pCtl->AsyncIORequestLock)); 7441 Log(("%s: controller %d AIO thread id %#x; sem %p susp_sem %p\n", __FUNCTION__, i, pCtl->AsyncIOThread, pCtl-> AsyncIOSem, pCtl->SuspendIOSem));7448 Log(("%s: controller %d AIO thread id %#x; sem %p susp_sem %p\n", __FUNCTION__, i, pCtl->AsyncIOThread, pCtl->hAsyncIOSem, pCtl->SuspendIOSem)); 7442 7449 7443 7450 for (uint32_t j = 0; j < RT_ELEMENTS(pCtl->aIfs); j++) -
trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp
r56392 r56402 953 953 GEN_CHECK_OFF(ATACONTROLLER, fShutdown); 954 954 GEN_CHECK_OFF(ATACONTROLLER, AsyncIOThread); 955 GEN_CHECK_OFF(ATACONTROLLER, AsyncIOSem);955 GEN_CHECK_OFF(ATACONTROLLER, hAsyncIOSem); 956 956 GEN_CHECK_OFF(ATACONTROLLER, aAsyncIORequests[4]); 957 957 GEN_CHECK_OFF(ATACONTROLLER, AsyncIOReqHead); -
trunk/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp
r56287 r56402 585 585 */ 586 586 /* update members. */ 587 SUPSEMEVENT hEventToSignal = pCritSect->s.hEventToSignal; 588 pCritSect->s.hEventToSignal = NIL_SUPSEMEVENT; 587 589 # ifdef IN_RING3 588 RTSEMEVENT hEventToSignal = pCritSect->s.EventToSignal;589 pCritSect->s.EventToSignal = NIL_RTSEMEVENT;590 590 # if defined(PDMCRITSECT_STRICT) 591 591 if (pCritSect->s.Core.pValidatorRec->hThread != NIL_RTTHREAD) … … 611 611 } 612 612 613 # ifdef IN_RING3614 613 /* Signal exit event. */ 615 if (hEventToSignal != NIL_ RTSEMEVENT)614 if (hEventToSignal != NIL_SUPSEMEVENT) 616 615 { 617 Log8(("Signalling %# x\n", hEventToSignal));618 int rc = RTSemEventSignal(hEventToSignal);616 Log8(("Signalling %#p\n", hEventToSignal)); 617 int rc = SUPSemEventSignal(pCritSect->s.CTX_SUFF(pVM)->pSession, hEventToSignal); 619 618 AssertRC(rc); 620 619 } 621 # endif622 620 623 621 # if defined(DEBUG_bird) && defined(IN_RING0) … … 673 671 674 672 673 #if defined(IN_RING0) || defined(IN_RING3) 674 /** 675 * Schedule a event semaphore for signalling upon critsect exit. 676 * 677 * @returns VINF_SUCCESS on success. 678 * @returns VERR_TOO_MANY_SEMAPHORES if an event was already scheduled. 679 * @returns VERR_NOT_OWNER if we're not the critsect owner (ring-3 only). 680 * @returns VERR_SEM_DESTROYED if RTCritSectDelete was called while waiting. 681 * 682 * @param pCritSect The critical section. 683 * @param hEventToSignal The support driver event semaphore that should be 684 * signalled. 685 */ 686 VMMDECL(int) PDMHCCritSectScheduleExitEvent(PPDMCRITSECT pCritSect, SUPSEMEVENT hEventToSignal) 687 { 688 AssertPtr(pCritSect); 689 Assert(!(pCritSect->s.Core.fFlags & RTCRITSECT_FLAGS_NOP)); 690 Assert(hEventToSignal != NIL_SUPSEMEVENT); 691 # ifdef IN_RING3 692 if (RT_UNLIKELY(!RTCritSectIsOwner(&pCritSect->s.Core))) 693 return VERR_NOT_OWNER; 694 # endif 695 if (RT_LIKELY( pCritSect->s.hEventToSignal == NIL_RTSEMEVENT 696 || pCritSect->s.hEventToSignal == hEventToSignal)) 697 { 698 pCritSect->s.hEventToSignal = hEventToSignal; 699 return VINF_SUCCESS; 700 } 701 return VERR_TOO_MANY_SEMAPHORES; 702 } 703 #endif /* IN_RING0 || IN_RING3 */ 704 705 675 706 /** 676 707 * Checks the caller is the owner of the critical section. -
trunk/src/VBox/VMM/VMMR3/PDMCritSect.cpp
r56287 r56402 183 183 pCritSect->fAutomaticDefaultCritsect = false; 184 184 pCritSect->fUsedByTimerOrSimilar = false; 185 pCritSect-> EventToSignal = NIL_RTSEMEVENT;185 pCritSect->hEventToSignal = NIL_SUPSEMEVENT; 186 186 pCritSect->pszName = pszName; 187 187 … … 885 885 886 886 /** 887 * Schedule a event semaphore for signalling upon critsect exit.888 *889 * @returns VINF_SUCCESS on success.890 * @returns VERR_TOO_MANY_SEMAPHORES if an event was already scheduled.891 * @returns VERR_NOT_OWNER if we're not the critsect owner.892 * @returns VERR_SEM_DESTROYED if RTCritSectDelete was called while waiting.893 *894 * @param pCritSect The critical section.895 * @param EventToSignal The semaphore that should be signalled.896 */897 VMMR3DECL(int) PDMR3CritSectScheduleExitEvent(PPDMCRITSECT pCritSect, RTSEMEVENT EventToSignal)898 {899 AssertPtr(pCritSect);900 Assert(!(pCritSect->s.Core.fFlags & RTCRITSECT_FLAGS_NOP));901 Assert(EventToSignal != NIL_RTSEMEVENT);902 if (RT_UNLIKELY(!RTCritSectIsOwner(&pCritSect->s.Core)))903 return VERR_NOT_OWNER;904 if (RT_LIKELY( pCritSect->s.EventToSignal == NIL_RTSEMEVENT905 || pCritSect->s.EventToSignal == EventToSignal))906 {907 pCritSect->s.EventToSignal = EventToSignal;908 return VINF_SUCCESS;909 }910 return VERR_TOO_MANY_SEMAPHORES;911 }912 913 914 /**915 887 * PDMR3CritSectBothCountOwned worker. 916 888 * -
trunk/src/VBox/VMM/include/PDMInternal.h
r56287 r56402 301 301 /** Alignment padding. */ 302 302 bool afPadding[2]; 303 /** Event semaphore that is scheduled to be signaled upon leaving the304 * critical section. This is Ring-3 only of course. */305 RTSEMEVENTEventToSignal;303 /** Support driver event semaphore that is scheduled to be signaled upon leaving 304 * the critical section. This is only for Ring-3 and Ring-0. */ 305 SUPSEMEVENT hEventToSignal; 306 306 /** The lock name. */ 307 307 R3PTRTYPE(const char *) pszName;
Note:
See TracChangeset
for help on using the changeset viewer.