Changeset 106123 in vbox for trunk/src/VBox/VMM/include
- Timestamp:
- Sep 23, 2024 10:04:30 PM (5 months ago)
- svn:sync-xref-src-repo-rev:
- 164901
- Location:
- trunk/src/VBox/VMM/include
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/include/IEMInternal.h
r106101 r106123 931 931 #define IEM_MC_F_64BIT RT_BIT_32(6) 932 932 #define IEM_MC_F_NOT_64BIT RT_BIT_32(7) 933 /** This is set by IEMAllN8vePython.py to indicate a variation with the 934 * flags-clearing-and-checking. */ 935 #define IEM_MC_F_WITH_FLAGS RT_BIT_32(8) 933 936 /** This is set by IEMAllN8vePython.py to indicate a variation without the 934 937 * flags-clearing-and-checking, when there is also a variation with that. 935 * @note Do not usethis manully, it's only for python and for testing in938 * @note Do not set this manully, it's only for python and for testing in 936 939 * the native recompiler! */ 937 #define IEM_MC_F_WITHOUT_FLAGS RT_BIT_32( 8)940 #define IEM_MC_F_WITHOUT_FLAGS RT_BIT_32(9) 938 941 /** @} */ 939 942 -
trunk/src/VBox/VMM/include/IEMN8veRecompiler.h
r106117 r106123 1046 1046 /** @} */ 1047 1047 1048 /** @def IEMNATIVE_ASSERT_EFLAGS_SKIPPING_ONLY 1049 * Debug assertion that the required flags are available and not incorrectly skipped. 1050 */ 1051 #ifdef IEMNATIVE_WITH_EFLAGS_SKIPPING 1052 # define IEMNATIVE_ASSERT_EFLAGS_SKIPPING_ONLY(a_pReNative, a_fEflNeeded) \ 1053 AssertMsg(!((a_pReNative)->fSkippingEFlags & (a_fEflNeeded)), \ 1054 ("%#x & %#x -> %#x\n", (a_pReNative)->fSkippingEFlags, \ 1055 a_fEflNeeded, (a_pReNative)->fSkippingEFlags & (a_fEflNeeded) )) 1056 #else 1057 # define IEMNATIVE_ASSERT_EFLAGS_SKIPPING_ONLY(a_pReNative, a_fEflNeeded) ((void)0) 1058 #endif 1059 1060 /** @def IEMNATIVE_ASSERT_EFLAGS_POSTPONING_ONLY 1061 * Debug assertion that the required flags are available and not incorrectly postponed. 1062 */ 1063 #ifdef IEMNATIVE_WITH_EFLAGS_SKIPPING 1064 # define IEMNATIVE_ASSERT_EFLAGS_POSTPONING_ONLY(a_pReNative, a_fEflNeeded) \ 1065 AssertMsg(!((a_pReNative)->fPostponingEFlags & (a_fEflNeeded)), \ 1066 ("%#x & %#x -> %#x\n", (a_pReNative)->fPostponingEFlags, \ 1067 a_fEflNeeded, (a_pReNative)->fPostponingEFlags & (a_fEflNeeded) )) 1068 #else 1069 # define IEMNATIVE_ASSERT_EFLAGS_POSTPONING_ONLY(a_pReNative, a_fEflNeeded) ((void)0) 1070 #endif 1071 1072 /** @def IEMNATIVE_ASSERT_EFLAGS_SKIPPING_AND_POSTPONING 1073 * Debug assertion that the required flags are available and not incorrectly 1074 * skipped or postponed. 1075 */ 1076 #if defined(IEMNATIVE_WITH_EFLAGS_SKIPPING) && defined(IEMNATIVE_WITH_EFLAGS_POSTPONING) 1077 # define IEMNATIVE_ASSERT_EFLAGS_SKIPPING_AND_POSTPONING(a_pReNative, a_fEflNeeded) \ 1078 AssertMsg(!(((a_pReNative)->fSkippingEFlags | (a_pReNative)->fPostponingEFlags) & (a_fEflNeeded)), \ 1079 ("(%#x | %#x) & %#x -> %#x\n", (a_pReNative)->fSkippingEFlags, (a_pReNative)->fPostponingEFlags, \ 1080 a_fEflNeeded, ((a_pReNative)->fSkippingEFlags | (a_pReNative)->fPostponingEFlags) & (a_fEflNeeded) )) 1081 #elif defined(IEMNATIVE_WITH_EFLAGS_SKIPPING) 1082 # define IEMNATIVE_ASSERT_EFLAGS_SKIPPING_AND_POSTPONING(a_pReNative, a_fEflNeeded) \ 1083 IEMNATIVE_ASSERT_EFLAGS_SKIPPING_ONLY(a_pReNative, a_fEflNeeded) 1084 #elif defined(IEMNATIVE_WITH_EFLAGS_POSTPONING) \ 1085 # define IEMNATIVE_ASSERT_EFLAGS_SKIPPING_AND_POSTPONING(a_pReNative, a_fEflNeeded) \ 1086 IEMNATIVE_ASSERT_EFLAGS_POSTPONING_ONLY(a_pReNative, a_fEflNeeded) 1087 #else 1088 # define IEMNATIVE_ASSERT_EFLAGS_SKIPPING_AND_POSTPONING(a_pReNative, a_fEflNeeded) ((void)0) 1089 #endif 1090 1048 1091 /** @def IEMNATIVE_STRICT_EFLAGS_SKIPPING_EMIT_CHECK 1049 1092 * Checks that the EFLAGS bits specified by @a a_fEflNeeded are actually … … 1054 1097 #ifdef IEMNATIVE_STRICT_EFLAGS_SKIPPING 1055 1098 # define IEMNATIVE_STRICT_EFLAGS_SKIPPING_EMIT_CHECK(a_pReNative, a_off, a_fEflNeeded) do { \ 1056 AssertMsg(!((a_pReNative)->fSkippingEFlags & (a_fEflNeeded)), \1057 ("%#x & %#x -> %#x; off=%#x\n", (a_pReNative)->fSkippingEFlags, a_fEflNeeded, \1058 ((a_pReNative)->fSkippingEFlags & (a_fEflNeeded)), a_off)); \1059 1099 (a_off) = iemNativeEmitEFlagsSkippingCheck(a_pReNative, a_off, a_fEflNeeded); \ 1060 1100 } while (0) 1061 1101 #else 1062 # define IEMNATIVE_STRICT_EFLAGS_SKIPPING_EMIT_CHECK(a_pReNative, a_off, a_fEflNeeded) \ 1063 AssertMsg(!((a_pReNative)->fSkippingEFlags & (a_fEflNeeded)), \ 1064 ("%#x & %#x -> %#x; off=%#x\n", (a_pReNative)->fSkippingEFlags, a_fEflNeeded, \ 1065 ((a_pReNative)->fSkippingEFlags & (a_fEflNeeded)), a_off)) 1102 # define IEMNATIVE_STRICT_EFLAGS_SKIPPING_EMIT_CHECK(a_pReNative, a_off, a_fEflNeeded) do { } while (0) 1066 1103 #endif 1067 1104 -
trunk/src/VBox/VMM/include/IEMN8veRecompilerEmit.h
r106061 r106123 8278 8278 8279 8279 8280 8280 8281 /********************************************************************************************************************************* 8281 8282 * TB exiting helpers. * … … 8305 8306 IEMNATIVELABELTYPE enmExitReason, IEMNATIVEINSTRCOND enmCond) 8306 8307 { 8308 IEMNATIVE_ASSERT_EFLAGS_SKIPPING_ONLY(pReNative, X86_EFL_STATUS_BITS); 8309 IEMNATIVE_ASSERT_EFLAGS_POSTPONING_ONLY(pReNative, X86_EFL_STATUS_BITS); /** @todo emit postponed stuff here and invert the condition. */ 8307 8310 Assert(IEMNATIVELABELTYPE_IS_EXIT_REASON(enmExitReason)); 8308 8311 … … 8333 8336 iemNativeEmitJccTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off, IEMNATIVELABELTYPE enmExitReason, IEMNATIVEINSTRCOND enmCond) 8334 8337 { 8338 IEMNATIVE_ASSERT_EFLAGS_SKIPPING_ONLY(pReNative, X86_EFL_STATUS_BITS); 8339 IEMNATIVE_ASSERT_EFLAGS_POSTPONING_ONLY(pReNative, X86_EFL_STATUS_BITS); /** @todo emit postponed stuff here and invert the condition. */ 8335 8340 Assert(IEMNATIVELABELTYPE_IS_EXIT_REASON(enmExitReason)); 8341 8336 8342 #ifdef IEMNATIVE_WITH_RECOMPILER_PER_CHUNK_TAIL_CODE 8337 8343 # ifdef RT_ARCH_AMD64 … … 8413 8419 iemNativeEmitTbExitEx(PIEMRECOMPILERSTATE pReNative, PIEMNATIVEINSTR pCodeBuf, uint32_t off, IEMNATIVELABELTYPE enmExitReason) 8414 8420 { 8421 IEMNATIVE_ASSERT_EFLAGS_SKIPPING_ONLY(pReNative, X86_EFL_STATUS_BITS); 8422 IEMNATIVE_ASSERT_EFLAGS_POSTPONING_ONLY(pReNative, X86_EFL_STATUS_BITS); /** @todo emit postponed stuff here. */ 8415 8423 Assert(IEMNATIVELABELTYPE_IS_EXIT_REASON(enmExitReason)); 8416 8424 … … 8447 8455 bool fActuallyExitingTb = true) 8448 8456 { 8457 IEMNATIVE_ASSERT_EFLAGS_SKIPPING_ONLY(pReNative, X86_EFL_STATUS_BITS); 8458 IEMNATIVE_ASSERT_EFLAGS_POSTPONING_ONLY(pReNative, X86_EFL_STATUS_BITS); /** @todo emit postponed stuff here. */ 8449 8459 Assert(IEMNATIVELABELTYPE_IS_EXIT_REASON(enmExitReason)); 8450 8460 … … 8576 8586 { 8577 8587 Assert(IEMNATIVELABELTYPE_IS_EXIT_REASON(enmExitReason)); 8588 8578 8589 #if defined(IEMNATIVE_WITH_RECOMPILER_PER_CHUNK_TAIL_CODE) && defined(RT_ARCH_AMD64) 8579 8590 Assert(iBitNo < 64); … … 8608 8619 /* ARM64 doesn't have the necessary jump range, so we jump via local label 8609 8620 just like when we keep everything local. */ 8621 IEMNATIVE_ASSERT_EFLAGS_SKIPPING_ONLY(pReNative, X86_EFL_STATUS_BITS); 8622 IEMNATIVE_ASSERT_EFLAGS_POSTPONING_ONLY(pReNative, X86_EFL_STATUS_BITS); /** @todo emit postponed stuff here and invert the condition. */ 8610 8623 uint32_t const idxLabel = iemNativeLabelCreate(pReNative, enmExitReason, UINT32_MAX /*offWhere*/, 0 /*uData*/); 8611 8624 return iemNativeEmitTestBitInGprAndJmpToLabelIfCc(pReNative, off, iGprSrc, iBitNo, idxLabel, true /*fJmpIfSet*/); … … 8622 8635 iemNativeEmitTestIfGprIsNotZeroAndTbExitEx(PIEMRECOMPILERSTATE pReNative, PIEMNATIVEINSTR pCodeBuf, uint32_t off, 8623 8636 uint8_t iGprSrc, bool f64Bit, IEMNATIVELABELTYPE enmExitReason) 8637 { 8638 Assert(IEMNATIVELABELTYPE_IS_EXIT_REASON(enmExitReason)); 8639 8640 #if defined(IEMNATIVE_WITH_RECOMPILER_PER_CHUNK_TAIL_CODE) && defined(RT_ARCH_AMD64) 8641 /* test reg32,reg32 / test reg64,reg64 */ 8642 if (f64Bit) 8643 pCodeBuf[off++] = X86_OP_REX_W | (iGprSrc < 8 ? 0 : X86_OP_REX_R | X86_OP_REX_B); 8644 else if (iGprSrc >= 8) 8645 pCodeBuf[off++] = X86_OP_REX_R | X86_OP_REX_B; 8646 pCodeBuf[off++] = 0x85; 8647 pCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, iGprSrc & 7, iGprSrc & 7); 8648 8649 /* jnz idxLabel */ 8650 return iemNativeEmitJccTbExitEx(pReNative, pCodeBuf, off, enmExitReason, kIemNativeInstrCond_ne); 8651 8652 #else 8653 /* ARM64 doesn't have the necessary jump range, so we jump via local label 8654 just like when we keep everything local. */ 8655 IEMNATIVE_ASSERT_EFLAGS_SKIPPING_ONLY(pReNative, X86_EFL_STATUS_BITS); 8656 IEMNATIVE_ASSERT_EFLAGS_POSTPONING_ONLY(pReNative, X86_EFL_STATUS_BITS); /** @todo emit postponed stuff here and invert the condition. */ 8657 uint32_t const idxLabel = iemNativeLabelCreate(pReNative, enmExitReason, UINT32_MAX /*offWhere*/, 0 /*uData*/); 8658 return iemNativeEmitTestIfGprIsZeroOrNotZeroAndJmpToLabelEx(pReNative, pCodeBuf, off, iGprSrc, 8659 f64Bit, true /*fJmpIfNotZero*/, idxLabel); 8660 #endif 8661 } 8662 8663 8664 /** 8665 * Emits code to exit the current TB with the given reason @a enmExitReason if @a iGprSrc is not zero. 8666 * 8667 * The operand size is given by @a f64Bit. 8668 */ 8669 DECL_INLINE_THROW(uint32_t) 8670 iemNativeEmitTestIfGprIsNotZeroAndTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off, 8671 uint8_t iGprSrc, bool f64Bit, IEMNATIVELABELTYPE enmExitReason) 8672 { 8673 #if defined(IEMNATIVE_WITH_RECOMPILER_PER_CHUNK_TAIL_CODE) && defined(RT_ARCH_AMD64) 8674 off = iemNativeEmitTestIfGprIsNotZeroAndTbExitEx(pReNative, iemNativeInstrBufEnsure(pReNative, off, 3 + 6), 8675 off, iGprSrc, f64Bit, enmExitReason); 8676 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 8677 return off; 8678 #else 8679 IEMNATIVE_ASSERT_EFLAGS_SKIPPING_ONLY(pReNative, X86_EFL_STATUS_BITS); 8680 IEMNATIVE_ASSERT_EFLAGS_POSTPONING_ONLY(pReNative, X86_EFL_STATUS_BITS); /** @todo emit postponed stuff here and invert the condition. */ 8681 uint32_t const idxLabel = iemNativeLabelCreate(pReNative, enmExitReason, UINT32_MAX /*offWhere*/, 0 /*uData*/); 8682 return iemNativeEmitTestIfGprIsZeroOrNotZeroAndJmpToLabel(pReNative, off, iGprSrc, f64Bit, true /*fJmpIfNotZero*/, idxLabel); 8683 #endif 8684 } 8685 8686 8687 /** 8688 * Emits code that exits the current TB with @a enmExitReason if @a iGprSrc is zero. 8689 * 8690 * The operand size is given by @a f64Bit. 8691 */ 8692 DECL_FORCE_INLINE_THROW(uint32_t) 8693 iemNativeEmitTestIfGprIsZeroAndTbExitEx(PIEMRECOMPILERSTATE pReNative, PIEMNATIVEINSTR pCodeBuf, uint32_t off, 8694 uint8_t iGprSrc, bool f64Bit, IEMNATIVELABELTYPE enmExitReason) 8624 8695 { 8625 8696 Assert(IEMNATIVELABELTYPE_IS_EXIT_REASON(enmExitReason)); … … 8634 8705 8635 8706 /* jnz idxLabel */ 8636 return iemNativeEmitJccTbExitEx(pReNative, pCodeBuf, off, enmExitReason, kIemNativeInstrCond_ ne);8707 return iemNativeEmitJccTbExitEx(pReNative, pCodeBuf, off, enmExitReason, kIemNativeInstrCond_e); 8637 8708 8638 8709 #else 8639 8710 /* ARM64 doesn't have the necessary jump range, so we jump via local label 8640 8711 just like when we keep everything local. */ 8641 uint32_t const idxLabel = iemNativeLabelCreate(pReNative, enmExitReason, UINT32_MAX /*offWhere*/, 0 /*uData*/); 8642 return iemNativeEmitTestIfGprIsZeroOrNotZeroAndJmpToLabelEx(pReNative, pCodeBuf, off, iGprSrc, 8643 f64Bit, true /*fJmpIfNotZero*/, idxLabel); 8644 #endif 8645 } 8646 8647 8648 /** 8649 * Emits code to exit the current TB with the given reason @a enmExitReason if @a iGprSrc is not zero. 8650 * 8651 * The operand size is given by @a f64Bit. 8652 */ 8653 DECL_INLINE_THROW(uint32_t) 8654 iemNativeEmitTestIfGprIsNotZeroAndTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off, 8655 uint8_t iGprSrc, bool f64Bit, IEMNATIVELABELTYPE enmExitReason) 8656 { 8657 #if defined(IEMNATIVE_WITH_RECOMPILER_PER_CHUNK_TAIL_CODE) && defined(RT_ARCH_AMD64) 8658 off = iemNativeEmitTestIfGprIsNotZeroAndTbExitEx(pReNative, iemNativeInstrBufEnsure(pReNative, off, 3 + 6), 8659 off, iGprSrc, f64Bit, enmExitReason); 8660 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 8661 return off; 8662 #else 8663 uint32_t const idxLabel = iemNativeLabelCreate(pReNative, enmExitReason, UINT32_MAX /*offWhere*/, 0 /*uData*/); 8664 return iemNativeEmitTestIfGprIsZeroOrNotZeroAndJmpToLabel(pReNative, off, iGprSrc, f64Bit, true /*fJmpIfNotZero*/, idxLabel); 8665 #endif 8666 } 8667 8668 8669 /** 8670 * Emits code that exits the current TB with @a enmExitReason if @a iGprSrc is zero. 8671 * 8672 * The operand size is given by @a f64Bit. 8673 */ 8674 DECL_FORCE_INLINE_THROW(uint32_t) 8675 iemNativeEmitTestIfGprIsZeroAndTbExitEx(PIEMRECOMPILERSTATE pReNative, PIEMNATIVEINSTR pCodeBuf, uint32_t off, 8676 uint8_t iGprSrc, bool f64Bit, IEMNATIVELABELTYPE enmExitReason) 8677 { 8678 Assert(IEMNATIVELABELTYPE_IS_EXIT_REASON(enmExitReason)); 8679 #if defined(IEMNATIVE_WITH_RECOMPILER_PER_CHUNK_TAIL_CODE) && defined(RT_ARCH_AMD64) 8680 /* test reg32,reg32 / test reg64,reg64 */ 8681 if (f64Bit) 8682 pCodeBuf[off++] = X86_OP_REX_W | (iGprSrc < 8 ? 0 : X86_OP_REX_R | X86_OP_REX_B); 8683 else if (iGprSrc >= 8) 8684 pCodeBuf[off++] = X86_OP_REX_R | X86_OP_REX_B; 8685 pCodeBuf[off++] = 0x85; 8686 pCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, iGprSrc & 7, iGprSrc & 7); 8687 8688 /* jnz idxLabel */ 8689 return iemNativeEmitJccTbExitEx(pReNative, pCodeBuf, off, enmExitReason, kIemNativeInstrCond_e); 8690 8691 #else 8692 /* ARM64 doesn't have the necessary jump range, so we jump via local label 8693 just like when we keep everything local. */ 8712 IEMNATIVE_ASSERT_EFLAGS_SKIPPING_ONLY(pReNative, X86_EFL_STATUS_BITS); 8713 IEMNATIVE_ASSERT_EFLAGS_POSTPONING_ONLY(pReNative, X86_EFL_STATUS_BITS); /** @todo emit postponed stuff here and invert the condition. */ 8694 8714 uint32_t const idxLabel = iemNativeLabelCreate(pReNative, enmExitReason, UINT32_MAX /*offWhere*/, 0 /*uData*/); 8695 8715 return iemNativeEmitTestIfGprIsZeroOrNotZeroAndJmpToLabelEx(pReNative, pCodeBuf, off, iGprSrc, … … 8714 8734 return off; 8715 8735 #else 8736 IEMNATIVE_ASSERT_EFLAGS_SKIPPING_ONLY(pReNative, X86_EFL_STATUS_BITS); 8737 IEMNATIVE_ASSERT_EFLAGS_POSTPONING_ONLY(pReNative, X86_EFL_STATUS_BITS); /** @todo emit postponed stuff here and invert the condition. */ 8716 8738 uint32_t const idxLabel = iemNativeLabelCreate(pReNative, enmExitReason, UINT32_MAX /*offWhere*/, 0 /*uData*/); 8717 8739 return iemNativeEmitTestIfGprIsZeroOrNotZeroAndJmpToLabel(pReNative, off, iGprSrc, f64Bit, false /*fJmpIfNotZero*/, idxLabel);
Note:
See TracChangeset
for help on using the changeset viewer.