Changeset 37500 in vbox
- Timestamp:
- Jun 16, 2011 2:57:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevHPET.cpp
r37497 r37500 115 115 116 116 117 /** 118 * Acquires the HPET lock or returns. 119 */ 120 #define DEVHPET_LOCK_RETURN(a_pThis, a_rcBusy) \ 121 do { \ 122 int rcLock = PDMCritSectEnter(&(a_pThis)->csLock, (a_rcBusy)); \ 123 if (rcLock != VINF_SUCCESS) \ 124 return rcLock; \ 125 } while (0) 126 127 /** 128 * Releases the HPET lock. 129 */ 130 #define DEVHPET_UNLOCK(a_pThis) \ 131 do { PDMCritSectLeave(&(a_pThis)->csLock); } while (0) 132 133 117 134 /******************************************************************************* 118 135 * Structures and Typedefs * … … 205 222 #ifndef VBOX_DEVICE_STRUCT_TESTCASE 206 223 207 208 /** @todo Use macros so we can get the source position. */209 DECLINLINE(int) hpetLock(HpetState* pThis, int rcBusy)210 {211 return PDMCritSectEnter(&pThis->csLock, rcBusy);212 }213 214 DECLINLINE(void) hpetUnlock(HpetState* pThis)215 {216 PDMCritSectLeave(&pThis->csLock);217 }218 224 219 225 DECLINLINE(bool) hpet32bitTimer(HpetTimer *pHpetTimer) … … 725 731 726 732 LogFlow(("hpetMMIORead (%d): %llx (%x)\n", cb, (uint64_t)GCPhysAddr, iIndex)); 727 728 rc = hpetLock(pThis, VINF_IOM_HC_MMIO_READ); 729 if (RT_UNLIKELY(rc != VINF_SUCCESS)) 730 return rc; 733 DEVHPET_LOCK_RETURN(pThis, VINF_IOM_HC_MMIO_READ); 731 734 732 735 switch (cb) … … 802 805 } 803 806 804 hpetUnlock(pThis); 805 807 DEVHPET_UNLOCK(pThis); 806 808 return rc; 807 809 } … … 814 816 { 815 817 HpetState *pThis = PDMINS_2_DATA(pDevIns, HpetState*); 818 uint32_t iIndex = (uint32_t)(GCPhysAddr - HPET_BASE); 816 819 int rc = VINF_SUCCESS; 817 uint32_t iIndex = (uint32_t)(GCPhysAddr - HPET_BASE);818 820 819 821 LogFlow(("hpetMMIOWrite (%d): %llx (%x) <- %x\n", 820 822 cb, (uint64_t)GCPhysAddr, iIndex, cb >= 4 ? *(uint32_t*)pv : 0xdeadbeef)); 821 823 822 rc = hpetLock(pThis, VINF_IOM_HC_MMIO_WRITE); 823 if (RT_UNLIKELY(rc != VINF_SUCCESS)) 824 return rc; 824 DEVHPET_LOCK_RETURN(pThis, VINF_IOM_HC_MMIO_WRITE); 825 825 826 826 switch (cb) … … 885 885 } 886 886 887 hpetUnlock(pThis);887 DEVHPET_UNLOCK(pThis); 888 888 return rc; 889 889 } … … 1044 1044 1045 1045 /* Lock in R3 must either block or succeed */ 1046 int rc = hpetLock(pThis, VERR_IGNORED);1047 Assert LogRelRCReturnVoid(rc);1046 int rc = PDMCritSectEnter(&pThis->csLock, VERR_IGNORED); 1047 AssertRC(rc); 1048 1048 1049 1049 if ((pHpetTimer->u64Config & HPET_TN_PERIODIC) && (u64Period != 0)) … … 1070 1070 hpetIrqUpdate(pHpetTimer); 1071 1071 1072 hpetUnlock(pThis);1072 PDMCritSectLeave(&pThis->csLock); 1073 1073 } 1074 1074 … … 1178 1178 pThis->aTimers[i].pTimerRC = TMTimerRCPtr(pThis->aTimers[i].pTimerR3); 1179 1179 pThis->aTimers[i].pTimerR0 = TMTimerR0Ptr(pThis->aTimers[i].pTimerR3); 1180 TMR3TimerSetCritSect(pThis->aTimers[i].pTimerR3, &pThis->csLock);1180 /// @todo TMR3TimerSetCritSect(pThis->aTimers[i].pTimerR3, &pThis->csLock); 1181 1181 } 1182 1182
Note:
See TracChangeset
for help on using the changeset viewer.