VirtualBox

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


Ignore:
Timestamp:
Nov 28, 2023 2:24:49 PM (14 months ago)
Author:
vboxsync
Message:

VMM/IEM: IEM_MC_FETCH_MEM_U16_DISP and IEM_MC_FETCH_MEM_U32_DISP. bugref:10371

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

Legend:

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

    r102313 r102368  
    254254
    255255/** This is the maximum argument count we'll ever be needing. */
    256 #define IEMNATIVE_CALL_MAX_ARG_COUNT        7
     256#if defined(RT_OS_WINDOWS) && defined(VBOXSTRICTRC_STRICT_ENABLED)
     257# define IEMNATIVE_CALL_MAX_ARG_COUNT       8
     258#else
     259# define IEMNATIVE_CALL_MAX_ARG_COUNT       7
     260#endif
    257261/** @} */
    258262
  • trunk/src/VBox/VMM/include/IEMN8veRecompilerEmit.h

    r102082 r102368  
    721721    uint32_t * const pu32CodeBuf = iemNativeInstrBufEnsure(pReNative, off, 1);
    722722    pu32CodeBuf[off++] = Armv8A64MkInstrBfi(iGprDst, iGprSrc, 8, 8, false /*f64Bit*/);
     723
     724#else
     725# error "port me"
     726#endif
     727    IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off);
     728    return off;
     729}
     730
     731
     732/**
     733 * Emits a gprdst = gprsrc + addend load.
     734 */
     735DECL_INLINE_THROW(uint32_t)
     736iemNativeEmitLoadGprFromGprWithAddend(PIEMRECOMPILERSTATE pReNative, uint32_t off,
     737                                      uint8_t iGprDst, uint8_t iGprSrc, int32_t iAddend)
     738{
     739    Assert(iAddend != 0);
     740
     741#ifdef RT_ARCH_AMD64
     742    /* lea gprdst, [gprsrc + iAddend] */
     743    uint8_t * const pbCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 7);
     744    if ((iGprDst | iGprSrc) >= 8)
     745        pbCodeBuf[off++] = iGprDst < 8  ? X86_OP_REX_W | X86_OP_REX_B
     746                         : iGprSrc >= 8 ? X86_OP_REX_W | X86_OP_REX_R | X86_OP_REX_B
     747                         :                X86_OP_REX_W | X86_OP_REX_R;
     748    else
     749        pbCodeBuf[off++] = X86_OP_REX_W;
     750    pbCodeBuf[off++] = 0x8d;
     751    if (iAddend >= -128 && iAddend < 128)
     752    {
     753        pbCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_MEM1, iGprDst & 7, iGprSrc & 7);
     754        pbCodeBuf[off++] = (int8_t)iAddend;
     755    }
     756    else
     757    {
     758        pbCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_MEM4, iGprDst & 7, iGprSrc & 7);
     759        pbCodeBuf[off++] = RT_BYTE1((uint32_t)iAddend);
     760        pbCodeBuf[off++] = RT_BYTE2((uint32_t)iAddend);
     761        pbCodeBuf[off++] = RT_BYTE3((uint32_t)iAddend);
     762        pbCodeBuf[off++] = RT_BYTE4((uint32_t)iAddend);
     763    }
     764
     765#elif RT_ARCH_ARM64
     766    if ((uint32_t)iAddend < 4096)
     767    {
     768        /* add dst, src, uimm12 */
     769        uint32_t * const pu32CodeBuf = iemNativeInstrBufEnsure(pReNative, off, 1);
     770        pu32CodeBuf[off++] = Armv8A64MkInstrAddSubUImm12(false /*fSub*/, iGprDst, iGprSrc, (uint32_t)iAddend);
     771    }
     772    else if ((uint32_t)-iAddend < 4096)
     773    {
     774        /* sub dst, src, uimm12 */
     775        uint32_t * const pu32CodeBuf = iemNativeInstrBufEnsure(pReNative, off, 1);
     776        pu32CodeBuf[off++] = Armv8A64MkInstrAddSubUImm12(true /*fSub*/, iGprDst, iGprSrc, (uint32_t)-iAddend);
     777    }
     778    else
     779    {
     780        off = iemNativeEmitLoadGprImm64(pReNative, off, iGrpDst, (int64)iAddend);
     781        uint32_t * const pu32CodeBuf = iemNativeInstrBufEnsure(pReNative, off, 1);
     782        pu32CodeBuf[off++] = Armv8A64MkInstrAddSubReg(false /*fSub*/, iGprDst, iGprSrc, iGprDst);
     783    }
    723784
    724785#else
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