Changeset 62092 in vbox
- Timestamp:
- Jul 7, 2016 12:41:23 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r62091 r62092 348 348 */ 349 349 #define IEM_IS_CANONICAL(a_u64Addr) X86_IS_CANONICAL(a_u64Addr) 350 351 /** @def IEM_USE_UNALIGNED_DATA_ACCESS 352 * Use unaligned accesses instead of elaborate byte assembly. */ 353 #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86) || defined(DOXYGEN_RUNNING) 354 # define IEM_USE_UNALIGNED_DATA_ACCESS 355 #endif 350 356 351 357 … … 1707 1713 { 1708 1714 uint8_t offOpcode = pVCpu->iem.s.offOpcode; 1715 # ifdef IEM_USE_UNALIGNED_DATA_ACCESS 1716 *pu16 = (uint16_t const *)&pVCpu->iem.s.abOpcode[offOpcode]; 1717 # else 1709 1718 *pu16 = RT_MAKE_U16(pVCpu->iem.s.abOpcode[offOpcode], pVCpu->iem.s.abOpcode[offOpcode + 1]); 1719 # endif 1710 1720 pVCpu->iem.s.offOpcode = offOpcode + 2; 1711 1721 } … … 1729 1739 { 1730 1740 pVCpu->iem.s.offOpcode = (uint8_t)offOpcode + 2; 1741 # ifdef IEM_USE_UNALIGNED_DATA_ACCESS 1742 *pu16 = (uint16_t const *)&pVCpu->iem.s.abOpcode[offOpcode]; 1743 # else 1731 1744 *pu16 = RT_MAKE_U16(pVCpu->iem.s.abOpcode[offOpcode], pVCpu->iem.s.abOpcode[offOpcode + 1]); 1745 # endif 1732 1746 return VINF_SUCCESS; 1733 1747 } … … 1750 1764 uint8_t offOpcode = pVCpu->iem.s.offOpcode; 1751 1765 pVCpu->iem.s.offOpcode += 2; 1766 # ifdef IEM_USE_UNALIGNED_DATA_ACCESS 1767 return *(uint16_t const *)&pVCpu->iem.s.abOpcode[offOpcode]; 1768 # else 1752 1769 return RT_MAKE_U16(pVCpu->iem.s.abOpcode[offOpcode], pVCpu->iem.s.abOpcode[offOpcode + 1]); 1770 # endif 1753 1771 } 1754 1772 longjmp(*pVCpu->iem.s.CTX_SUFF(pJmpBuf), VBOXSTRICTRC_VAL(rcStrict)); … … 1768 1786 { 1769 1787 pVCpu->iem.s.offOpcode = (uint8_t)offOpcode + 2; 1788 # ifdef IEM_USE_UNALIGNED_DATA_ACCESS 1789 return *(uint16_t const *)&pVCpu->iem.s.abOpcode[offOpcode]; 1790 # else 1770 1791 return RT_MAKE_U16(pVCpu->iem.s.abOpcode[offOpcode], pVCpu->iem.s.abOpcode[offOpcode + 1]); 1792 # endif 1771 1793 } 1772 1794 return iemOpcodeGetNextU16SlowJmp(pVCpu); … … 1971 1993 { 1972 1994 uint8_t offOpcode = pVCpu->iem.s.offOpcode; 1995 # ifdef IEM_USE_UNALIGNED_DATA_ACCESS 1996 *pu32 = *(uint32_t const *)&pVCpu->iem.s.abOpcode[offOpcode]; 1997 # else 1973 1998 *pu32 = RT_MAKE_U32_FROM_U8(pVCpu->iem.s.abOpcode[offOpcode], 1974 1999 pVCpu->iem.s.abOpcode[offOpcode + 1], 1975 2000 pVCpu->iem.s.abOpcode[offOpcode + 2], 1976 2001 pVCpu->iem.s.abOpcode[offOpcode + 3]); 2002 # endif 1977 2003 pVCpu->iem.s.offOpcode = offOpcode + 4; 1978 2004 } … … 1996 2022 { 1997 2023 pVCpu->iem.s.offOpcode = (uint8_t)offOpcode + 4; 2024 # ifdef IEM_USE_UNALIGNED_DATA_ACCESS 2025 *pu32 = *(uint32_t const *)&pVCpu->iem.s.abOpcode[offOpcode]; 2026 # else 1998 2027 *pu32 = RT_MAKE_U32_FROM_U8(pVCpu->iem.s.abOpcode[offOpcode], 1999 2028 pVCpu->iem.s.abOpcode[offOpcode + 1], 2000 2029 pVCpu->iem.s.abOpcode[offOpcode + 2], 2001 2030 pVCpu->iem.s.abOpcode[offOpcode + 3]); 2031 # endif 2002 2032 return VINF_SUCCESS; 2003 2033 } … … 2020 2050 uint8_t offOpcode = pVCpu->iem.s.offOpcode; 2021 2051 pVCpu->iem.s.offOpcode = offOpcode + 4; 2052 # ifdef IEM_USE_UNALIGNED_DATA_ACCESS 2053 return *(uint32_t const *)&pVCpu->iem.s.abOpcode[offOpcode]; 2054 # else 2022 2055 return RT_MAKE_U32_FROM_U8(pVCpu->iem.s.abOpcode[offOpcode], 2023 2056 pVCpu->iem.s.abOpcode[offOpcode + 1], 2024 2057 pVCpu->iem.s.abOpcode[offOpcode + 2], 2025 2058 pVCpu->iem.s.abOpcode[offOpcode + 3]); 2059 # endif 2026 2060 } 2027 2061 longjmp(*pVCpu->iem.s.CTX_SUFF(pJmpBuf), VBOXSTRICTRC_VAL(rcStrict)); … … 2041 2075 { 2042 2076 pVCpu->iem.s.offOpcode = (uint8_t)offOpcode + 4; 2077 # ifdef IEM_USE_UNALIGNED_DATA_ACCESS 2078 return *(uint32_t const *)&pVCpu->iem.s.abOpcode[offOpcode]; 2079 # else 2043 2080 return RT_MAKE_U32_FROM_U8(pVCpu->iem.s.abOpcode[offOpcode], 2044 2081 pVCpu->iem.s.abOpcode[offOpcode + 1], 2045 2082 pVCpu->iem.s.abOpcode[offOpcode + 2], 2046 2083 pVCpu->iem.s.abOpcode[offOpcode + 3]); 2084 # endif 2047 2085 } 2048 2086 return iemOpcodeGetNextU32SlowJmp(pVCpu); … … 2260 2298 { 2261 2299 uint8_t offOpcode = pVCpu->iem.s.offOpcode; 2300 # ifdef IEM_USE_UNALIGNED_DATA_ACCESS 2301 *pu64 = *(uint64_t const *)&pVCpu->iem.s.abOpcode[offOpcode]; 2302 # else 2262 2303 *pu64 = RT_MAKE_U64_FROM_U8(pVCpu->iem.s.abOpcode[offOpcode], 2263 2304 pVCpu->iem.s.abOpcode[offOpcode + 1], … … 2268 2309 pVCpu->iem.s.abOpcode[offOpcode + 6], 2269 2310 pVCpu->iem.s.abOpcode[offOpcode + 7]); 2311 # endif 2270 2312 pVCpu->iem.s.offOpcode = offOpcode + 8; 2271 2313 } … … 2288 2330 if (RT_LIKELY((uint8_t)offOpcode + 8 <= pVCpu->iem.s.cbOpcode)) 2289 2331 { 2332 # ifdef IEM_USE_UNALIGNED_DATA_ACCESS 2333 *pu64 = *(uint64_t const *)&pVCpu->iem.s.abOpcode[offOpcode]; 2334 # else 2290 2335 *pu64 = RT_MAKE_U64_FROM_U8(pVCpu->iem.s.abOpcode[offOpcode], 2291 2336 pVCpu->iem.s.abOpcode[offOpcode + 1], … … 2296 2341 pVCpu->iem.s.abOpcode[offOpcode + 6], 2297 2342 pVCpu->iem.s.abOpcode[offOpcode + 7]); 2343 # endif 2298 2344 pVCpu->iem.s.offOpcode = (uint8_t)offOpcode + 8; 2299 2345 return VINF_SUCCESS; … … 2317 2363 uint8_t offOpcode = pVCpu->iem.s.offOpcode; 2318 2364 pVCpu->iem.s.offOpcode = offOpcode + 8; 2365 # ifdef IEM_USE_UNALIGNED_DATA_ACCESS 2366 return *(uint64_t const *)&pVCpu->iem.s.abOpcode[offOpcode]; 2367 # else 2319 2368 return RT_MAKE_U64_FROM_U8(pVCpu->iem.s.abOpcode[offOpcode], 2320 2369 pVCpu->iem.s.abOpcode[offOpcode + 1], … … 2325 2374 pVCpu->iem.s.abOpcode[offOpcode + 6], 2326 2375 pVCpu->iem.s.abOpcode[offOpcode + 7]); 2376 # endif 2327 2377 } 2328 2378 longjmp(*pVCpu->iem.s.CTX_SUFF(pJmpBuf), VBOXSTRICTRC_VAL(rcStrict)); … … 2342 2392 { 2343 2393 pVCpu->iem.s.offOpcode = (uint8_t)offOpcode + 8; 2394 # ifdef IEM_USE_UNALIGNED_DATA_ACCESS 2395 return *(uint64_t const *)&pVCpu->iem.s.abOpcode[offOpcode]; 2396 # else 2344 2397 return RT_MAKE_U64_FROM_U8(pVCpu->iem.s.abOpcode[offOpcode], 2345 2398 pVCpu->iem.s.abOpcode[offOpcode + 1], … … 2350 2403 pVCpu->iem.s.abOpcode[offOpcode + 6], 2351 2404 pVCpu->iem.s.abOpcode[offOpcode + 7]); 2405 # endif 2352 2406 } 2353 2407 return iemOpcodeGetNextU64SlowJmp(pVCpu);
Note:
See TracChangeset
for help on using the changeset viewer.