VirtualBox

Changeset 37500 in vbox


Ignore:
Timestamp:
Jun 16, 2011 2:57:54 PM (13 years ago)
Author:
vboxsync
Message:

DevHPET: code cleanup in progress...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/DevHPET.cpp

    r37497 r37500  
    115115
    116116
     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
    117134/*******************************************************************************
    118135*   Structures and Typedefs                                                    *
     
    205222#ifndef VBOX_DEVICE_STRUCT_TESTCASE
    206223
    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 }
    218224
    219225DECLINLINE(bool) hpet32bitTimer(HpetTimer *pHpetTimer)
     
    725731
    726732    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);
    731734
    732735    switch (cb)
     
    802805    }
    803806
    804     hpetUnlock(pThis);
    805 
     807    DEVHPET_UNLOCK(pThis);
    806808    return rc;
    807809}
     
    814816{
    815817    HpetState  *pThis  = PDMINS_2_DATA(pDevIns, HpetState*);
     818    uint32_t    iIndex = (uint32_t)(GCPhysAddr - HPET_BASE);
    816819    int         rc     = VINF_SUCCESS;
    817     uint32_t    iIndex = (uint32_t)(GCPhysAddr - HPET_BASE);
    818820
    819821    LogFlow(("hpetMMIOWrite (%d): %llx (%x) <- %x\n",
    820822             cb, (uint64_t)GCPhysAddr, iIndex, cb >= 4 ? *(uint32_t*)pv : 0xdeadbeef));
    821823
    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);
    825825
    826826    switch (cb)
     
    885885    }
    886886
    887     hpetUnlock(pThis);
     887    DEVHPET_UNLOCK(pThis);
    888888    return rc;
    889889}
     
    10441044
    10451045    /* Lock in R3 must either block or succeed */
    1046     int rc = hpetLock(pThis, VERR_IGNORED);
    1047     AssertLogRelRCReturnVoid(rc);
     1046    int rc = PDMCritSectEnter(&pThis->csLock, VERR_IGNORED);
     1047    AssertRC(rc);
    10481048
    10491049    if ((pHpetTimer->u64Config & HPET_TN_PERIODIC) && (u64Period != 0))
     
    10701070    hpetIrqUpdate(pHpetTimer);
    10711071
    1072     hpetUnlock(pThis);
     1072    PDMCritSectLeave(&pThis->csLock);
    10731073}
    10741074
     
    11781178        pThis->aTimers[i].pTimerRC = TMTimerRCPtr(pThis->aTimers[i].pTimerR3);
    11791179        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);
    11811181    }
    11821182
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette