VirtualBox

Changeset 86209 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Sep 22, 2020 6:56:14 AM (4 years ago)
Author:
vboxsync
Message:

AMD IOMMU: bugref:9654 Nits.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Bus/DevIommuAmd.cpp

    r86204 r86209  
    17471747    }
    17481748
     1749    /*
     1750     * Ensure the register is writable and proceed.
     1751     * If a write handler doesn't exist, it's either a reserved or read-only register.
     1752     */
    17491753    if (pReg->pfnWrite)
    17501754    {
    17511755        /*
    17521756         * If the write access is aligned and matches the register size, dispatch right away.
    1753          * This handles all aligned, 32-bit writes as well.
     1757         * This handles all aligned, 32-bit writes as well as aligned 64-bit writes.
    17541758         */
    17551759        if (   cb == pReg->cb
     
    17581762
    17591763        /*
    1760          * A 32-bit access for a 64-bit register.
    1761          * This is writing a 64-bit register since we took care of 32-bit writes above.
    1762          * We shouldn't get smaller sizes because we've specified so with IOM.
     1764         * A 32-bit write for a 64-bit register.
     1765         * We shouldn't get sizes other than 32 bits here as we've specified so with IOM.
    17631766         */
    17641767        Assert(cb == 4);
    17651768        if (!(off & 7))
    17661769        {
    1767             /* Lower 32-bits are being written. Merge with higher bits of the register. */
    1768             uint64_t uHi;
     1770            /*
     1771             * Lower 32 bits of the register is being written.
     1772             * Merge with higher 32 bits (after reading the full value from the register).
     1773             */
     1774            uint64_t u64Read;
    17691775            if (pReg->pfnRead)
    17701776            {
    1771                 VBOXSTRICTRC rcStrict = pReg->pfnRead(pDevIns, pThis, off, &uHi);
     1777                VBOXSTRICTRC rcStrict = pReg->pfnRead(pDevIns, pThis, off, &u64Read);
    17721778                if (RT_FAILURE(rcStrict))
    17731779                {
     
    17771783            }
    17781784            else
    1779                 uHi = 0;
    1780             uHi &= UINT64_C(0xffffffff00000000);
    1781             uValue |= uHi;
    1782 
    1783             /* Perform the full, 64-bit write. */
     1785                u64Read = 0;
     1786
     1787            uValue = (u64Read & UINT64_C(0xffffffff00000000)) | uValue;
    17841788            return pReg->pfnWrite(pDevIns, pThis, off, uValue);
    17851789        }
    17861790
    1787         /* Higher 32-bits are being written. Merge with lower bits of the register. */
     1791        /*
     1792         * Higher 32 bits of the register is being written.
     1793         * Merge with lower 32 bits (after reading the full value from the register).
     1794         */
    17881795        Assert(!(off & 3));
     1796        Assert(off & 7);
    17891797        Assert(off > 4);
    1790         uint64_t uLo;
     1798        uint64_t u64Read;
    17911799        if (pReg->pfnRead)
    17921800        {
    1793             VBOXSTRICTRC rcStrict = pReg->pfnRead(pDevIns, pThis, off - 4, &uLo);
     1801            VBOXSTRICTRC rcStrict = pReg->pfnRead(pDevIns, pThis, off - 4, &u64Read);
    17941802            if (RT_FAILURE(rcStrict))
    17951803            {
     
    17991807        }
    18001808        else
    1801             uLo = 0;
    1802 
    1803         uLo &= UINT64_C(0x00000000ffffffff);
    1804         uValue <<= 32;
    1805         uValue |= uLo;
    1806 
    1807         /* Perform the full, 64-bit write. */
     1809            u64Read = 0;
     1810
     1811        uValue = (uValue << 32) | (u64Read & UINT64_C(0xffffffff));
    18081812        return pReg->pfnWrite(pDevIns, pThis, off - 4, uValue);
    18091813    }
    18101814    else
    1811         LogFunc(("Writing unknown register %u (%#x) with %#RX64 (cb=%u) -> Ignored\n", off,  off, uValue, cb));
     1815        LogFunc(("Writing reserved or read-only register off=%#x (cb=%u) with %#RX64 -> Ignored\n", off, cb, uValue));
    18121816
    18131817    return VINF_SUCCESS;
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