Changeset 100084 in vbox
- Timestamp:
- Jun 6, 2023 2:56:14 PM (18 months ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp
r100061 r100084 4954 4954 { 4955 4955 case IEMMODE_16BIT: 4956 *(uint16_t *)iemGRegRef(pVCpu, iGReg) = offSeg;4956 iemGRegStoreU16(pVCpu, iGReg, offSeg); 4957 4957 break; 4958 4958 case IEMMODE_32BIT: 4959 4959 case IEMMODE_64BIT: 4960 *(uint64_t *)iemGRegRef(pVCpu, iGReg) = offSeg;4960 iemGRegStoreU64(pVCpu, iGReg, offSeg); 4961 4961 break; 4962 4962 IEM_NOT_REACHED_DEFAULT_CASE_RET(); … … 5529 5529 switch (enmEffOpSize) 5530 5530 { 5531 case IEMMODE_16BIT: *(uint16_t *)iemGRegRef(pVCpu, iGReg) = pVCpu->cpum.GstCtx.ldtr.Sel; break; 5532 case IEMMODE_32BIT: *(uint64_t *)iemGRegRef(pVCpu, iGReg) = pVCpu->cpum.GstCtx.ldtr.Sel; break; 5533 case IEMMODE_64BIT: *(uint64_t *)iemGRegRef(pVCpu, iGReg) = pVCpu->cpum.GstCtx.ldtr.Sel; break; 5531 case IEMMODE_16BIT: 5532 iemGRegStoreU16(pVCpu, iGReg, pVCpu->cpum.GstCtx.ldtr.Sel); 5533 break; 5534 case IEMMODE_32BIT: 5535 case IEMMODE_64BIT: 5536 iemGRegStoreU64(pVCpu, iGReg, pVCpu->cpum.GstCtx.ldtr.Sel); 5537 break; 5534 5538 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 5535 5539 } … … 5711 5715 switch (enmEffOpSize) 5712 5716 { 5713 case IEMMODE_16BIT: *(uint16_t *)iemGRegRef(pVCpu, iGReg) = pVCpu->cpum.GstCtx.tr.Sel; break; 5714 case IEMMODE_32BIT: *(uint64_t *)iemGRegRef(pVCpu, iGReg) = pVCpu->cpum.GstCtx.tr.Sel; break; 5715 case IEMMODE_64BIT: *(uint64_t *)iemGRegRef(pVCpu, iGReg) = pVCpu->cpum.GstCtx.tr.Sel; break; 5717 case IEMMODE_16BIT: 5718 iemGRegStoreU16(pVCpu, iGReg, pVCpu->cpum.GstCtx.tr.Sel); 5719 break; 5720 case IEMMODE_32BIT: 5721 case IEMMODE_64BIT: 5722 iemGRegStoreU64(pVCpu, iGReg, pVCpu->cpum.GstCtx.tr.Sel); 5723 break; 5716 5724 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 5717 5725 } … … 5860 5868 /* Store it. */ 5861 5869 if (IEM_IS_64BIT_CODE(pVCpu)) 5862 *(uint64_t *)iemGRegRef(pVCpu, iGReg) = crX;5870 iemGRegStoreU64(pVCpu, iGReg, crX); 5863 5871 else 5864 *(uint64_t *)iemGRegRef(pVCpu, iGReg) = (uint32_t)crX;5872 iemGRegStoreU64(pVCpu, iGReg, (uint32_t)crX); 5865 5873 5866 5874 return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr); … … 5893 5901 case IEMMODE_16BIT: 5894 5902 if (IEM_GET_TARGET_CPU(pVCpu) > IEMTARGETCPU_386) 5895 *(uint16_t *)iemGRegRef(pVCpu, iGReg) = (uint16_t)u64GuestCr0; 5903 iemGRegStoreU16(pVCpu, iGReg, (uint16_t)u64GuestCr0); 5904 /* Unused bits are set on 386 and older CPU: */ 5896 5905 else if (IEM_GET_TARGET_CPU(pVCpu) >= IEMTARGETCPU_386) 5897 *(uint16_t *)iemGRegRef(pVCpu, iGReg) = (uint16_t)u64GuestCr0 | 0xffe0;5906 iemGRegStoreU16(pVCpu, iGReg, (uint16_t)u64GuestCr0 | 0xffe0); 5898 5907 else 5899 *(uint16_t *)iemGRegRef(pVCpu, iGReg) = (uint16_t)u64GuestCr0 | 0xfff0;5908 iemGRegStoreU16(pVCpu, iGReg, (uint16_t)u64GuestCr0 | 0xfff0); 5900 5909 break; 5901 5910 5911 /** @todo testcase for bits 31:16. We're not doing that correctly. */ 5912 5902 5913 case IEMMODE_32BIT: 5903 *(uint32_t *)iemGRegRef(pVCpu, iGReg) = (uint32_t)u64GuestCr0; 5914 if (IEM_GET_TARGET_CPU(pVCpu) >= IEMTARGETCPU_386) 5915 iemGRegStoreU32(pVCpu, iGReg, (uint32_t)u64GuestCr0); 5916 else /** @todo test this! */ 5917 iemGRegStoreU32(pVCpu, iGReg, (uint32_t)u64GuestCr0 | UINT32_C(0x7fffffe0)); /* Unused bits are set on 386. */ 5904 5918 break; 5905 5919 5906 5920 case IEMMODE_64BIT: 5907 *(uint64_t *)iemGRegRef(pVCpu, iGReg) = u64GuestCr0;5921 iemGRegStoreU64(pVCpu, iGReg, u64GuestCr0); 5908 5922 break; 5909 5923 … … 6654 6668 6655 6669 if (IEM_IS_64BIT_CODE(pVCpu)) 6656 *(uint64_t *)iemGRegRef(pVCpu, iGReg) = drX;6670 iemGRegStoreU64(pVCpu, iGReg, drX); 6657 6671 else 6658 *(uint64_t *)iemGRegRef(pVCpu, iGReg) = (uint32_t)drX;6672 iemGRegStoreU32(pVCpu, iGReg, (uint32_t)drX); 6659 6673 6660 6674 return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr); … … 6827 6841 * (different on 386/486) is exceedingly rare. 6828 6842 */ 6829 uint 64_t trX;6843 uint32_t trX; 6830 6844 switch (iTrReg) 6831 6845 { … … 6839 6853 } 6840 6854 6841 *(uint64_t *)iemGRegRef(pVCpu, iGReg) = (uint32_t)trX;6855 iemGRegStoreU32(pVCpu, iGReg, trX); 6842 6856 6843 6857 return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr); … … 6873 6887 * Read the new value from the source register. 6874 6888 */ 6875 uint64_t uNewTrX; 6876 if (IEM_IS_64BIT_CODE(pVCpu)) /** @todo err... 64-bit 386? */ 6877 uNewTrX = iemGRegFetchU64(pVCpu, iGReg); 6878 else 6879 uNewTrX = iemGRegFetchU32(pVCpu, iGReg); 6889 uint32_t uNewTrX = iemGRegFetchU32(pVCpu, iGReg); 6880 6890 6881 6891 /* -
trunk/src/VBox/VMM/include/IEMInline.h
r100059 r100084 1604 1604 * @param iSegReg The segment register. 1605 1605 */ 1606 DECL INLINE(PCPUMSELREG) iemSRegGetHid(PVMCPUCC pVCpu, uint8_t iSegReg) RT_NOEXCEPT1606 DECL_FORCE_INLINE(PCPUMSELREG) iemSRegGetHid(PVMCPUCC pVCpu, uint8_t iSegReg) RT_NOEXCEPT 1607 1607 { 1608 1608 Assert(iSegReg < X86_SREG_COUNT); … … 1622 1622 * @param pSReg The segment register. 1623 1623 */ 1624 DECL INLINE(PCPUMSELREG) iemSRegUpdateHid(PVMCPUCC pVCpu, PCPUMSELREG pSReg) RT_NOEXCEPT1624 DECL_FORCE_INLINE(PCPUMSELREG) iemSRegUpdateHid(PVMCPUCC pVCpu, PCPUMSELREG pSReg) RT_NOEXCEPT 1625 1625 { 1626 1626 Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, pSReg)); … … 1638 1638 * @param iSegReg The segment register. 1639 1639 */ 1640 DECL INLINE(uint16_t *) iemSRegRef(PVMCPUCC pVCpu, uint8_t iSegReg) RT_NOEXCEPT1640 DECL_FORCE_INLINE(uint16_t *) iemSRegRef(PVMCPUCC pVCpu, uint8_t iSegReg) RT_NOEXCEPT 1641 1641 { 1642 1642 Assert(iSegReg < X86_SREG_COUNT); … … 1653 1653 * @param iSegReg The segment register. 1654 1654 */ 1655 DECL INLINE(uint16_t) iemSRegFetchU16(PVMCPUCC pVCpu, uint8_t iSegReg) RT_NOEXCEPT1655 DECL_FORCE_INLINE(uint16_t) iemSRegFetchU16(PVMCPUCC pVCpu, uint8_t iSegReg) RT_NOEXCEPT 1656 1656 { 1657 1657 Assert(iSegReg < X86_SREG_COUNT); … … 1668 1668 * @param iSegReg The segment register. 1669 1669 */ 1670 DECL INLINE(uint64_t) iemSRegBaseFetchU64(PVMCPUCC pVCpu, uint8_t iSegReg) RT_NOEXCEPT1670 DECL_FORCE_INLINE(uint64_t) iemSRegBaseFetchU64(PVMCPUCC pVCpu, uint8_t iSegReg) RT_NOEXCEPT 1671 1671 { 1672 1672 Assert(iSegReg < X86_SREG_COUNT); … … 1683 1683 * @param iReg The general purpose register. 1684 1684 */ 1685 DECL INLINE(void *) iemGRegRef(PVMCPUCC pVCpu, uint8_t iReg) RT_NOEXCEPT1685 DECL_FORCE_INLINE(void *) iemGRegRef(PVMCPUCC pVCpu, uint8_t iReg) RT_NOEXCEPT 1686 1686 { 1687 1687 Assert(iReg < 16); … … 1700 1700 * @param iReg The register. 1701 1701 */ 1702 DECL INLINE(uint8_t *) iemGRegRefU8(PVMCPUCC pVCpu, uint8_t iReg) RT_NOEXCEPT1702 DECL_FORCE_INLINE(uint8_t *) iemGRegRefU8(PVMCPUCC pVCpu, uint8_t iReg) RT_NOEXCEPT 1703 1703 { 1704 1704 if (iReg < 4 || (pVCpu->iem.s.fPrefixes & IEM_OP_PRF_REX)) … … 1723 1723 * whereas 16 thru 19 maps to AH, CH, DH and BH. 1724 1724 */ 1725 DECLINLINE(uint8_t *) iemGRegRefU8Ex(PVMCPUCC pVCpu, uint8_t iRegEx) RT_NOEXCEPT 1726 { 1725 DECL_FORCE_INLINE(uint8_t *) iemGRegRefU8Ex(PVMCPUCC pVCpu, uint8_t iRegEx) RT_NOEXCEPT 1726 { 1727 /** @todo This could be done by double indexing on little endian hosts: 1728 * return &pVCpu->cpum.GstCtx.aGRegs[iRegEx & 15].ab[iRegEx >> 4]; */ 1727 1729 if (iRegEx < 16) 1728 1730 return &pVCpu->cpum.GstCtx.aGRegs[iRegEx].u8; … … 1741 1743 * @param iReg The register. 1742 1744 */ 1743 DECL INLINE(uint16_t *) iemGRegRefU16(PVMCPUCC pVCpu, uint8_t iReg) RT_NOEXCEPT1745 DECL_FORCE_INLINE(uint16_t *) iemGRegRefU16(PVMCPUCC pVCpu, uint8_t iReg) RT_NOEXCEPT 1744 1746 { 1745 1747 Assert(iReg < 16); … … 1755 1757 * @param iReg The register. 1756 1758 */ 1757 DECL INLINE(uint32_t *) iemGRegRefU32(PVMCPUCC pVCpu, uint8_t iReg) RT_NOEXCEPT1759 DECL_FORCE_INLINE(uint32_t *) iemGRegRefU32(PVMCPUCC pVCpu, uint8_t iReg) RT_NOEXCEPT 1758 1760 { 1759 1761 Assert(iReg < 16); … … 1769 1771 * @param iReg The register. 1770 1772 */ 1771 DECL INLINE(int32_t *) iemGRegRefI32(PVMCPUCC pVCpu, uint8_t iReg) RT_NOEXCEPT1773 DECL_FORCE_INLINE(int32_t *) iemGRegRefI32(PVMCPUCC pVCpu, uint8_t iReg) RT_NOEXCEPT 1772 1774 { 1773 1775 Assert(iReg < 16); … … 1783 1785 * @param iReg The register. 1784 1786 */ 1785 DECL INLINE(uint64_t *) iemGRegRefU64(PVMCPUCC pVCpu, uint8_t iReg) RT_NOEXCEPT1787 DECL_FORCE_INLINE(uint64_t *) iemGRegRefU64(PVMCPUCC pVCpu, uint8_t iReg) RT_NOEXCEPT 1786 1788 { 1787 1789 Assert(iReg < 64); … … 1797 1799 * @param iReg The register. 1798 1800 */ 1799 DECL INLINE(int64_t *) iemGRegRefI64(PVMCPUCC pVCpu, uint8_t iReg) RT_NOEXCEPT1801 DECL_FORCE_INLINE(int64_t *) iemGRegRefI64(PVMCPUCC pVCpu, uint8_t iReg) RT_NOEXCEPT 1800 1802 { 1801 1803 Assert(iReg < 16); … … 1811 1813 * @param iSegReg The segment selector. 1812 1814 */ 1813 DECL INLINE(uint64_t *) iemSRegBaseRefU64(PVMCPUCC pVCpu, uint8_t iSegReg) RT_NOEXCEPT1815 DECL_FORCE_INLINE(uint64_t *) iemSRegBaseRefU64(PVMCPUCC pVCpu, uint8_t iSegReg) RT_NOEXCEPT 1814 1816 { 1815 1817 Assert(iSegReg < X86_SREG_COUNT); … … 1827 1829 * @param iReg The register. 1828 1830 */ 1829 DECL INLINE(uint8_t) iemGRegFetchU8(PVMCPUCC pVCpu, uint8_t iReg) RT_NOEXCEPT1831 DECL_FORCE_INLINE(uint8_t) iemGRegFetchU8(PVMCPUCC pVCpu, uint8_t iReg) RT_NOEXCEPT 1830 1832 { 1831 1833 return *iemGRegRefU8(pVCpu, iReg); … … 1843 1845 * whereas 16 thru 19 maps to AH, CH, DH and BH. 1844 1846 */ 1845 DECL INLINE(uint8_t) iemGRegFetchU8Ex(PVMCPUCC pVCpu, uint8_t iRegEx) RT_NOEXCEPT1847 DECL_FORCE_INLINE(uint8_t) iemGRegFetchU8Ex(PVMCPUCC pVCpu, uint8_t iRegEx) RT_NOEXCEPT 1846 1848 { 1847 1849 return *iemGRegRefU8Ex(pVCpu, iRegEx); … … 1856 1858 * @param iReg The register. 1857 1859 */ 1858 DECL INLINE(uint16_t) iemGRegFetchU16(PVMCPUCC pVCpu, uint8_t iReg) RT_NOEXCEPT1860 DECL_FORCE_INLINE(uint16_t) iemGRegFetchU16(PVMCPUCC pVCpu, uint8_t iReg) RT_NOEXCEPT 1859 1861 { 1860 1862 Assert(iReg < 16); … … 1870 1872 * @param iReg The register. 1871 1873 */ 1872 DECL INLINE(uint32_t) iemGRegFetchU32(PVMCPUCC pVCpu, uint8_t iReg) RT_NOEXCEPT1874 DECL_FORCE_INLINE(uint32_t) iemGRegFetchU32(PVMCPUCC pVCpu, uint8_t iReg) RT_NOEXCEPT 1873 1875 { 1874 1876 Assert(iReg < 16); … … 1884 1886 * @param iReg The register. 1885 1887 */ 1886 DECL INLINE(uint64_t) iemGRegFetchU64(PVMCPUCC pVCpu, uint8_t iReg) RT_NOEXCEPT1888 DECL_FORCE_INLINE(uint64_t) iemGRegFetchU64(PVMCPUCC pVCpu, uint8_t iReg) RT_NOEXCEPT 1887 1889 { 1888 1890 Assert(iReg < 16); … … 1892 1894 1893 1895 /** 1896 * Stores a 16-bit value to a general purpose register. 1897 * 1898 * @param pVCpu The cross context virtual CPU structure of the calling thread. 1899 * @param iReg The register. 1900 * @param uValue The value to store. 1901 */ 1902 DECL_FORCE_INLINE(void) iemGRegStoreU16(PVMCPUCC pVCpu, uint8_t iReg, uint16_t uValue) RT_NOEXCEPT 1903 { 1904 Assert(iReg < 16); 1905 pVCpu->cpum.GstCtx.aGRegs[iReg].u16 = uValue; 1906 } 1907 1908 1909 /** 1910 * Stores a 32-bit value to a general purpose register, implicitly clearing high 1911 * values. 1912 * 1913 * @param pVCpu The cross context virtual CPU structure of the calling thread. 1914 * @param iReg The register. 1915 * @param uValue The value to store. 1916 */ 1917 DECL_FORCE_INLINE(void) iemGRegStoreU32(PVMCPUCC pVCpu, uint8_t iReg, uint32_t uValue) RT_NOEXCEPT 1918 { 1919 Assert(iReg < 16); 1920 pVCpu->cpum.GstCtx.aGRegs[iReg].u64 = uValue; 1921 } 1922 1923 1924 /** 1925 * Stores a 64-bit value to a general purpose register. 1926 * 1927 * @param pVCpu The cross context virtual CPU structure of the calling thread. 1928 * @param iReg The register. 1929 * @param uValue The value to store. 1930 */ 1931 DECL_FORCE_INLINE(void) iemGRegStoreU64(PVMCPUCC pVCpu, uint8_t iReg, uint64_t uValue) RT_NOEXCEPT 1932 { 1933 Assert(iReg < 16); 1934 pVCpu->cpum.GstCtx.aGRegs[iReg].u64 = uValue; 1935 } 1936 1937 1938 /** 1894 1939 * Get the address of the top of the stack. 1895 1940 * 1896 1941 * @param pVCpu The cross context virtual CPU structure of the calling thread. 1897 1942 */ 1898 DECL INLINE(RTGCPTR) iemRegGetEffRsp(PCVMCPU pVCpu) RT_NOEXCEPT1943 DECL_FORCE_INLINE(RTGCPTR) iemRegGetEffRsp(PCVMCPU pVCpu) RT_NOEXCEPT 1899 1944 { 1900 1945 if (IEM_IS_64BIT_CODE(pVCpu))
Note:
See TracChangeset
for help on using the changeset viewer.