VirtualBox

Changeset 81906 in vbox


Ignore:
Timestamp:
Nov 17, 2019 3:04:56 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
134703
Message:

DevPit-i8254: Split up the state structure. bugref:9218

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/DevPit-i8254.cpp

    r81902 r81906  
    214214
    215215/**
    216  * The whole PIT state.
     216 * The shared PIT state.
    217217 */
    218218typedef struct PITSTATE
     
    241241    int                     afAlignment2;
    242242#endif
    243     /** PIT port interface. */
    244     PDMIHPETLEGACYNOTIFY    IHpetLegacyNotify;
    245     /** Pointer to the device instance. */
    246     PPDMDEVINSR3            pDevIns;
    247243    /** Number of IRQs that's been raised. */
    248244    STAMCOUNTER             StatPITIrq;
     
    256252    IOMIOPORTHANDLE         hIoPortSpeaker;
    257253} PITSTATE;
    258 /** Pointer to the PIT device state. */
     254/** Pointer to the shared PIT device state. */
    259255typedef PITSTATE *PPITSTATE;
     256
     257
     258/**
     259 * The ring-3 PIT state.
     260 */
     261typedef struct PITSTATER3
     262{
     263    /** PIT port interface. */
     264    PDMIHPETLEGACYNOTIFY    IHpetLegacyNotify;
     265    /** Pointer to the device instance. */
     266    PPDMDEVINSR3            pDevIns;
     267} PITSTATER3;
     268/** Pointer to the ring-3 PIT device state. */
     269typedef PITSTATER3 *PPITSTATER3;
    260270
    261271
     
    12281238static DECLCALLBACK(void) pitNotifyHpetLegacyNotify_ModeChanged(PPDMIHPETLEGACYNOTIFY pInterface, bool fActivated)
    12291239{
    1230     PPITSTATE  pThis   = RT_FROM_MEMBER(pInterface, PITSTATE, IHpetLegacyNotify);
    1231     PPDMDEVINS pDevIns = pThis->pDevIns;
     1240    PPITSTATER3  pThisCC = RT_FROM_MEMBER(pInterface, PITSTATER3, IHpetLegacyNotify);
     1241    PPDMDEVINS   pDevIns = pThisCC->pDevIns;
     1242    PPITSTATE    pThis   = PDMDEVINS_2_DATA(pDevIns, PPITSTATE);
    12321243    PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_IGNORED);
    12331244
     
    12461257{
    12471258    PPDMDEVINS  pDevIns = RT_FROM_MEMBER(pInterface, PDMDEVINS, IBase);
    1248     PPITSTATE   pThis   = PDMDEVINS_2_DATA(pDevIns, PPITSTATE);
     1259    PPITSTATER3 pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PPITSTATER3);
    12491260    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE,    &pDevIns->IBase);
    1250     PDMIBASE_RETURN_INTERFACE(pszIID, PDMIHPETLEGACYNOTIFY, &pThis->IHpetLegacyNotify);
     1261    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIHPETLEGACYNOTIFY, &pThisCC->IHpetLegacyNotify);
    12511262    return NULL;
    12521263}
     
    12991310{
    13001311    PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
    1301     PPITSTATE       pThis = PDMDEVINS_2_DATA(pDevIns, PPITSTATE);
    1302     PCPDMDEVHLPR3   pHlp  = pDevIns->pHlpR3;
     1312    PPITSTATE       pThis   = PDMDEVINS_2_DATA(pDevIns, PPITSTATE);
     1313    PPITSTATER3     pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PPITSTATER3);
     1314    PCPDMDEVHLPR3   pHlp    = pDevIns->pHlpR3;
    13031315    int             rc;
    13041316    uint8_t         u8Irq;
     
    13401352     * Init the data.
    13411353     */
    1342     pThis->pDevIns         = pDevIns;
    13431354    pThis->IOPortBaseCfg   = u16Base;
     1355    pThis->channels[0].irq = u8Irq;
     1356    for (i = 0; i < RT_ELEMENTS(pThis->channels); i++)
     1357    {
     1358        pThis->channels[i].hTimer = NIL_TMTIMERHANDLE;
     1359        pThis->channels[i].iChan  = i;
     1360    }
    13441361    pThis->fSpeakerCfg     = fSpeaker;
    13451362    pThis->enmSpeakerEmu   = PIT_SPEAKER_EMU_NONE;
     
    13991416        }
    14001417    }
    1401     pThis->channels[0].irq = u8Irq;
    1402     for (i = 0; i < RT_ELEMENTS(pThis->channels); i++)
    1403     {
    1404         pThis->channels[i].hTimer = NIL_TMTIMERHANDLE;
    1405         pThis->channels[i].iChan  = i;
    1406     }
    14071418
    14081419    /*
     
    14101421     */
    14111422    /* IBase */
    1412     pDevIns->IBase.pfnQueryInterface        = pitQueryInterface;
     1423    pDevIns->IBase.pfnQueryInterface          = pitQueryInterface;
    14131424    /* IHpetLegacyNotify */
    1414     pThis->IHpetLegacyNotify.pfnModeChanged = pitNotifyHpetLegacyNotify_ModeChanged;
     1425    pThisCC->IHpetLegacyNotify.pfnModeChanged = pitNotifyHpetLegacyNotify_ModeChanged;
     1426    pThisCC->pDevIns                          = pDevIns;
    14151427
    14161428    /*
     
    15061518    /* .uSharedVersion = */         42,
    15071519    /* .cbInstanceShared = */       sizeof(PITSTATE),
    1508     /* .cbInstanceCC = */           0,
     1520    /* .cbInstanceCC = */           CTX_EXPR(sizeof(PITSTATER3), 0, 0),
    15091521    /* .cbInstanceRC = */           0,
    15101522    /* .cMaxPciDevices = */         0,
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