Changeset 82329 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Dec 2, 2019 6:16:13 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 135153
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r82328 r82329 578 578 #define DEVAC97_LOCK_BOTH_RETURN(a_pDevIns, a_pThis, a_SD, a_rcBusy) \ 579 579 do { \ 580 int rcLock = PDMDevHlpTimerLock((a_pDevIns), RT_SAFE_SUBSCRIPT8((a_pThis)->ahTimers, (a_SD)), (a_rcBusy)); \ 581 if (rcLock == VINF_SUCCESS) \ 580 VBOXSTRICTRC rcLock = PDMDevHlpTimerLockClock2((a_pDevIns), RT_SAFE_SUBSCRIPT8((a_pThis)->ahTimers, (a_SD)), \ 581 &(a_pThis)->CritSect, (a_rcBusy)); \ 582 if (RT_LIKELY(rcLock == VINF_SUCCESS)) \ 583 { /* likely */ } \ 584 else \ 582 585 { \ 583 rcLock = PDMDevHlpCritSectEnter((a_pDevIns), &(a_pThis)->CritSect, (a_rcBusy)); \ 584 if (rcLock == VINF_SUCCESS) \ 585 break; \ 586 PDMDevHlpTimerUnlock((a_pDevIns), RT_SAFE_SUBSCRIPT8((a_pThis)->ahTimers, (a_SD))); \ 586 AssertRC(VBOXSTRICTRC_VAL(rcLock)); \ 587 return rcLock; \ 587 588 } \ 588 AssertRC(rcLock); \589 return rcLock; \590 589 } while (0) 591 590 … … 594 593 */ 595 594 #define DEVAC97_UNLOCK_BOTH(a_pDevIns, a_pThis, a_SD) \ 596 do { \ 597 PDMDevHlpCritSectLeave((a_pDevIns), &(a_pThis)->CritSect); \ 598 PDMDevHlpTimerUnlock((a_pDevIns), RT_SAFE_SUBSCRIPT8((a_pThis)->ahTimers, (a_SD))); \ 599 } while (0) 595 PDMDevHlpTimerUnlockClock2((a_pDevIns), RT_SAFE_SUBSCRIPT8((a_pThis)->ahTimers, (a_SD)), &(a_pThis)->CritSect) 600 596 601 597 #ifdef VBOX_WITH_STATISTICS -
trunk/src/VBox/Devices/PC/DevACPI.cpp
r82068 r82329 1801 1801 */ 1802 1802 PACPISTATE pThis = PDMDEVINS_2_DATA(pDevIns, PACPISTATE); 1803 VBOXSTRICTRC rc = PDMDevHlpTimerLock (pDevIns, pThis->hPmTimer, VINF_IOM_R3_IOPORT_READ);1803 VBOXSTRICTRC rc = PDMDevHlpTimerLockClock2(pDevIns, pThis->hPmTimer, &pThis->CritSect, VINF_IOM_R3_IOPORT_READ); 1804 1804 if (rc == VINF_SUCCESS) 1805 1805 { 1806 rc = PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VINF_IOM_R3_IOPORT_READ); 1807 if (rc == VINF_SUCCESS) 1806 uint64_t u64Now = PDMDevHlpTimerGet(pDevIns, pThis->hPmTimer); 1807 acpiPmTimerUpdate(pDevIns, pThis, u64Now); 1808 *pu32 = pThis->uPmTimerVal; 1809 1810 PDMDevHlpTimerUnlockClock2(pDevIns, pThis->hPmTimer, &pThis->CritSect); 1811 1812 DBGFTRACE_PDM_U64_TAG(pDevIns, u64Now, "acpi"); 1813 Log(("acpi: acpiPMTmrRead -> %#x\n", *pu32)); 1814 1815 #if 0 1816 /** @todo temporary: sanity check against running backwards */ 1817 uint32_t uOld = ASMAtomicXchgU32(&pThis->uPmTimeOld, *pu32); 1818 if (*pu32 - uOld >= 0x10000000) 1808 1819 { 1809 uint64_t u64Now = PDMDevHlpTimerGet(pDevIns, pThis->hPmTimer);1810 acpiPmTimerUpdate(pDevIns, pThis, u64Now);1811 *pu32 = pThis->uPmTimerVal;1812 1813 DEVACPI_UNLOCK(pDevIns, pThis);1814 PDMDevHlpTimerUnlock(pDevIns, pThis->hPmTimer);1815 1816 DBGFTRACE_PDM_U64_TAG(pDevIns, u64Now, "acpi");1817 Log(("acpi: acpiPMTmrRead -> %#x\n", *pu32));1818 1819 #if 01820 /** @todo temporary: sanity check against running backwards */1821 uint32_t uOld = ASMAtomicXchgU32(&pThis->uPmTimeOld, *pu32);1822 if (*pu32 - uOld >= 0x10000000)1823 {1824 1820 # if defined(IN_RING0) 1825 1826 1827 1821 pThis->uPmTimeA = uOld; 1822 pThis->uPmTimeB = *pu32; 1823 return VERR_TM_TIMER_BAD_CLOCK; 1828 1824 # elif defined(IN_RING3) 1829 1825 AssertReleaseMsgFailed(("acpiPMTmrRead: old=%08RX32, current=%08RX32\n", uOld, *pu32)); 1830 1826 # endif 1831 1827 } 1832 1828 #endif 1833 }1834 else1835 PDMDevHlpTimerUnlock(pDevIns, pThis->hPmTimer);1836 1829 } 1837 1830 return rc; … … 2607 2600 AssertRCReturn(rc, rc); 2608 2601 2609 PDMDevHlpTimerLock (pDevIns, pThis->hPmTimer, VERR_IGNORED);2602 PDMDevHlpTimerLockClock(pDevIns, pThis->hPmTimer, VERR_IGNORED); 2610 2603 DEVACPI_LOCK_R3(pDevIns, pThis); 2611 2604 uint64_t u64Now = PDMDevHlpTimerGet(pDevIns, pThis->hPmTimer); … … 2614 2607 acpiR3PmTimerReset(pDevIns, pThis, u64Now); 2615 2608 DEVACPI_UNLOCK(pDevIns, pThis); 2616 PDMDevHlpTimerUnlock (pDevIns, pThis->hPmTimer);2609 PDMDevHlpTimerUnlockClock(pDevIns, pThis->hPmTimer); 2617 2610 } 2618 2611 return rc; … … 3585 3578 acpiSetIrq(pDevIns, 0); 3586 3579 3587 PDMDevHlpTimerLock (pDevIns, pThis->hPmTimer, VERR_IGNORED);3580 PDMDevHlpTimerLockClock(pDevIns, pThis->hPmTimer, VERR_IGNORED); 3588 3581 pThis->pm1a_en = 0; 3589 3582 pThis->pm1a_sts = 0; … … 3598 3591 pThis->gpe0_sts = 0; 3599 3592 pThis->uSleepState = 0; 3600 PDMDevHlpTimerUnlock (pDevIns, pThis->hPmTimer);3593 PDMDevHlpTimerUnlockClock(pDevIns, pThis->hPmTimer); 3601 3594 3602 3595 /* Real device behavior is resetting only the PM controller state, … … 4093 4086 AssertRCReturn(rc, rc); 4094 4087 4095 rc = PDMDevHlpTimerLock(pDevIns, pThis->hPmTimer, VERR_IGNORED); 4096 AssertRCReturn(rc, rc); 4088 PDMDevHlpTimerLockClock(pDevIns, pThis->hPmTimer, VERR_IGNORED); 4097 4089 pThis->u64PmTimerInitial = PDMDevHlpTimerGet(pDevIns, pThis->hPmTimer); 4098 4090 acpiR3PmTimerReset(pDevIns, pThis, pThis->u64PmTimerInitial); 4099 PDMDevHlpTimerUnlock (pDevIns, pThis->hPmTimer);4091 PDMDevHlpTimerUnlockClock(pDevIns, pThis->hPmTimer); 4100 4092 4101 4093 /* -
trunk/src/VBox/Devices/PC/DevHPET.cpp
r81966 r82329 175 175 #define DEVHPET_LOCK_BOTH_RETURN(a_pDevIns, a_pThis, a_rcBusy) \ 176 176 do { \ 177 int rcLock = PDMDevHlpTimerLock((a_pDevIns), (a_pThis)->aTimers[0].hTimer, (a_rcBusy)); \177 VBOXSTRICTRC rcLock = PDMDevHlpTimerLockClock2((a_pDevIns), (a_pThis)->aTimers[0].hTimer, &(a_pThis)->CritSect, (a_rcBusy)); \ 178 178 if (RT_LIKELY(rcLock == VINF_SUCCESS)) \ 179 { \ 180 rcLock = PDMDevHlpCritSectEnter((a_pDevIns), &(a_pThis)->CritSect, (a_rcBusy)); \ 181 if (RT_LIKELY(rcLock == VINF_SUCCESS)) \ 182 break; /* likely */ \ 183 PDMDevHlpTimerUnlock((a_pDevIns), (a_pThis)->aTimers[0].hTimer); \ 184 } \ 185 return rcLock; \ 179 { /* likely */ } \ 180 else \ 181 return rcLock; \ 186 182 } while (0) 187 183 … … 191 187 */ 192 188 #define DEVHPET_UNLOCK_BOTH(a_pDevIns, a_pThis) \ 193 do { \ 194 PDMDevHlpCritSectLeave((a_pDevIns), &(a_pThis)->CritSect); \ 195 PDMDevHlpTimerUnlock((a_pDevIns), (a_pThis)->aTimers[0].hTimer); \ 196 } while (0) 189 PDMDevHlpTimerUnlockClock2((a_pDevIns), (a_pThis)->aTimers[0].hTimer, &(a_pThis)->CritSect) 197 190 198 191 … … 685 678 * @remarks The caller must not own the device lock if HPET_COUNTER is read. 686 679 */ 687 static inthpetConfigRegRead32(PPDMDEVINS pDevIns, PHPET pThis, uint32_t idxReg, uint32_t *pu32Value)680 static VBOXSTRICTRC hpetConfigRegRead32(PPDMDEVINS pDevIns, PHPET pThis, uint32_t idxReg, uint32_t *pu32Value) 688 681 { 689 682 Assert(!PDMDevHlpCritSectIsOwner(pDevIns, &pThis->CritSect) || (idxReg != HPET_COUNTER && idxReg != HPET_COUNTER + 4)); … … 1342 1335 * The timers first. 1343 1336 */ 1344 PDMDevHlpTimerLock (pDevIns, pThis->aTimers[0].hTimer, VERR_IGNORED);1337 PDMDevHlpTimerLockClock(pDevIns, pThis->aTimers[0].hTimer, VERR_IGNORED); 1345 1338 for (unsigned i = 0; i < RT_ELEMENTS(pThis->aTimers); i++) 1346 1339 { … … 1364 1357 pHpetTimer->u64Cmp = hpetInvalidValue(pHpetTimer); 1365 1358 } 1366 PDMDevHlpTimerUnlock (pDevIns, pThis->aTimers[0].hTimer);1359 PDMDevHlpTimerUnlockClock(pDevIns, pThis->aTimers[0].hTimer); 1367 1360 1368 1361 /* -
trunk/src/VBox/Devices/PC/DevPit-i8254.cpp
r81945 r82329 124 124 #define DEVPIT_LOCK_BOTH_RETURN(a_pDevIns, a_pThis, a_rcBusy) \ 125 125 do { \ 126 int rcLock = PDMDevHlpTimerLock((a_pDevIns), (a_pThis)->channels[0].hTimer, (a_rcBusy)); \ 127 if (rcLock != VINF_SUCCESS) \ 126 VBOXSTRICTRC rcLock = PDMDevHlpTimerLockClock2((a_pDevIns), (a_pThis)->channels[0].hTimer, \ 127 &(a_pThis)->CritSect, (a_rcBusy)); \ 128 if (RT_LIKELY(rcLock == VINF_SUCCESS)) \ 129 { /* likely */ } \ 130 else \ 128 131 return rcLock; \ 129 rcLock = PDMDevHlpCritSectEnter((a_pDevIns), &(a_pThis)->CritSect, (a_rcBusy)); \130 if (rcLock != VINF_SUCCESS) \131 { \132 PDMDevHlpTimerUnlock((a_pDevIns), (a_pThis)->channels[0].hTimer); \133 return rcLock; \134 } \135 132 } while (0) 136 133 … … 139 136 * Acquires the TM lock and PIT lock, ignores failures. 140 137 */ 141 # define DEVPIT_R3_LOCK_BOTH(a_pDevIns, a_pThis) \ 142 do { \ 143 PDMDevHlpTimerLock((a_pDevIns), (a_pThis)->channels[0].hTimer, VERR_IGNORED); \ 144 PDMDevHlpCritSectEnter((a_pDevIns), &(a_pThis)->CritSect, VERR_IGNORED); \ 145 } while (0) 138 # define DEVPIT_R3_LOCK_BOTH(a_pDevIns, a_pThis) \ 139 PDMDevHlpTimerLockClock2((a_pDevIns), (a_pThis)->channels[0].hTimer, &(a_pThis)->CritSect, VERR_IGNORED) 146 140 #endif /* IN_RING3 */ 147 141 … … 150 144 */ 151 145 #define DEVPIT_UNLOCK_BOTH(a_pDevIns, a_pThis) \ 152 do { \ 153 PDMDevHlpCritSectLeave((a_pDevIns), &(a_pThis)->CritSect); \ 154 PDMDevHlpTimerUnlock((a_pDevIns), (a_pThis)->channels[0].hTimer); \ 155 } while (0) 146 PDMDevHlpTimerUnlockClock2((a_pDevIns), (a_pThis)->channels[0].hTimer, &(a_pThis)->CritSect) 156 147 157 148 -
trunk/src/VBox/Devices/PC/DevRTC.cpp
r81896 r82329 450 450 holding the device lock.*/ 451 451 PDMDevHlpCritSectLeave(pDevIns, pDevIns->CTX_SUFF(pCritSectRo)); 452 int rc1 = PDMDevHlpTimerLock(pDevIns, pThis->hPeriodicTimer, VINF_SUCCESS /* must get it */); 453 int rc2 = PDMDevHlpCritSectEnter(pDevIns, pDevIns->CTX_SUFF(pCritSectRo), VINF_SUCCESS /* must get it */); 454 AssertRCReturn(rc1, rc1); 455 AssertRCReturnStmt(rc2, PDMDevHlpTimerUnlock(pDevIns, pThis->hPeriodicTimer), rc2); 452 VBOXSTRICTRC rc1 = PDMDevHlpTimerLockClock2(pDevIns, pThis->hPeriodicTimer, pDevIns->CTX_SUFF(pCritSectRo), 453 VINF_SUCCESS /* must get it */); 454 AssertRCReturn(VBOXSTRICTRC_VAL(rc1), rc1); 456 455 457 456 if (idx == RTC_REG_A) … … 482 481 rtc_timer_update(pDevIns, pThis, PDMDevHlpTimerGet(pDevIns, pThis->hPeriodicTimer)); 483 482 484 PDMDevHlpTimerUnlock (pDevIns, pThis->hPeriodicTimer);483 PDMDevHlpTimerUnlockClock(pDevIns, pThis->hPeriodicTimer); 485 484 /* the caller leaves the other lock. */ 486 485 break; … … 1175 1174 pThis->next_second_time = PDMDevHlpTimerGet(pDevIns, pThis->hSecondTimer2) 1176 1175 + (PDMDevHlpTimerGetFreq(pDevIns, pThis->hSecondTimer2) * 99) / 100; 1177 rc = PDMDevHlpTimerLock(pDevIns, pThis->hSecondTimer2, VERR_IGNORED); 1178 AssertRCReturn(rc, rc); 1176 PDMDevHlpTimerLockClock(pDevIns, pThis->hSecondTimer2, VERR_IGNORED); 1179 1177 rc = PDMDevHlpTimerSet(pDevIns, pThis->hSecondTimer2, pThis->next_second_time); 1180 PDMDevHlpTimerUnlock (pDevIns, pThis->hSecondTimer2);1178 PDMDevHlpTimerUnlockClock(pDevIns, pThis->hSecondTimer2); 1181 1179 AssertRCReturn(rc, rc); 1182 1180
Note:
See TracChangeset
for help on using the changeset viewer.