VirtualBox

Changeset 104468 in vbox for trunk/src/VBox/VMM/include


Ignore:
Timestamp:
May 1, 2024 12:43:28 AM (7 months ago)
Author:
vboxsync
Message:

VMM/IEM: Deal with the simples direct 'linking' of TBs scenario for relative jumps, when staying with the same code page. bugref:10656

Location:
trunk/src/VBox/VMM/include
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/include/IEMInternal.h

    r104439 r104468  
    13291329#define IEMTB_GET_TB_LOOKUP_TAB_ENTRY(a_pTb, a_idx) \
    13301330    ((PIEMTB *)&(a_pTb)->pabOpcodes[-(int)((a_pTb)->cTbLookupEntries - (a_idx)) * sizeof(PIEMTB)])
     1331
     1332/**
     1333 * Gets the physical address for a TB opcode range.
     1334 */
     1335DECL_FORCE_INLINE(RTGCPHYS) iemTbGetRangePhysPageAddr(PCIEMTB pTb, uint8_t idxRange)
     1336{
     1337    Assert(idxRange < RT_MIN(pTb->cRanges, RT_ELEMENTS(pTb->aRanges)));
     1338    uint8_t const idxPage = pTb->aRanges[idxRange].idxPhysPage;
     1339    Assert(idxPage <= RT_ELEMENTS(pTb->aGCPhysPages));
     1340    if (idxPage == 0)
     1341        return pTb->GCPhysPc & ~(RTGCPHYS)GUEST_PAGE_OFFSET_MASK;
     1342    Assert(!(pTb->aGCPhysPages[idxPage - 1] & GUEST_PAGE_OFFSET_MASK));
     1343    return pTb->aGCPhysPages[idxPage - 1];
     1344}
    13311345
    13321346
     
    20502064//#endif
    20512065
    2052     /** Native recompiler: The TB finished executing completely without jumping to a an exit label. */
     2066    /** Native recompiler: The TB finished executing completely without jumping to a an exit label.
     2067     * Not availabe in release builds. */
    20532068    STAMCOUNTER             StatNativeTbFinished;
    20542069    /** Native recompiler: The TB finished executing jumping to the ReturnBreak label. */
     
    20622077    /** Native recompiler: The TB finished executing via throw / long jump. */
    20632078    STAMCOUNTER             StatNativeTbExitLongJump;
     2079    /** Native recompiler: The TB finished executing jumping to the ReturnBreak
     2080     *  label, but directly jumped to the next TB, scenario \#1 w/o IRQ checks. */
     2081    STAMCOUNTER             StatNativeTbExitDirectLinking1NoIrq;
     2082    /** Native recompiler: The TB finished executing jumping to the ReturnBreak
     2083     *  label, but directly jumped to the next TB, scenario \#1 with IRQ checks. */
     2084    STAMCOUNTER             StatNativeTbExitDirectLinking1Irq;
     2085    /** Native recompiler: The TB finished executing jumping to the ReturnBreak
     2086     *  label, but directly jumped to the next TB, scenario \#1 w/o IRQ checks. */
     2087    STAMCOUNTER             StatNativeTbExitDirectLinking2NoIrq;
     2088    /** Native recompiler: The TB finished executing jumping to the ReturnBreak
     2089     *  label, but directly jumped to the next TB, scenario \#2 with IRQ checks. */
     2090    STAMCOUNTER             StatNativeTbExitDirectLinking2Irq;
    20642091
    20652092    /** Native recompiler: The TB finished executing jumping to the RaiseDe label. */
     
    20842111    STAMCOUNTER             StatNativeTbExitObsoleteTb;
    20852112
    2086     uint64_t                au64Padding[1];
     2113    /** Native recompiler: Failure situations with direct linking scenario \#1.
     2114     * Counter with StatNativeTbExitReturnBreak. Not in release builds.
     2115     * @{  */
     2116    STAMCOUNTER             StatNativeTbExitDirectLinking1NoTb;
     2117    STAMCOUNTER             StatNativeTbExitDirectLinking1MismatchGCPhysPc;
     2118    STAMCOUNTER             StatNativeTbExitDirectLinking1MismatchFlags;
     2119    STAMCOUNTER             StatNativeTbExitDirectLinking1PendingIrq;
     2120    /** @} */
     2121
     2122    /** Native recompiler: Failure situations with direct linking scenario \#2.
     2123     * Counter with StatNativeTbExitReturnBreak. Not in release builds.
     2124     * @{  */
     2125    STAMCOUNTER             StatNativeTbExitDirectLinking2NoTb;
     2126    STAMCOUNTER             StatNativeTbExitDirectLinking2MismatchGCPhysPc;
     2127    STAMCOUNTER             StatNativeTbExitDirectLinking2MismatchFlags;
     2128    STAMCOUNTER             StatNativeTbExitDirectLinking2PendingIrq;
     2129    /** @} */
     2130
     2131    uint64_t                au64Padding[5];
    20872132    /** @} */
    20882133
  • trunk/src/VBox/VMM/include/IEMN8veRecompiler.h

    r104407 r104468  
    473473    kIemNativeLabelType_ReturnBreak,
    474474    kIemNativeLabelType_ReturnBreakFF,
     475    kIemNativeLabelType_ReturnBreakViaLookup,
     476    kIemNativeLabelType_ReturnBreakViaLookupWithIrq,
     477    kIemNativeLabelType_ReturnBreakViaLookupWithTlb,
     478    kIemNativeLabelType_ReturnBreakViaLookupWithTlbAndIrq,
    475479    kIemNativeLabelType_ReturnWithFlags,
    476480    kIemNativeLabelType_NonZeroRetOrPassUp,
     
    14141418    uint32_t                    fSimdRaiseXcptChecksEmitted;
    14151419#endif
     1420    /** The call number of the last CheckIrq, UINT32_MAX if not seen. */
     1421    uint32_t                    idxLastCheckIrqCallNo;
    14161422
    14171423    /** Core state requiring care with branches. */
  • trunk/src/VBox/VMM/include/IEMN8veRecompilerEmit.h

    r104415 r104468  
    76347634
    76357635
     7636
     7637/*********************************************************************************************************************************
     7638*   Indirect Jumps.                                                                                                              *
     7639*********************************************************************************************************************************/
     7640
     7641/**
     7642 * Emits an indirect jump a 64-bit address in a GPR.
     7643 */
     7644DECL_INLINE_THROW(uint32_t) iemNativeEmitJmpViaGpr(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t iGprSrc)
     7645{
     7646#ifdef RT_ARCH_AMD64
     7647    uint8_t * const pCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 3);
     7648    if (iGprSrc >= 8)
     7649        pCodeBuf[off++] = X86_OP_REX_B;
     7650    pCodeBuf[off++] = 0xff;
     7651    pCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, 4, iGprSrc & 7);
     7652
     7653#elif defined(RT_ARCH_ARM64)
     7654    uint32_t * const pCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 1);
     7655    pCodeBuf[off++] = Armv8A64MkInstrBr(iGprSrc);
     7656
     7657#else
     7658# error "port me"
     7659#endif
     7660    IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off);
     7661    return off;
     7662}
     7663
     7664
    76367665/*********************************************************************************************************************************
    76377666*   Calls.                                                                                                                       *
Note: See TracChangeset for help on using the changeset viewer.

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