Changeset 61896 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Jun 27, 2016 12:41:33 PM (9 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/Makefile.kmk
r61885 r61896 784 784 # Always optimize the interpreter. 785 785 # 786 if n1of ($(USERNAME),bird)787 if1of ($(KBUILD_TARGET), win)788 # -noover is recognized despite the statement saying otherwise. It silences these warnings:789 # cl : Command line warning D9025 : overriding '/Od' with '/O2'790 # cl : Command line warning D9025 : overriding '/Oy-' with '/Oy'791 VMMAll/IEMAll.cpp_CXXFLAGS += -noover -O2xy792 else793 VMMAll/IEMAll.cpp_CXXFLAGS += -O2794 #VMMAll/IEMAll.cpp_CXXFLAGS += -fno-align-functions -fno-align-jumps -fno-align-loops # Saves a few of percents, not worth it.795 #VMMAll/IEMAll.cpp_CXXFLAGS += -fno-reorder-blocks # Saves one or two percent ... never mind.796 VMMAll/IEMAll.cpp_CXXFLAGS += -fomit-frame-pointer # Omitting the frame pointer results in larger code, but it might be worth it. (esp addressing vs ebp?)797 endif786 if $(USERNAME) != "bird" || "$(KBUILD_TYPE)" != "release" || "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" == "win.amd64" 787 if1of ($(KBUILD_TARGET), win) 788 # -noover is recognized despite the statement saying otherwise. It silences these warnings: 789 # cl : Command line warning D9025 : overriding '/Od' with '/O2' 790 # cl : Command line warning D9025 : overriding '/Oy-' with '/Oy' 791 VMMAll/IEMAll.cpp_CXXFLAGS += -noover -O2xy 792 else 793 VMMAll/IEMAll.cpp_CXXFLAGS += -O2 794 #VMMAll/IEMAll.cpp_CXXFLAGS += -fno-align-functions -fno-align-jumps -fno-align-loops # Saves a few of percents, not worth it. 795 #VMMAll/IEMAll.cpp_CXXFLAGS += -fno-reorder-blocks # Saves one or two percent ... never mind. 796 VMMAll/IEMAll.cpp_CXXFLAGS += -fomit-frame-pointer # Omitting the frame pointer results in larger code, but it might be worth it. (esp addressing vs ebp?) 797 endif 798 798 endif # bird wants good stacks 799 799 -
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r61885 r61896 1309 1309 DECLINLINE(VBOXSTRICTRC) iemOpcodeGetNextU8(PIEMCPU pIemCpu, uint8_t *pu8) 1310 1310 { 1311 uint8_t const offOpcode = pIemCpu->offOpcode; 1312 if (RT_LIKELY(offOpcode < pIemCpu->cbOpcode)) 1313 { 1311 uintptr_t const offOpcode = pIemCpu->offOpcode; 1312 if (RT_LIKELY((uint8_t)offOpcode < pIemCpu->cbOpcode)) 1313 { 1314 pIemCpu->offOpcode = (uint8_t)offOpcode + 1; 1314 1315 *pu8 = pIemCpu->abOpcode[offOpcode]; 1315 pIemCpu->offOpcode = offOpcode + 1;1316 1316 return VINF_SUCCESS; 1317 1317 } … … 1322 1322 1323 1323 /** 1324 * Deals with the problematic cases that iemOpcodeGetNextU8 doesn't like.1325 * 1326 * @returns Strict VBox status code.1324 * Deals with the problematic cases that iemOpcodeGetNextU8Jmp doesn't like, longjmp on error. 1325 * 1326 * @returns The opcode byte. 1327 1327 * @param pIemCpu The IEM state. 1328 * @param pb Where to return the opcode byte.1329 1328 */ 1330 1329 DECL_NO_INLINE(IEM_STATIC, uint8_t) iemOpcodeGetNextU8SlowJmp(PIEMCPU pIemCpu) … … 1338 1337 1339 1338 /** 1340 * Fetches the next opcode byte .1341 * 1342 * @returns Strict VBox status code.1339 * Fetches the next opcode byte, longjmp on error. 1340 * 1341 * @returns The opcode byte. 1343 1342 * @param pIemCpu The IEM state. 1344 * @param pu8 Where to return the opcode byte.1345 1343 */ 1346 1344 DECLINLINE(uint8_t) iemOpcodeGetNextU8Jmp(PIEMCPU pIemCpu) 1347 1345 { 1348 u nsignedoffOpcode = pIemCpu->offOpcode;1346 uintptr_t offOpcode = pIemCpu->offOpcode; 1349 1347 if (RT_LIKELY((uint8_t)offOpcode < pIemCpu->cbOpcode)) 1350 1348 { … … 1625 1623 DECLINLINE(VBOXSTRICTRC) iemOpcodeGetNextU16(PIEMCPU pIemCpu, uint16_t *pu16) 1626 1624 { 1627 uint8_t const offOpcode = pIemCpu->offOpcode; 1628 if (RT_UNLIKELY(offOpcode + 2 > pIemCpu->cbOpcode)) 1629 return iemOpcodeGetNextU16Slow(pIemCpu, pu16); 1630 1631 *pu16 = RT_MAKE_U16(pIemCpu->abOpcode[offOpcode], pIemCpu->abOpcode[offOpcode + 1]); 1632 pIemCpu->offOpcode = offOpcode + 2; 1633 return VINF_SUCCESS; 1625 uintptr_t const offOpcode = pIemCpu->offOpcode; 1626 if (RT_LIKELY((uint8_t)offOpcode + 2 <= pIemCpu->cbOpcode)) 1627 { 1628 pIemCpu->offOpcode = (uint8_t)offOpcode + 2; 1629 *pu16 = RT_MAKE_U16(pIemCpu->abOpcode[offOpcode], pIemCpu->abOpcode[offOpcode + 1]); 1630 return VINF_SUCCESS; 1631 } 1632 return iemOpcodeGetNextU16Slow(pIemCpu, pu16); 1634 1633 } 1635 1634 … … 1637 1636 1638 1637 /** 1639 * Deals with the problematic cases that iemOpcodeGetNextU16 doesn't like.1640 * 1641 * @returns Strict VBox status code.1638 * Deals with the problematic cases that iemOpcodeGetNextU16Jmp doesn't like, longjmp on error 1639 * 1640 * @returns The opcode word. 1642 1641 * @param pIemCpu The IEM state. 1643 * @param pu16 Where to return the opcode word.1644 1642 */ 1645 1643 DECL_NO_INLINE(IEM_STATIC, uint16_t) iemOpcodeGetNextU16SlowJmp(PIEMCPU pIemCpu) … … 1657 1655 1658 1656 /** 1659 * Fetches the next opcode word .1660 * 1661 * @returns Strict VBox status code.1657 * Fetches the next opcode word, longjmp on error. 1658 * 1659 * @returns The opcode word. 1662 1660 * @param pIemCpu The IEM state. 1663 * @param pu16 Where to return the opcode word.1664 1661 */ 1665 1662 DECLINLINE(uint16_t) iemOpcodeGetNextU16Jmp(PIEMCPU pIemCpu) 1666 1663 { 1667 uint8_t const offOpcode = pIemCpu->offOpcode; 1668 if (RT_UNLIKELY(offOpcode + 2 > pIemCpu->cbOpcode)) 1669 return iemOpcodeGetNextU16SlowJmp(pIemCpu); 1670 1671 pIemCpu->offOpcode = offOpcode + 2; 1672 return RT_MAKE_U16(pIemCpu->abOpcode[offOpcode], pIemCpu->abOpcode[offOpcode + 1]); 1664 uintptr_t const offOpcode = pIemCpu->offOpcode; 1665 if (RT_LIKELY((uint8_t)offOpcode + 2 <= pIemCpu->cbOpcode)) 1666 { 1667 pIemCpu->offOpcode = (uint8_t)offOpcode + 2; 1668 return RT_MAKE_U16(pIemCpu->abOpcode[offOpcode], pIemCpu->abOpcode[offOpcode + 1]); 1669 } 1670 return iemOpcodeGetNextU16SlowJmp(pIemCpu); 1673 1671 } 1674 1672 … … 1892 1890 DECLINLINE(VBOXSTRICTRC) iemOpcodeGetNextU32(PIEMCPU pIemCpu, uint32_t *pu32) 1893 1891 { 1894 uint8_t const offOpcode = pIemCpu->offOpcode; 1895 if (RT_UNLIKELY(offOpcode + 4 > pIemCpu->cbOpcode)) 1896 return iemOpcodeGetNextU32Slow(pIemCpu, pu32); 1897 1898 *pu32 = RT_MAKE_U32_FROM_U8(pIemCpu->abOpcode[offOpcode], 1899 pIemCpu->abOpcode[offOpcode + 1], 1900 pIemCpu->abOpcode[offOpcode + 2], 1901 pIemCpu->abOpcode[offOpcode + 3]); 1902 pIemCpu->offOpcode = offOpcode + 4; 1903 return VINF_SUCCESS; 1892 uintptr_t const offOpcode = pIemCpu->offOpcode; 1893 if (RT_LIKELY((uint8_t)offOpcode + 4 <= pIemCpu->cbOpcode)) 1894 { 1895 pIemCpu->offOpcode = (uint8_t)offOpcode + 4; 1896 *pu32 = RT_MAKE_U32_FROM_U8(pIemCpu->abOpcode[offOpcode], 1897 pIemCpu->abOpcode[offOpcode + 1], 1898 pIemCpu->abOpcode[offOpcode + 2], 1899 pIemCpu->abOpcode[offOpcode + 3]); 1900 return VINF_SUCCESS; 1901 } 1902 return iemOpcodeGetNextU32Slow(pIemCpu, pu32); 1904 1903 } 1905 1904 … … 1907 1906 1908 1907 /** 1909 * Deals with the problematic cases that iemOpcodeGetNextU32 doesn't like.1910 * 1911 * @returns Strict VBox status code.1908 * Deals with the problematic cases that iemOpcodeGetNextU32Jmp doesn't like, longjmp on error. 1909 * 1910 * @returns The opcode dword. 1912 1911 * @param pIemCpu The IEM state. 1913 * @param pu32 Where to return the opcode dword.1914 1912 */ 1915 1913 DECL_NO_INLINE(IEM_STATIC, uint32_t) iemOpcodeGetNextU32SlowJmp(PIEMCPU pIemCpu) … … 1930 1928 1931 1929 /** 1932 * Fetches the next opcode dword .1933 * 1934 * @returns Strict VBox status code.1930 * Fetches the next opcode dword, longjmp on error. 1931 * 1932 * @returns The opcode dword. 1935 1933 * @param pIemCpu The IEM state. 1936 * @param pu32 Where to return the opcode double word.1937 1934 */ 1938 1935 DECLINLINE(uint32_t) iemOpcodeGetNextU32Jmp(PIEMCPU pIemCpu) 1939 1936 { 1940 uint8_t const offOpcode = pIemCpu->offOpcode; 1941 if (RT_UNLIKELY(offOpcode + 4 > pIemCpu->cbOpcode)) 1942 return iemOpcodeGetNextU32SlowJmp(pIemCpu); 1943 1944 pIemCpu->offOpcode = offOpcode + 4; 1945 return RT_MAKE_U32_FROM_U8(pIemCpu->abOpcode[offOpcode], 1946 pIemCpu->abOpcode[offOpcode + 1], 1947 pIemCpu->abOpcode[offOpcode + 2], 1948 pIemCpu->abOpcode[offOpcode + 3]); 1937 uintptr_t const offOpcode = pIemCpu->offOpcode; 1938 if (RT_LIKELY((uint8_t)offOpcode + 4 <= pIemCpu->cbOpcode)) 1939 { 1940 pIemCpu->offOpcode = (uint8_t)offOpcode + 4; 1941 return RT_MAKE_U32_FROM_U8(pIemCpu->abOpcode[offOpcode], 1942 pIemCpu->abOpcode[offOpcode + 1], 1943 pIemCpu->abOpcode[offOpcode + 2], 1944 pIemCpu->abOpcode[offOpcode + 3]); 1945 } 1946 return iemOpcodeGetNextU32SlowJmp(pIemCpu); 1949 1947 } 1950 1948 … … 2185 2183 DECLINLINE(VBOXSTRICTRC) iemOpcodeGetNextU64(PIEMCPU pIemCpu, uint64_t *pu64) 2186 2184 { 2187 uint8_t const offOpcode = pIemCpu->offOpcode; 2188 if (RT_UNLIKELY(offOpcode + 8 > pIemCpu->cbOpcode)) 2189 return iemOpcodeGetNextU64Slow(pIemCpu, pu64); 2190 2191 *pu64 = RT_MAKE_U64_FROM_U8(pIemCpu->abOpcode[offOpcode], 2192 pIemCpu->abOpcode[offOpcode + 1], 2193 pIemCpu->abOpcode[offOpcode + 2], 2194 pIemCpu->abOpcode[offOpcode + 3], 2195 pIemCpu->abOpcode[offOpcode + 4], 2196 pIemCpu->abOpcode[offOpcode + 5], 2197 pIemCpu->abOpcode[offOpcode + 6], 2198 pIemCpu->abOpcode[offOpcode + 7]); 2199 pIemCpu->offOpcode = offOpcode + 8; 2200 return VINF_SUCCESS; 2185 uintptr_t const offOpcode = pIemCpu->offOpcode; 2186 if (RT_LIKELY((uint8_t)offOpcode + 8 <= pIemCpu->cbOpcode)) 2187 { 2188 *pu64 = RT_MAKE_U64_FROM_U8(pIemCpu->abOpcode[offOpcode], 2189 pIemCpu->abOpcode[offOpcode + 1], 2190 pIemCpu->abOpcode[offOpcode + 2], 2191 pIemCpu->abOpcode[offOpcode + 3], 2192 pIemCpu->abOpcode[offOpcode + 4], 2193 pIemCpu->abOpcode[offOpcode + 5], 2194 pIemCpu->abOpcode[offOpcode + 6], 2195 pIemCpu->abOpcode[offOpcode + 7]); 2196 pIemCpu->offOpcode = (uint8_t)offOpcode + 8; 2197 return VINF_SUCCESS; 2198 } 2199 return iemOpcodeGetNextU64Slow(pIemCpu, pu64); 2201 2200 } 2202 2201 … … 2204 2203 2205 2204 /** 2206 * Deals with the problematic cases that iemOpcodeGetNextU64 doesn't like.2207 * 2208 * @returns Strict VBox status code.2205 * Deals with the problematic cases that iemOpcodeGetNextU64Jmp doesn't like, longjmp on error. 2206 * 2207 * @returns The opcode qword. 2209 2208 * @param pIemCpu The IEM state. 2210 * @param pu64 Where to return the opcode qword.2211 2209 */ 2212 2210 DECL_NO_INLINE(IEM_STATIC, uint64_t) iemOpcodeGetNextU64SlowJmp(PIEMCPU pIemCpu) … … 2231 2229 2232 2230 /** 2233 * Fetches the next opcode qword .2234 * 2235 * @returns Strict VBox status code.2231 * Fetches the next opcode qword, longjmp on error. 2232 * 2233 * @returns The opcode qword. 2236 2234 * @param pIemCpu The IEM state. 2237 * @param pu64 Where to return the opcode qword.2238 2235 */ 2239 2236 DECLINLINE(uint64_t) iemOpcodeGetNextU64Jmp(PIEMCPU pIemCpu) 2240 2237 { 2241 uint8_t const offOpcode = pIemCpu->offOpcode; 2242 if (RT_UNLIKELY(offOpcode + 8 > pIemCpu->cbOpcode)) 2243 return iemOpcodeGetNextU64SlowJmp(pIemCpu); 2244 2245 pIemCpu->offOpcode = offOpcode + 8; 2246 return RT_MAKE_U64_FROM_U8(pIemCpu->abOpcode[offOpcode], 2247 pIemCpu->abOpcode[offOpcode + 1], 2248 pIemCpu->abOpcode[offOpcode + 2], 2249 pIemCpu->abOpcode[offOpcode + 3], 2250 pIemCpu->abOpcode[offOpcode + 4], 2251 pIemCpu->abOpcode[offOpcode + 5], 2252 pIemCpu->abOpcode[offOpcode + 6], 2253 pIemCpu->abOpcode[offOpcode + 7]); 2238 uintptr_t const offOpcode = pIemCpu->offOpcode; 2239 if (RT_LIKELY((uint8_t)offOpcode + 8 <= pIemCpu->cbOpcode)) 2240 { 2241 pIemCpu->offOpcode = (uint8_t)offOpcode + 8; 2242 return RT_MAKE_U64_FROM_U8(pIemCpu->abOpcode[offOpcode], 2243 pIemCpu->abOpcode[offOpcode + 1], 2244 pIemCpu->abOpcode[offOpcode + 2], 2245 pIemCpu->abOpcode[offOpcode + 3], 2246 pIemCpu->abOpcode[offOpcode + 4], 2247 pIemCpu->abOpcode[offOpcode + 5], 2248 pIemCpu->abOpcode[offOpcode + 6], 2249 pIemCpu->abOpcode[offOpcode + 7]); 2250 } 2251 return iemOpcodeGetNextU64SlowJmp(pIemCpu); 2254 2252 } 2255 2253
Note:
See TracChangeset
for help on using the changeset viewer.