VirtualBox

Changeset 106123 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Sep 23, 2024 10:04:30 PM (8 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
164901
Message:

VMM/IEM: More work on recompilation-time checks of skipped & postponed EFLAGS - fixed incorrect skipping for variants that clears EFLAGS when advancing RIP. The latter had slipped thru and this change reduces the effectiveness of the skipping stuff. :-( bugref:10720

Location:
trunk/src/VBox/VMM/VMMAll
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8vePython.py

    r106061 r106123  
    595595                oNewStmt = copy.deepcopy(oStmt);
    596596                oNewStmt.sName = 'IEM_MC_BEGIN_EX';
    597                 fWithoutFlags = (    self.oVariation.isWithFlagsCheckingAndClearingVariation()
    598                                  and self.oVariation.oParent.hasWithFlagsCheckingAndClearingVariation());
    599                 if fWithoutFlags or self.oVariation.oParent.dsCImplFlags:
     597                fWithFlags    = self.oVariation.isWithFlagsCheckingAndClearingVariation();
     598                fWithoutFlags = not fWithFlags and self.oVariation.oParent.hasWithFlagsCheckingAndClearingVariation();
     599                if fWithFlags or fWithoutFlags or self.oVariation.oParent.dsCImplFlags:
    600600                    if fWithoutFlags:
    601601                        oNewStmt.asParams[0] = ' | '.join(sorted(  list(self.oVariation.oParent.oMcBlock.dsMcFlags.keys())
    602602                                                                 + ['IEM_MC_F_WITHOUT_FLAGS',] ));
     603                    else:
     604                        oNewStmt.asParams[0] = ' | '.join(sorted(  list(self.oVariation.oParent.oMcBlock.dsMcFlags.keys())
     605                                                                 + ['IEM_MC_F_WITH_FLAGS',] ));
    603606                    if self.oVariation.oParent.dsCImplFlags:
    604607                        oNewStmt.asParams[1] = ' | '.join(sorted(self.oVariation.oParent.dsCImplFlags.keys()));
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompFuncs.h

    r106117 r106123  
    34013401iemNativeEmitIfEflagAnysBitsSet(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint32_t fBitsInEfl, uint64_t fLivenessEflBits)
    34023402{
     3403    IEMNATIVE_ASSERT_EFLAGS_SKIPPING_AND_POSTPONING(pReNative,  fBitsInEfl);
    34033404    IEMNATIVE_STRICT_EFLAGS_SKIPPING_EMIT_CHECK(pReNative, off, fBitsInEfl);
    34043405    PIEMNATIVECOND const pEntry = iemNativeCondPushIf(pReNative);
     
    34283429iemNativeEmitIfEflagNoBitsSet(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint32_t fBitsInEfl, uint64_t fLivenessEflBits)
    34293430{
     3431    IEMNATIVE_ASSERT_EFLAGS_SKIPPING_AND_POSTPONING(pReNative,  fBitsInEfl);
    34303432    IEMNATIVE_STRICT_EFLAGS_SKIPPING_EMIT_CHECK(pReNative, off, fBitsInEfl);
    34313433    PIEMNATIVECOND const pEntry = iemNativeCondPushIf(pReNative);
     
    34563458iemNativeEmitIfEflagsBitSet(PIEMRECOMPILERSTATE pReNative, uint32_t off, unsigned iBitNo, uint64_t fLivenessEflBit)
    34573459{
     3460    IEMNATIVE_ASSERT_EFLAGS_SKIPPING_AND_POSTPONING(pReNative,  RT_BIT_32(iBitNo));
    34583461    IEMNATIVE_STRICT_EFLAGS_SKIPPING_EMIT_CHECK(pReNative, off, RT_BIT_32(iBitNo));
    34593462    PIEMNATIVECOND const pEntry = iemNativeCondPushIf(pReNative);
     
    34843487iemNativeEmitIfEflagsBitNotSet(PIEMRECOMPILERSTATE pReNative, uint32_t off, unsigned iBitNo, uint64_t fLivenessEflBit)
    34853488{
     3489    IEMNATIVE_ASSERT_EFLAGS_SKIPPING_AND_POSTPONING(pReNative,  RT_BIT_32(iBitNo));
    34863490    IEMNATIVE_STRICT_EFLAGS_SKIPPING_EMIT_CHECK(pReNative, off, RT_BIT_32(iBitNo));
    34873491    PIEMNATIVECOND const pEntry = iemNativeCondPushIf(pReNative);
     
    35233527{
    35243528    Assert(iBitNo1 != iBitNo2);
     3529    IEMNATIVE_ASSERT_EFLAGS_SKIPPING_AND_POSTPONING(pReNative,  RT_BIT_32(iBitNo1) | RT_BIT_32(iBitNo2));
    35253530    IEMNATIVE_STRICT_EFLAGS_SKIPPING_EMIT_CHECK(pReNative, off, RT_BIT_32(iBitNo1) | RT_BIT_32(iBitNo2));
    35263531    PIEMNATIVECOND const pEntry = iemNativeCondPushIf(pReNative);
     
    36003605    Assert(iBitNo2 != iBitNo);
    36013606    Assert(iBitNo2 != iBitNo1);
     3607    IEMNATIVE_ASSERT_EFLAGS_SKIPPING_AND_POSTPONING(pReNative,  RT_BIT_32(iBitNo) | RT_BIT_32(iBitNo1) | RT_BIT_32(iBitNo2));
    36023608    IEMNATIVE_STRICT_EFLAGS_SKIPPING_EMIT_CHECK(pReNative, off, RT_BIT_32(iBitNo) | RT_BIT_32(iBitNo1) | RT_BIT_32(iBitNo2));
    36033609    PIEMNATIVECOND const pEntry = iemNativeCondPushIf(pReNative);
     
    37773783                                          bool fCheckIfSet, unsigned iBitNo, uint64_t fLivenessEflBit)
    37783784{
     3785    IEMNATIVE_ASSERT_EFLAGS_SKIPPING_AND_POSTPONING(pReNative,  RT_BIT_32(iBitNo));
    37793786    IEMNATIVE_STRICT_EFLAGS_SKIPPING_EMIT_CHECK(pReNative, off, RT_BIT_32(iBitNo));
    37803787    PIEMNATIVECOND const pEntry = iemNativeCondPushIf(pReNative);
     
    38453852
    38463853{
     3854    IEMNATIVE_ASSERT_EFLAGS_SKIPPING_AND_POSTPONING(pReNative,  RT_BIT_32(iBitNo));
    38473855    IEMNATIVE_STRICT_EFLAGS_SKIPPING_EMIT_CHECK(pReNative, off, RT_BIT_32(iBitNo));
    38483856    PIEMNATIVECOND const pEntry = iemNativeCondPushIf(pReNative);
     
    41194127
    41204128{
     4129    IEMNATIVE_ASSERT_EFLAGS_SKIPPING_AND_POSTPONING(pReNative,  X86_EFL_STATUS_BITS);
    41214130    IEMNATIVE_STRICT_EFLAGS_SKIPPING_EMIT_CHECK(pReNative, off, X86_EFL_STATUS_BITS);
    41224131
     
    59305939#endif
    59315940
     5941    IEMNATIVE_ASSERT_EFLAGS_SKIPPING_AND_POSTPONING(pReNative,  a_fEflInput);
    59325942    IEMNATIVE_STRICT_EFLAGS_SKIPPING_EMIT_CHECK(pReNative, off, a_fEflInput);
    59335943
     
    62466256
    62476257#ifdef IEMNATIVE_WITH_EFLAGS_SKIPPING
    6248     Assert(!(pReNative->fSkippingEFlags & fEflInput));
     6258    IEMNATIVE_ASSERT_EFLAGS_SKIPPING_AND_POSTPONING(pReNative,  fEflInput);
     6259    IEMNATIVE_STRICT_EFLAGS_SKIPPING_EMIT_CHECK(pReNative, off, fEflInput);
    62496260    pReNative->fSkippingEFlags &= ~fEflOutput;
    6250     IEMNATIVE_STRICT_EFLAGS_SKIPPING_EMIT_CHECK(pReNative, off, fEflInput);
    62516261# ifdef IEMNATIVE_STRICT_EFLAGS_SKIPPING
    62526262
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp

    r106117 r106123  
    65636563iemNativeEmitThreadedCall(PIEMRECOMPILERSTATE pReNative, uint32_t off, PCIEMTHRDEDCALLENTRY pCallEntry)
    65646564{
     6565    IEMNATIVE_ASSERT_EFLAGS_SKIPPING_AND_POSTPONING(pReNative,  X86_EFL_STATUS_BITS);
    65656566    IEMNATIVE_STRICT_EFLAGS_SKIPPING_EMIT_CHECK(pReNative, off, X86_EFL_STATUS_BITS);
    65666567
     
    69226923    pReNative->Core.bmHstRegs |= RT_BIT_32(IEMNATIVE_CALL_RET_GREG); /* HACK: For IEMNATIVE_STRICT_EFLAGS_SKIPPING_EMIT_CHECK (return register is already set to status code). */
    69236924
     6925    IEMNATIVE_ASSERT_EFLAGS_SKIPPING_AND_POSTPONING(pReNative,  X86_EFL_STATUS_BITS);
    69246926    IEMNATIVE_STRICT_EFLAGS_SKIPPING_EMIT_CHECK(pReNative, off, X86_EFL_STATUS_BITS);
    69256927
     
    1030710309            STAM_REL_COUNTER_INC(&pVCpu->iem.s.StatNativeFullyRecompiledTbs);
    1030810310
    10309 #ifdef IEMNATIVE_WITH_EFLAGS_SKIPPING
    10310         Assert(pReNative->fSkippingEFlags == 0);
    10311 #endif
    10312 #ifdef IEMNATIVE_WITH_EFLAGS_POSTPONING
    10313         Assert(pReNative->fPostponingEFlags == 0);
    10314 #endif
     10311        IEMNATIVE_ASSERT_EFLAGS_SKIPPING_AND_POSTPONING(pReNative, UINT32_MAX);
    1031510312
    1031610313#ifdef VBOX_WITH_STATISTICS
  • trunk/src/VBox/VMM/VMMAll/target-x86/IEMAllN8veEmit-x86.h

    r106117 r106123  
    214214     */
    215215    PCIEMLIVENESSENTRY const pLivenessEntry = &pReNative->paLivenessEntries[pReNative->idxCurCall];
    216     if (IEMLIVENESS_STATE_ARE_STATUS_EFL_TO_BE_CLOBBERED(pLivenessEntry))
     216    if (   IEMLIVENESS_STATE_ARE_STATUS_EFL_TO_BE_CLOBBERED(pLivenessEntry)
     217        && !(pReNative->fMc & IEM_MC_F_WITH_FLAGS))
    217218    {
    218219        STAM_COUNTER_INC(&pReNative->pVCpu->iem.s.StatNativeEflSkippedLogical);
     
    322323     */
    323324    PCIEMLIVENESSENTRY const pLivenessEntry = &pReNative->paLivenessEntries[pReNative->idxCurCall];
    324     if (IEMLIVENESS_STATE_ARE_STATUS_EFL_TO_BE_CLOBBERED(pLivenessEntry))
     325    if (   IEMLIVENESS_STATE_ARE_STATUS_EFL_TO_BE_CLOBBERED(pLivenessEntry)
     326        && !(pReNative->fMc & IEM_MC_F_WITH_FLAGS))
    325327    {
    326328        STAM_COUNTER_INC(&pReNative->pVCpu->iem.s.StatNativeEflSkippedArithmetic);
     
    15771579     */
    15781580    PCIEMLIVENESSENTRY const pLivenessEntry = &pReNative->paLivenessEntries[pReNative->idxCurCall];
    1579     if (IEMLIVENESS_STATE_ARE_STATUS_EFL_TO_BE_CLOBBERED(pLivenessEntry))
     1581    if (   IEMLIVENESS_STATE_ARE_STATUS_EFL_TO_BE_CLOBBERED(pLivenessEntry)
     1582        && !(pReNative->fMc & IEM_MC_F_WITH_FLAGS))
    15801583    {
    15811584        STAM_COUNTER_INC(&pReNative->pVCpu->iem.s.StatNativeEflSkippedShift);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette