VirtualBox

Changeset 81136 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Oct 8, 2019 8:26:49 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
133769
Message:

IOM,RTC,PCI: Make the port parameter in the I/O port callbacks relative to the start of the mapping rather than absolute. For absolute port numbers, use the IOM_IOPORT_F_ABS flag. bugref:9218

Location:
trunk/src/VBox/VMM
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IOMAll.cpp

    r80960 r81136  
    104104         * Found an entry, get the data so we can leave the IOM lock.
    105105         */
     106        uint16_t const    fFlags        = pRegEntry->fFlags;
    106107        PFNIOMIOPORTNEWIN pfnInCallback = pRegEntry->pfnInCallback;
    107108        PPDMDEVINS        pDevIns       = pRegEntry->pDevIns;
     
    130131        {
    131132            STAM_PROFILE_START(&pStats->CTX_SUFF_Z(ProfIn), a);
    132             rcStrict = pfnInCallback(pDevIns, pvUser, Port, pu32Value, (unsigned)cbValue);
     133            rcStrict = pfnInCallback(pDevIns, pvUser, fFlags & IOM_IOPORT_F_ABS ? Port : offPort, pu32Value, (unsigned)cbValue);
    133134            STAM_PROFILE_STOP(&pStats->CTX_SUFF_Z(ProfIn), a);
    134135            PDMCritSectLeave(pDevIns->CTX_SUFF(pCritSectRo));
     
    349350         * Found an entry, get the data so we can leave the IOM lock.
    350351         */
     352        uint16_t const          fFlags           = pRegEntry->fFlags;
    351353        PFNIOMIOPORTNEWINSTRING pfnInStrCallback = pRegEntry->pfnInStrCallback;
    352354        PFNIOMIOPORTNEWIN       pfnInCallback    = pRegEntry->pfnInCallback;
     
    381383            {
    382384                STAM_PROFILE_START(&pStats->CTX_SUFF_Z(ProfIn), a);
    383                 rcStrict = pfnInStrCallback(pDevIns, pvUser, uPort, (uint8_t *)pvDst, pcTransfers, cb);
     385                rcStrict = pfnInStrCallback(pDevIns, pvUser, fFlags & IOM_IOPORT_F_ABS ? uPort : offPort,
     386                                            (uint8_t *)pvDst, pcTransfers, cb);
    384387                STAM_PROFILE_STOP(&pStats->CTX_SUFF_Z(ProfIn), a);
    385388            }
     
    396399                    uint32_t u32Value = 0;
    397400                    STAM_PROFILE_START(&pStats->CTX_SUFF_Z(ProfIn), a);
    398                     rcStrict = pfnInCallback(pDevIns, pvUser, uPort, &u32Value, cb);
     401                    rcStrict = pfnInCallback(pDevIns, pvUser, fFlags & IOM_IOPORT_F_ABS ? uPort : offPort, &u32Value, cb);
    399402                    STAM_PROFILE_STOP(&pStats->CTX_SUFF_Z(ProfIn), a);
    400403                    if (rcStrict == VERR_IOM_IOPORT_UNUSED)
     
    671674         * Found an entry, get the data so we can leave the IOM lock.
    672675         */
     676        uint16_t const     fFlags           = pRegEntry->fFlags;
    673677        PFNIOMIOPORTNEWOUT pfnOutCallback   = pRegEntry->pfnOutCallback;
    674678        PPDMDEVINS         pDevIns          = pRegEntry->pDevIns;
     
    697701        {
    698702            STAM_PROFILE_START(&pStats->CTX_SUFF_Z(ProfOut), a);
    699             rcStrict = pfnOutCallback(pDevIns, pvUser, Port, u32Value, (unsigned)cbValue);
     703            rcStrict = pfnOutCallback(pDevIns, pvUser, fFlags & IOM_IOPORT_F_ABS ? Port : offPort, u32Value, (unsigned)cbValue);
    700704            STAM_PROFILE_STOP(&pStats->CTX_SUFF_Z(ProfOut), a);
    701705
     
    892896         * Found an entry, get the data so we can leave the IOM lock.
    893897         */
     898        uint16_t const             fFlags            = pRegEntry->fFlags;
    894899        PFNIOMIOPORTNEWOUTSTRING   pfnOutStrCallback = pRegEntry->pfnOutStrCallback;
    895900        PFNIOMIOPORTNEWOUT         pfnOutCallback    = pRegEntry->pfnOutCallback;
     
    924929            {
    925930                STAM_PROFILE_START(&pStats->CTX_SUFF_Z(ProfOut), a);
    926                 rcStrict = pfnOutStrCallback(pDevIns, pvUser, uPort, (uint8_t const *)pvSrc, pcTransfers, cb);
     931                rcStrict = pfnOutStrCallback(pDevIns, pvUser, fFlags & IOM_IOPORT_F_ABS ? uPort : offPort,
     932                                             (uint8_t const *)pvSrc, pcTransfers, cb);
    927933                STAM_PROFILE_STOP(&pStats->CTX_SUFF_Z(ProfOut), a);
    928934            }
     
    946952                    }
    947953                    STAM_PROFILE_START(&pStats->CTX_SUFF_Z(ProfOut), a);
    948                     rcStrict = pfnOutCallback(pDevIns, pvUser, uPort, u32Value, cb);
     954                    rcStrict = pfnOutCallback(pDevIns, pvUser, fFlags & IOM_IOPORT_F_ABS ? uPort : offPort, u32Value, cb);
    949955                    STAM_PROFILE_STOP(&pStats->CTX_SUFF_Z(ProfOut), a);
    950956                    if (IOM_SUCCESS(rcStrict))
  • trunk/src/VBox/VMM/VMMR0/IOMR0.cpp

    r81056 r81136  
    111111    AssertPtrNullReturn(pfnInStr, VERR_INVALID_POINTER);
    112112
     113    uint16_t const fFlags = pGVM->iomr0.s.paIoPortRing3Regs[hIoPorts].fFlags;
    113114    RTIOPORT const cPorts = pGVM->iomr0.s.paIoPortRing3Regs[hIoPorts].cPorts;
    114115    AssertMsgReturn(cPorts > 0 && cPorts <= _8K, ("cPorts=%s\n", cPorts), VERR_IOM_INVALID_IOPORT_HANDLE);
     
    124125    pGVM->iomr0.s.paIoPortRegs[hIoPorts].pfnInStrCallback   = pfnInStr;
    125126    pGVM->iomr0.s.paIoPortRegs[hIoPorts].cPorts             = cPorts;
     127    pGVM->iomr0.s.paIoPortRegs[hIoPorts].fFlags             = fFlags;
    126128#ifdef VBOX_WITH_STATISTICS
    127129    uint16_t const idxStats = pGVM->iomr0.s.paIoPortRing3Regs[hIoPorts].idxStats;
  • trunk/src/VBox/VMM/VMMR3/IOM.cpp

    r81056 r81136  
    471471
    472472    AssertMsgReturn(cPorts > 0 && cPorts <= _8K, ("cPorts=%s\n", cPorts), VERR_OUT_OF_RANGE);
    473     AssertReturn(!fFlags, VERR_INVALID_FLAGS);
     473    AssertReturn(!(fFlags & ~IOM_IOPORT_F_VALID_MASK), VERR_INVALID_FLAGS);
    474474
    475475    AssertReturn(pfnOut || pfnIn || pfnOutStr || pfnInStr, VERR_INVALID_PARAMETER);
     
    540540    pVM->iom.s.paIoPortRegs[idx].idxStats           = (uint16_t)idxStats;
    541541    pVM->iom.s.paIoPortRegs[idx].fMapped            = false;
     542    pVM->iom.s.paIoPortRegs[idx].fFlags             = (uint8_t)fFlags;
    542543    pVM->iom.s.paIoPortRegs[idx].idxSelf            = idx;
    543544
  • trunk/src/VBox/VMM/include/IOMInternal.h

    r81056 r81136  
    180180    /** Same as the handle index. */
    181181    uint16_t                            idxSelf;
     182    /** IOM_IOPORT_F_XXX (copied from ring-3). */
     183    uint16_t                            fFlags;
    182184} IOMIOPORTENTRYR0;
    183185/** Pointer to a ring-0 I/O port handle table entry. */
     
    225227    /** Set if there is an raw-mode entry too. */
    226228    bool                                fRawMode;
    227     bool                                fUnused;
     229    /** IOM_IOPORT_F_XXX */
     230    uint8_t                             fFlags;
    228231    /** Same as the handle index. */
    229232    uint16_t                            idxSelf;
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