Changeset 86209 in vbox for trunk/src/VBox
- Timestamp:
- Sep 22, 2020 6:56:14 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevIommuAmd.cpp
r86204 r86209 1747 1747 } 1748 1748 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 */ 1749 1753 if (pReg->pfnWrite) 1750 1754 { 1751 1755 /* 1752 1756 * 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. 1754 1758 */ 1755 1759 if ( cb == pReg->cb … … 1758 1762 1759 1763 /* 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. 1763 1766 */ 1764 1767 Assert(cb == 4); 1765 1768 if (!(off & 7)) 1766 1769 { 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; 1769 1775 if (pReg->pfnRead) 1770 1776 { 1771 VBOXSTRICTRC rcStrict = pReg->pfnRead(pDevIns, pThis, off, &u Hi);1777 VBOXSTRICTRC rcStrict = pReg->pfnRead(pDevIns, pThis, off, &u64Read); 1772 1778 if (RT_FAILURE(rcStrict)) 1773 1779 { … … 1777 1783 } 1778 1784 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; 1784 1788 return pReg->pfnWrite(pDevIns, pThis, off, uValue); 1785 1789 } 1786 1790 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 */ 1788 1795 Assert(!(off & 3)); 1796 Assert(off & 7); 1789 1797 Assert(off > 4); 1790 uint64_t u Lo;1798 uint64_t u64Read; 1791 1799 if (pReg->pfnRead) 1792 1800 { 1793 VBOXSTRICTRC rcStrict = pReg->pfnRead(pDevIns, pThis, off - 4, &u Lo);1801 VBOXSTRICTRC rcStrict = pReg->pfnRead(pDevIns, pThis, off - 4, &u64Read); 1794 1802 if (RT_FAILURE(rcStrict)) 1795 1803 { … … 1799 1807 } 1800 1808 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)); 1808 1812 return pReg->pfnWrite(pDevIns, pThis, off - 4, uValue); 1809 1813 } 1810 1814 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)); 1812 1816 1813 1817 return VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.