VirtualBox

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


Ignore:
Timestamp:
Dec 21, 2023 7:18:59 PM (15 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
160850
Message:

VMM/IEM: Fixed bug in native opcode comparison, caused lots of incorrect obsoletion when a check didn't start at the first byte in an opcode range. bugref:10371

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompBltIn.cpp

    r102663 r102683  
    449449    off = iemNativeEmitBltInCheckOpcodes(pReNative, off, (a_pTb), (a_idxRange), (a_offRange))
    450450
     451#if 0 /* debugging aid */
     452bool g_fBpOnObsoletion = false;
     453# define BP_ON_OBSOLETION g_fBpOnObsoletion
     454#else
     455# define BP_ON_OBSOLETION 0
     456#endif
     457
    451458DECL_FORCE_INLINE(uint32_t)
    452459iemNativeEmitBltInCheckOpcodes(PIEMRECOMPILERSTATE pReNative, uint32_t off, PCIEMTB pTb, uint8_t idxRange, uint16_t offRange)
     
    473480    uint16_t            cbLeft      = pTb->aRanges[idxRange].cbOpcodes   - offRange;
    474481    Assert(cbLeft > 0);
    475     uint8_t const      *pbOpcodes   = &pTb->pabOpcodes[pTb->aRanges[idxRange].offOpcodes];
     482    uint8_t const      *pbOpcodes   = &pTb->pabOpcodes[pTb->aRanges[idxRange].offOpcodes + offRange];
    476483    uint32_t            offConsolidatedJump = UINT32_MAX;
    477484
     
    497504            { \
    498505                pbCodeBuf[off++] = 0x74; /* jz near +5 */ \
    499                 pbCodeBuf[off++] = 0x05 /*+ 1*/; \
     506                pbCodeBuf[off++] = 0x05 + BP_ON_OBSOLETION; \
    500507                offConsolidatedJump = off; \
    501                 /*pbCodeBuf[off++] = 0xcc; */ \
     508                if (BP_ON_OBSOLETION) pbCodeBuf[off++] = 0xcc; \
    502509                pbCodeBuf[off++] = 0xe9; /* jmp rel32 */ \
    503510                iemNativeAddFixup(pReNative, off, idxLabelObsoleteTb, kIemNativeFixupType_Rel32, -4); \
     
    571578        }
    572579
    573         uint8_t * const pbCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 5 + 14 + 54 + 8 + 6 /* = 87 */);
     580        uint8_t * const pbCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 5 + 14 + 54 + 8 + 6 + BP_ON_OBSOLETION /* = 87 */);
    574581
    575582        if (cbLeft > 8)
     
    615622        uint8_t const idxRegCx = iemNativeRegAllocTmpEx(pReNative, &off, RT_BIT_32(X86_GREG_xCX));
    616623
    617         uint8_t * const pbCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 5 + 10 + 5 + 5 + 3 + 4 + 3 /*= 35*/);
     624        uint8_t * const pbCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 5 + 10 + 5 + 5 + 3 + 4 + 3 + BP_ON_OBSOLETION /*= 35*/);
    618625
    619626        /** @todo profile and optimize this further.  Maybe an idea to align by
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