VirtualBox

Changeset 81955 in vbox


Ignore:
Timestamp:
Nov 18, 2019 5:23:13 PM (5 years ago)
Author:
vboxsync
Message:

DevHPET: Eliminated unnecessary pointers in the state structures. bugref:9218

File:
1 edited

Legend:

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

    r81954 r81955  
    208208    TMTIMERHANDLE               hTimer;
    209209
    210     /** Pointer to the instance data - R3 Ptr. */
    211     R3PTRTYPE(struct HPET *)    pHpetR3;
    212     /** Pointer to the instance data - R0 Ptr. */
    213     R0PTRTYPE(struct HPET *)    pHpetR0;
    214     /** Pointer to the instance data - RC Ptr. */
    215     RCPTRTYPE(struct HPET *)    pHpetRC;
    216 
    217210    /** Timer index. */
    218211    uint8_t                     idxTimer;
     
    220213    uint8_t                     u8Wrap;
    221214    /** Explicit padding. */
    222     uint8_t                     abPadding[2];
     215    uint8_t                     abPadding[6];
    223216
    224217    /** @name Memory-mapped, software visible timer registers.
     
    250243typedef struct HPET
    251244{
    252     /** Pointer to the device instance. - R3 ptr. */
    253     PPDMDEVINSR3                pDevInsR3;
    254245    /** The HPET helpers - R3 Ptr. */
    255246    PCPDMHPETHLPR3              pHpetHlpR3;
    256 
    257     /** Pointer to the device instance. - R0 ptr. */
    258     PPDMDEVINSR0                pDevInsR0;
    259247    /** The HPET helpers - R0 Ptr. */
    260248    PCPDMHPETHLPR0              pHpetHlpR0;
    261 
    262     /** Pointer to the device instance. - RC ptr. */
    263     PPDMDEVINSRC                pDevInsRC;
    264249    /** The HPET helpers - RC Ptr. */
    265250    PCPDMHPETHLPRC              pHpetHlpRC;
     251    uint32_t                    u32Padding;
    266252
    267253    /** Timer structures. */
     
    410396    pHpetTimer->u8Wrap = 0;
    411397
    412     uint64_t u64Ticks = hpetGetTicks(pDevIns, pHpetTimer->CTX_SUFF(pHpet));
     398    uint64_t u64Ticks = hpetGetTicks(pDevIns, pThis);
    413399    hpetAdjustComparator(pHpetTimer, u64Ticks);
    414400
     
    443429    if (u64Diff <= u64TickLimit)
    444430    {
    445         Log4(("HPET: next IRQ in %lld ticks (%lld ns)\n", u64Diff, hpetTicksToNs(pHpetTimer->CTX_SUFF(pHpet), u64Diff)));
    446         PDMDevHlpTimerSetNano(pDevIns, pHpetTimer->hTimer, hpetTicksToNs(pHpetTimer->CTX_SUFF(pHpet), u64Diff));
     431        Log4(("HPET: next IRQ in %lld ticks (%lld ns)\n", u64Diff, hpetTicksToNs(pThis, u64Diff)));
     432        PDMDevHlpTimerSetNano(pDevIns, pHpetTimer->hTimer, hpetTicksToNs(pThis, u64Diff));
    447433    }
    448434    else
     
    770756            {
    771757#ifdef IN_RING3
    772                 rc = pThis->pHpetHlpR3->pfnSetLegacyMode(pThis->pDevInsR3, RT_BOOL(u32NewValue & HPET_CFG_LEGACY));
     758                rc = pThis->pHpetHlpR3->pfnSetLegacyMode(pDevIns, RT_BOOL(u32NewValue & HPET_CFG_LEGACY));
    773759                if (rc != VINF_SUCCESS)
    774760#else
     
    1010996 *
    1011997 * @returns IRQ number.
     998 * @param   pThis               The shared HPET state.
    1012999 * @param   pHpetTimer          The HPET timer.
    10131000 */
    1014 static uint32_t hpetR3TimerGetIrq(PCHPETTIMER pHpetTimer)
     1001static uint32_t hpetR3TimerGetIrq(PHPET pThis, PCHPETTIMER pHpetTimer)
    10151002{
    10161003    /*
     
    10231010     */
    10241011    if (   (pHpetTimer->idxTimer <= 1)
    1025         && (pHpetTimer->CTX_SUFF(pHpet)->u64HpetConfig & HPET_CFG_LEGACY))
     1012        && (pThis->u64HpetConfig & HPET_CFG_LEGACY))
    10261013        return (pHpetTimer->idxTimer == 0) ? 0 : 8;
    10271014
     
    10331020 * Used by hpetR3Timer to update the IRQ status.
    10341021 *
    1035  * @param   pThis               The HPET device state.
     1022 * @param   pDevIns             The device instance.
     1023 * @param   pThis               The shared HPET state.
    10361024 * @param   pHpetTimer          The HPET timer.
    10371025 */
    1038 static void hpetR3TimerUpdateIrq(PHPET pThis, PHPETTIMER pHpetTimer)
     1026static void hpetR3TimerUpdateIrq(PPDMDEVINS pDevIns, PHPET pThis, PHPETTIMER pHpetTimer)
    10391027{
    10401028    /** @todo is it correct? */
     
    10421030        && !!(pThis->u64HpetConfig & HPET_CFG_ENABLE))
    10431031    {
    1044         uint32_t irq = hpetR3TimerGetIrq(pHpetTimer);
     1032        uint32_t irq = hpetR3TimerGetIrq(pThis, pHpetTimer);
    10451033        Log4(("HPET: raising IRQ %d\n", irq));
    10461034
     
    10521040           level-triggered mode yet. */
    10531041        if ((pHpetTimer->u64Config & HPET_TN_INT_TYPE) == HPET_TIMER_TYPE_EDGE)
    1054             pThis->pHpetHlpR3->pfnSetIrq(pThis->CTX_SUFF(pDevIns), irq, PDM_IRQ_LEVEL_FLIP_FLOP);
     1042            pThis->pHpetHlpR3->pfnSetIrq(pDevIns, irq, PDM_IRQ_LEVEL_FLIP_FLOP);
    10551043        else
    10561044            AssertFailed();
     
    11071095
    11081096    /* Should it really be under lock, does it really matter? */
    1109     hpetR3TimerUpdateIrq(pThis, pHpetTimer);
     1097    hpetR3TimerUpdateIrq(pDevIns, pThis, pHpetTimer);
    11101098}
    11111099
     
    12831271    NOREF(offDelta);
    12841272
    1285     pThis->pDevInsRC    = PDMDEVINS_2_RCPTR(pDevIns);
    12861273    pThis->pHpetHlpRC   = pThis->pHpetHlpR3->pfnGetRCHelpers(pDevIns);
    1287 
    1288     for (unsigned i = 0; i < RT_ELEMENTS(pThis->aTimers); i++)
    1289     {
    1290         PHPETTIMER pTm = &pThis->aTimers[i];
    1291         pTm->pHpetRC = PDMINS_2_DATA_RCPTR(pDevIns);
    1292     }
    12931274}
    12941275
     
    13731354     * Initialize the device state.
    13741355     */
    1375     pThis->pDevInsR3 = pDevIns;
    1376     pThis->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
    1377     pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
    13781356
    13791357    /* Init the HPET timers (init all regardless of how many we expose). */
     
    13811359    {
    13821360        PHPETTIMER pHpetTimer = &pThis->aTimers[i];
    1383 
    13841361        pHpetTimer->idxTimer = i;
    1385         pHpetTimer->pHpetR3  = pThis;
    1386         pHpetTimer->pHpetR0  = PDMINS_2_DATA_R0PTR(pDevIns);
    1387         pHpetTimer->pHpetRC  = PDMINS_2_DATA_RCPTR(pDevIns);
     1362        pHpetTimer->hTimer   = NIL_TMTIMERHANDLE;
    13881363    }
    13891364
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