VirtualBox

Changeset 81953 in vbox for trunk/src/VBox/Devices/PC


Ignore:
Timestamp:
Nov 18, 2019 5:04:40 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
134750
Message:

DevHPET: Use device helpers for critsects. bugref:9218

File:
1 edited

Legend:

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

    r81952 r81953  
    153153 * Acquires the HPET lock or returns.
    154154 */
    155 #define DEVHPET_LOCK_RETURN(a_pThis, a_rcBusy)  \
     155#define DEVHPET_LOCK_RETURN(a_pDevIns, a_pThis, a_rcBusy)  \
    156156    do { \
    157         int rcLock = PDMCritSectEnter(&(a_pThis)->CritSect, (a_rcBusy)); \
    158         if (rcLock != VINF_SUCCESS) \
     157        int rcLock = PDMDevHlpCritSectEnter((a_pDevIns), &(a_pThis)->CritSect, (a_rcBusy)); \
     158        if (rcLock == VINF_SUCCESS) \
     159        { /* likely */ } \
     160        else \
    159161            return rcLock; \
    160162    } while (0)
     
    163165 * Releases the HPET lock.
    164166 */
    165 #define DEVHPET_UNLOCK(a_pThis) \
    166     do { PDMCritSectLeave(&(a_pThis)->CritSect); } while (0)
     167#define DEVHPET_UNLOCK(a_pDevIns, a_pThis) \
     168    do { PDMDevHlpCritSectLeave((a_pDevIns), &(a_pThis)->CritSect); } while (0)
    167169
    168170
     
    170172 * Acquires the TM lock and HPET lock, returns on failure.
    171173 */
    172 #define DEVHPET_LOCK_BOTH_RETURN(a_pThis, a_rcBusy)  \
     174#define DEVHPET_LOCK_BOTH_RETURN(a_pDevIns, a_pThis, a_rcBusy)  \
    173175    do { \
    174176        int rcLock = TMTimerLock((a_pThis)->aTimers[0].CTX_SUFF(pTimer), (a_rcBusy)); \
    175         if (rcLock != VINF_SUCCESS) \
    176             return rcLock; \
    177         rcLock = PDMCritSectEnter(&(a_pThis)->CritSect, (a_rcBusy)); \
    178         if (rcLock != VINF_SUCCESS) \
     177        if (rcLock == VINF_SUCCESS) \
    179178        { \
     179            rcLock = PDMDevHlpCritSectEnter((a_pDevIns), &(a_pThis)->CritSect, (a_rcBusy)); \
     180            if (rcLock == VINF_SUCCESS) \
     181                break; /* likely */ \
    180182            TMTimerUnlock((a_pThis)->aTimers[0].CTX_SUFF(pTimer)); \
    181             return rcLock; \
    182183        } \
     184        return rcLock; \
    183185    } while (0)
    184186
     
    187189 * Releases the HPET lock and TM lock.
    188190 */
    189 #define DEVHPET_UNLOCK_BOTH(a_pThis) \
     191#define DEVHPET_UNLOCK_BOTH(a_pDevIns, a_pThis) \
    190192    do { \
    191         PDMCritSectLeave(&(a_pThis)->CritSect); \
     193        PDMDevHlpCritSectLeave((a_pDevIns), &(a_pThis)->CritSect); \
    192194        TMTimerUnlock((a_pThis)->aTimers[0].CTX_SUFF(pTimer)); \
    193195    } while (0)
     
    248250
    249251/**
    250  * The HPET state.
     252 * The shared HPET state.
    251253 */
    252254typedef struct HPET
     
    394396 * Sets the frequency hint if it's a periodic timer.
    395397 *
    396  * @param   pThis       The HPET state.
     398 * @param   pThis       The shared HPET state.
    397399 * @param   pHpetTimer  The timer.
    398400 */
     
    465467 *
    466468 * @returns VBox strict status code.
     469 * @param   pDevIns             The device instance.
    467470 * @param   pThis               The HPET instance.
    468471 * @param   iTimerNo            The timer index.
     
    472475 * @remarks ASSUMES the caller holds the HPET lock.
    473476 */
    474 static int hpetTimerRegRead32(PCHPET pThis, uint32_t iTimerNo, uint32_t iTimerReg, uint32_t *pu32Value)
    475 {
    476     Assert(PDMCritSectIsOwner(&pThis->CritSect));
     477static int hpetTimerRegRead32(PPDMDEVINS pDevIns, PCHPET pThis, uint32_t iTimerNo, uint32_t iTimerReg, uint32_t *pu32Value)
     478{
     479    Assert(PDMDevHlpCritSectIsOwner(pDevIns, &pThis->CritSect));
     480    RT_NOREF(pDevIns);
    477481
    478482    if (   iTimerNo >= HPET_CAP_GET_TIMERS(pThis->u32Capabilities)  /* The second check is only to satisfy Parfait; */
     
    530534 * @returns Strict VBox status code.
    531535 *
    532  * @param   pThis           The HPET state.
     536 * @param   pDevIns         The device instance.
     537 * @param   pThis           The shared HPET state.
    533538 * @param   iTimerNo        The timer being written to.
    534539 * @param   iTimerReg       The register being written to.
     
    538543 *          the TM lock.
    539544 */
    540 static int hpetTimerRegWrite32(PHPET pThis, uint32_t iTimerNo, uint32_t iTimerReg, uint32_t u32NewValue)
    541 {
    542     Assert(!PDMCritSectIsOwner(&pThis->CritSect) || TMTimerIsLockOwner(pThis->aTimers[0].CTX_SUFF(pTimer)));
     545static int hpetTimerRegWrite32(PPDMDEVINS pDevIns, PHPET pThis, uint32_t iTimerNo, uint32_t iTimerReg, uint32_t u32NewValue)
     546{
     547    Assert(!PDMDevHlpCritSectIsOwner(pDevIns, &pThis->CritSect) || TMTimerIsLockOwner(pThis->aTimers[0].CTX_SUFF(pTimer)));
    543548
    544549    if (   iTimerNo >= HPET_CAP_GET_TIMERS(pThis->u32Capabilities)
     
    554559        case HPET_TN_CFG:
    555560        {
    556             DEVHPET_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
     561            DEVHPET_LOCK_RETURN(pDevIns, pThis, VINF_IOM_R3_MMIO_WRITE);
    557562            uint64_t    u64Mask = HPET_TN_CFG_WRITE_MASK;
    558563
     
    580585            /* We only care about lower 32-bits so far */
    581586            pHpetTimer->u64Config = hpetUpdateMasked(u32NewValue, pHpetTimer->u64Config, u64Mask);
    582             DEVHPET_UNLOCK(pThis);
     587            DEVHPET_UNLOCK(pDevIns, pThis);
    583588            break;
    584589        }
     
    590595        case HPET_TN_CMP: /* lower bits of comparator register */
    591596        {
    592             DEVHPET_LOCK_BOTH_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
     597            DEVHPET_LOCK_BOTH_RETURN(pDevIns, pThis, VINF_IOM_R3_MMIO_WRITE);
    593598            Log(("write HPET_TN_CMP on %d: %#x\n", iTimerNo, u32NewValue));
    594599
     
    601606            if (pThis->u64HpetConfig & HPET_CFG_ENABLE)
    602607                hpetProgramTimer(pThis, pHpetTimer);
    603             DEVHPET_UNLOCK_BOTH(pThis);
     608            DEVHPET_UNLOCK_BOTH(pDevIns, pThis);
    604609            break;
    605610        }
     
    607612        case HPET_TN_CMP + 4: /* upper bits of comparator register */
    608613        {
    609             DEVHPET_LOCK_BOTH_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
     614            DEVHPET_LOCK_BOTH_RETURN(pDevIns, pThis, VINF_IOM_R3_MMIO_WRITE);
    610615            Log(("write HPET_TN_CMP + 4 on %d: %#x\n", iTimerNo, u32NewValue));
    611616            if (!hpet32bitTimer(pHpetTimer))
     
    622627                    hpetProgramTimer(pThis, pHpetTimer);
    623628            }
    624             DEVHPET_UNLOCK_BOTH(pThis);
     629            DEVHPET_UNLOCK_BOTH(pDevIns, pThis);
    625630            break;
    626631        }
     
    650655 *
    651656 * @returns Strict VBox status code.
    652  * @param   pThis               The HPET state.
     657 * @param   pDevIns             The device instance.
     658 * @param   pThis               The shared HPET state.
    653659 * @param   idxReg              The register to read.
    654660 * @param   pu32Value           Where to return the register value.
     
    656662 * @remarks The caller must not own the device lock if HPET_COUNTER is read.
    657663 */
    658 static int hpetConfigRegRead32(PHPET pThis, uint32_t idxReg, uint32_t *pu32Value)
    659 {
    660     Assert(!PDMCritSectIsOwner(&pThis->CritSect) || (idxReg != HPET_COUNTER && idxReg != HPET_COUNTER + 4));
     664static int hpetConfigRegRead32(PPDMDEVINS pDevIns, PHPET pThis, uint32_t idxReg, uint32_t *pu32Value)
     665{
     666    Assert(!PDMDevHlpCritSectIsOwner(pDevIns, &pThis->CritSect) || (idxReg != HPET_COUNTER && idxReg != HPET_COUNTER + 4));
    661667
    662668    uint32_t u32Value;
     
    664670    {
    665671        case HPET_ID:
    666             DEVHPET_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_READ);
     672            DEVHPET_LOCK_RETURN(pDevIns, pThis, VINF_IOM_R3_MMIO_READ);
    667673            u32Value = pThis->u32Capabilities;
    668             DEVHPET_UNLOCK(pThis);
     674            DEVHPET_UNLOCK(pDevIns, pThis);
    669675            Log(("read HPET_ID: %#x\n", u32Value));
    670676            break;
    671677
    672678        case HPET_PERIOD:
    673             DEVHPET_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_READ);
     679            DEVHPET_LOCK_RETURN(pDevIns, pThis, VINF_IOM_R3_MMIO_READ);
    674680            u32Value = pThis->u32Period;
    675             DEVHPET_UNLOCK(pThis);
     681            DEVHPET_UNLOCK(pDevIns, pThis);
    676682            Log(("read HPET_PERIOD: %#x\n", u32Value));
    677683            break;
    678684
    679685        case HPET_CFG:
    680             DEVHPET_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_READ);
     686            DEVHPET_LOCK_RETURN(pDevIns, pThis, VINF_IOM_R3_MMIO_READ);
    681687            u32Value = (uint32_t)pThis->u64HpetConfig;
    682             DEVHPET_UNLOCK(pThis);
     688            DEVHPET_UNLOCK(pDevIns, pThis);
    683689            Log(("read HPET_CFG: %#x\n", u32Value));
    684690            break;
    685691
    686692        case HPET_CFG + 4:
    687             DEVHPET_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_READ);
     693            DEVHPET_LOCK_RETURN(pDevIns, pThis, VINF_IOM_R3_MMIO_READ);
    688694            u32Value = (uint32_t)(pThis->u64HpetConfig >> 32);
    689             DEVHPET_UNLOCK(pThis);
     695            DEVHPET_UNLOCK(pDevIns, pThis);
    690696            Log(("read of HPET_CFG + 4: %#x\n", u32Value));
    691697            break;
     
    694700        case HPET_COUNTER + 4:
    695701        {
    696             DEVHPET_LOCK_BOTH_RETURN(pThis, VINF_IOM_R3_MMIO_READ);
     702            DEVHPET_LOCK_BOTH_RETURN(pDevIns, pThis, VINF_IOM_R3_MMIO_READ);
    697703
    698704            uint64_t u64Ticks;
     
    702708                u64Ticks = pThis->u64HpetCounter;
    703709
    704             DEVHPET_UNLOCK_BOTH(pThis);
     710            DEVHPET_UNLOCK_BOTH(pDevIns, pThis);
    705711
    706712            /** @todo is it correct? */
     
    712718
    713719        case HPET_STATUS:
    714             DEVHPET_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_READ);
     720            DEVHPET_LOCK_RETURN(pDevIns, pThis, VINF_IOM_R3_MMIO_READ);
    715721            u32Value = (uint32_t)pThis->u64Isr;
    716             DEVHPET_UNLOCK(pThis);
     722            DEVHPET_UNLOCK(pDevIns, pThis);
    717723            Log(("read HPET_STATUS: %#x\n", u32Value));
    718724            break;
     
    734740 * @returns Strict VBox status code.
    735741 *
    736  * @param   pThis           The HPET state.
     742 * @param   pDevIns         The device instance.
     743 * @param   pThis           The shared HPET state.
    737744 * @param   idxReg          The register being written to.
    738745 * @param   u32NewValue     The value being written.
     
    741748 *          the TM lock.
    742749 */
    743 static int hpetConfigRegWrite32(PHPET pThis, uint32_t idxReg, uint32_t u32NewValue)
    744 {
    745     Assert(!PDMCritSectIsOwner(&pThis->CritSect) || TMTimerIsLockOwner(pThis->aTimers[0].CTX_SUFF(pTimer)));
     750static int hpetConfigRegWrite32(PPDMDEVINS pDevIns, PHPET pThis, uint32_t idxReg, uint32_t u32NewValue)
     751{
     752    Assert(!PDMDevHlpCritSectIsOwner(pDevIns, &pThis->CritSect) || TMTimerIsLockOwner(pThis->aTimers[0].CTX_SUFF(pTimer)));
    746753
    747754    int rc = VINF_SUCCESS;
     
    757764        case HPET_CFG:
    758765        {
    759             DEVHPET_LOCK_BOTH_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
     766            DEVHPET_LOCK_BOTH_RETURN(pDevIns, pThis, VINF_IOM_R3_MMIO_WRITE);
    760767            uint32_t const iOldValue = (uint32_t)(pThis->u64HpetConfig);
    761768            Log(("write HPET_CFG: %x (old %x)\n", u32NewValue, iOldValue));
     
    775782#endif
    776783                {
    777                     DEVHPET_UNLOCK_BOTH(pThis);
     784                    DEVHPET_UNLOCK_BOTH(pDevIns, pThis);
    778785                    break;
    779786                }
     
    811818            }
    812819
    813             DEVHPET_UNLOCK_BOTH(pThis);
     820            DEVHPET_UNLOCK_BOTH(pDevIns, pThis);
    814821            break;
    815822        }
     
    817824        case HPET_CFG + 4:
    818825        {
    819             DEVHPET_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
     826            DEVHPET_LOCK_RETURN(pDevIns, pThis, VINF_IOM_R3_MMIO_WRITE);
    820827            pThis->u64HpetConfig = hpetUpdateMasked((uint64_t)u32NewValue << 32,
    821828                                                    pThis->u64HpetConfig,
    822829                                                    UINT64_C(0xffffffff00000000));
    823830            Log(("write HPET_CFG + 4: %x -> %#llx\n", u32NewValue, pThis->u64HpetConfig));
    824             DEVHPET_UNLOCK(pThis);
     831            DEVHPET_UNLOCK(pDevIns, pThis);
    825832            break;
    826833        }
     
    828835        case HPET_STATUS:
    829836        {
    830             DEVHPET_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
     837            DEVHPET_LOCK_RETURN(pDevIns, pThis, VINF_IOM_R3_MMIO_WRITE);
    831838            /* Clear ISR for all set bits in u32NewValue, see p. 14 of the HPET spec. */
    832839            pThis->u64Isr &= ~((uint64_t)u32NewValue);
    833840            Log(("write HPET_STATUS: %x -> ISR=%#llx\n", u32NewValue, pThis->u64Isr));
    834             DEVHPET_UNLOCK(pThis);
     841            DEVHPET_UNLOCK(pDevIns, pThis);
    835842            break;
    836843        }
     
    846853        case HPET_COUNTER:
    847854        {
    848             DEVHPET_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
     855            DEVHPET_LOCK_RETURN(pDevIns, pThis, VINF_IOM_R3_MMIO_WRITE);
    849856            pThis->u64HpetCounter = RT_MAKE_U64(u32NewValue, RT_HI_U32(pThis->u64HpetCounter));
    850857            Log(("write HPET_COUNTER: %#x -> %llx\n", u32NewValue, pThis->u64HpetCounter));
    851             DEVHPET_UNLOCK(pThis);
     858            DEVHPET_UNLOCK(pDevIns, pThis);
    852859            break;
    853860        }
     
    855862        case HPET_COUNTER + 4:
    856863        {
    857             DEVHPET_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
     864            DEVHPET_LOCK_RETURN(pDevIns, pThis, VINF_IOM_R3_MMIO_WRITE);
    858865            pThis->u64HpetCounter = RT_MAKE_U64(RT_LO_U32(pThis->u64HpetCounter), u32NewValue);
    859866            Log(("write HPET_COUNTER + 4: %#x -> %llx\n", u32NewValue, pThis->u64HpetCounter));
    860             DEVHPET_UNLOCK(pThis);
     867            DEVHPET_UNLOCK(pDevIns, pThis);
    861868            break;
    862869        }
     
    894901        if (idxReg >= 0x100 && idxReg < 0x400)
    895902        {
    896             DEVHPET_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_READ);
    897             rc = hpetTimerRegRead32(pThis,
     903            DEVHPET_LOCK_RETURN(pDevIns, pThis, VINF_IOM_R3_MMIO_READ);
     904            rc = hpetTimerRegRead32(pDevIns, pThis,
    898905                                    (idxReg - 0x100) / 0x20,
    899906                                    (idxReg - 0x100) % 0x20,
    900907                                    (uint32_t *)pv);
    901             DEVHPET_UNLOCK(pThis);
     908            DEVHPET_UNLOCK(pDevIns, pThis);
    902909        }
    903910        else
    904             rc = hpetConfigRegRead32(pThis, idxReg, (uint32_t *)pv);
     911            rc = hpetConfigRegRead32(pDevIns, pThis, idxReg, (uint32_t *)pv);
    905912    }
    906913    else
     
    915922            /* When reading HPET counter we must read it in a single read,
    916923               to avoid unexpected time jumps on 32-bit overflow. */
    917             DEVHPET_LOCK_BOTH_RETURN(pThis, VINF_IOM_R3_MMIO_READ);
     924            DEVHPET_LOCK_BOTH_RETURN(pDevIns, pThis, VINF_IOM_R3_MMIO_READ);
    918925            if (pThis->u64HpetConfig & HPET_CFG_ENABLE)
    919926                pValue->u = hpetGetTicks(pThis);
    920927            else
    921928                pValue->u = pThis->u64HpetCounter;
    922             DEVHPET_UNLOCK_BOTH(pThis);
     929            DEVHPET_UNLOCK_BOTH(pDevIns, pThis);
    923930            rc = VINF_SUCCESS;
    924931        }
    925932        else
    926933        {
    927             DEVHPET_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_READ);
     934            DEVHPET_LOCK_RETURN(pDevIns, pThis, VINF_IOM_R3_MMIO_READ);
    928935            if (idxReg >= 0x100 && idxReg < 0x400)
    929936            {
    930937                uint32_t iTimer    = (idxReg - 0x100) / 0x20;
    931938                uint32_t iTimerReg = (idxReg - 0x100) % 0x20;
    932                 rc = hpetTimerRegRead32(pThis, iTimer, iTimerReg, &pValue->s.Lo);
     939                rc = hpetTimerRegRead32(pDevIns, pThis, iTimer, iTimerReg, &pValue->s.Lo);
    933940                if (rc == VINF_SUCCESS)
    934                     rc = hpetTimerRegRead32(pThis, iTimer, iTimerReg + 4, &pValue->s.Hi);
     941                    rc = hpetTimerRegRead32(pDevIns, pThis, iTimer, iTimerReg + 4, &pValue->s.Hi);
    935942            }
    936943            else
    937944            {
    938945                /* for most 8-byte accesses we just split them, happens under lock anyway. */
    939                 rc = hpetConfigRegRead32(pThis, idxReg, &pValue->s.Lo);
     946                rc = hpetConfigRegRead32(pDevIns, pThis, idxReg, &pValue->s.Lo);
    940947                if (rc == VINF_SUCCESS)
    941                     rc = hpetConfigRegRead32(pThis, idxReg + 4, &pValue->s.Hi);
     948                    rc = hpetConfigRegRead32(pDevIns, pThis, idxReg + 4, &pValue->s.Hi);
    942949            }
    943             DEVHPET_UNLOCK(pThis);
     950            DEVHPET_UNLOCK(pDevIns, pThis);
    944951        }
    945952    }
     
    964971    {
    965972        if (idxReg >= 0x100 && idxReg < 0x400)
    966             rc = hpetTimerRegWrite32(pThis,
     973            rc = hpetTimerRegWrite32(pDevIns, pThis,
    967974                                     (idxReg - 0x100) / 0x20,
    968975                                     (idxReg - 0x100) % 0x20,
    969976                                     *(uint32_t const *)pv);
    970977        else
    971             rc = hpetConfigRegWrite32(pThis, idxReg, *(uint32_t const *)pv);
     978            rc = hpetConfigRegWrite32(pDevIns, pThis, idxReg, *(uint32_t const *)pv);
    972979    }
    973980    else
     
    977984         */
    978985        /* Split the access and rely on the locking to prevent trouble. */
    979         DEVHPET_LOCK_BOTH_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
     986        DEVHPET_LOCK_BOTH_RETURN(pDevIns, pThis, VINF_IOM_R3_MMIO_WRITE);
    980987        RTUINT64U uValue;
    981988        uValue.u = *(uint64_t const *)pv;
     
    985992            uint32_t iTimerReg = (idxReg - 0x100) % 0x20;
    986993    /** @todo Consider handling iTimerReg == HPET_TN_CMP specially here */
    987             rc = hpetTimerRegWrite32(pThis, iTimer, iTimerReg, uValue.s.Lo);
     994            rc = hpetTimerRegWrite32(pDevIns, pThis, iTimer, iTimerReg, uValue.s.Lo);
    988995            if (RT_LIKELY(rc == VINF_SUCCESS))
    989                 rc = hpetTimerRegWrite32(pThis, iTimer, iTimerReg + 4, uValue.s.Hi);
     996                rc = hpetTimerRegWrite32(pDevIns, pThis, iTimer, iTimerReg + 4, uValue.s.Hi);
    990997        }
    991998        else
    992999        {
    993             rc = hpetConfigRegWrite32(pThis, idxReg, uValue.s.Lo);
     1000            rc = hpetConfigRegWrite32(pDevIns, pThis, idxReg, uValue.s.Lo);
    9941001            if (RT_LIKELY(rc == VINF_SUCCESS))
    995                 rc = hpetConfigRegWrite32(pThis, idxReg + 4, uValue.s.Hi);
    996         }
    997         DEVHPET_UNLOCK_BOTH(pThis);
     1002                rc = hpetConfigRegWrite32(pDevIns, pThis, idxReg + 4, uValue.s.Hi);
     1003        }
     1004        DEVHPET_UNLOCK_BOTH(pDevIns, pThis);
    9981005    }
    9991006
     
    12561263     * Set the timer frequency hints.
    12571264     */
    1258     PDMCritSectEnter(&pThis->CritSect, VERR_IGNORED);
     1265    PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_IGNORED);
    12591266    for (uint32_t iTimer = 0; iTimer < cTimers; iTimer++)
    12601267    {
     
    12631270            hpetTimerSetFrequencyHint(pThis, pHpetTimer);
    12641271    }
    1265     PDMCritSectLeave(&pThis->CritSect);
     1272    PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect);
    12661273    return VINF_SUCCESS;
    12671274}
     
    13291336
    13301337    /*
    1331      * The HPET state.
     1338     * The shared HPET state.
    13321339     */
    13331340    pThis->u64HpetConfig  = 0;
     
    14711478}
    14721479
    1473 #endif /* IN_RING3 */
     1480#else  /* !IN_RING3 */
     1481
     1482/**
     1483 * @callback_method_impl{PDMDEVREGR0,pfnConstruct}
     1484 */
     1485static DECLCALLBACK(int) hpetRZConstruct(PPDMDEVINS pDevIns)
     1486{
     1487    PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
     1488    //PHPET   pThis   = PDMDEVINS_2_DATA(pDevIns, PHPET);
     1489    //PHPETCC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PHPETCC);
     1490
     1491    int rc = PDMDevHlpSetDeviceCritSect(pDevIns, PDMDevHlpCritSectGetNop(pDevIns));
     1492    AssertRCReturn(rc, rc);
     1493
     1494    //int rc = PDMDevHlpMmioSetUpContext(pDevIns, pThis->hMmio, ohciMmioWrite, ohciMmioRead, NULL /*pvUser*/);
     1495    //AssertRCReturn(rc, rc);
     1496
     1497    return VINF_SUCCESS;
     1498}
     1499
     1500
     1501#endif /* !IN_RING3 */
    14741502
    14751503/**
     
    15181546#elif defined(IN_RING0)
    15191547    /* .pfnEarlyConstruct = */      NULL,
    1520     /* .pfnConstruct = */           NULL,
     1548    /* .pfnConstruct = */           hpetRZConstruct,
    15211549    /* .pfnDestruct = */            NULL,
    15221550    /* .pfnFinalDestruct = */       NULL,
     
    15311559    /* .pfnReserved7 = */           NULL,
    15321560#elif defined(IN_RC)
    1533     /* .pfnConstruct = */           NULL,
     1561    /* .pfnConstruct = */           hpetRZConstruct,
    15341562    /* .pfnReserved0 = */           NULL,
    15351563    /* .pfnReserved1 = */           NULL,
Note: See TracChangeset for help on using the changeset viewer.

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