VirtualBox

Ignore:
Timestamp:
Jul 13, 2024 12:53:36 AM (5 months ago)
Author:
vboxsync
Message:

VMM/IEM: Tweak for really large TLBs; save an instruction on ARM64 and'ing with 32-bit constants that aren't more than 16 bits wide; update the iemNativeHlpCheckTlbLookup code and made it work on ARM64. bugref:10687

File:
1 edited

Legend:

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

    r105271 r105318  
    50245024    else if (iGprDst != iGprSrc)
    50255025    {
     5026        /* If a value greater or equal than 64K isn't more than 16 bits wide,
     5027           we can use shifting to save an instruction.  We prefer the builtin ctz
     5028           here to our own, since the compiler can process uImm at compile time
     5029           if it is a constant value (which is often the case).  This is useful
     5030           for the TLB looup code. */
     5031        if (uImm > 0xffffU)
     5032        {
     5033#  if defined(__GNUC__)
     5034            unsigned cTrailingZeros = __builtin_ctz(uImm);
     5035#  else
     5036            unsigned cTrailingZeros = ASMBitFirstSetU32(uImm) - 1;
     5037#  endif
     5038            if ((uImm >> cTrailingZeros) <= 0xffffU)
     5039            {
     5040                pCodeBuf[off++] = Armv8A64MkInstrMovZ(iGprDst, uImm >> cTrailingZeros);
     5041                pCodeBuf[off++] = Armv8A64MkInstrAnd(iGprDst, iGprSrc,
     5042                                                     iGprDst, true /*f64Bit*/, cTrailingZeros, kArmv8A64InstrShift_Lsl);
     5043                return off;
     5044            }
     5045        }
    50265046        off = iemNativeEmitLoadGpr32ImmEx(pCodeBuf, off, iGprDst, uImm);
    50275047        off = iemNativeEmitAndGpr32ByGpr32Ex(pCodeBuf, off, iGprDst, iGprSrc, fSetFlags);
     
    78817901 * Emits a call to a 64-bit address.
    78827902 */
     7903DECL_FORCE_INLINE(uint32_t) iemNativeEmitCallImmEx(PIEMNATIVEINSTR pCodeBuf, uint32_t off, uintptr_t uPfn,
     7904#ifdef RT_ARCH_AMD64
     7905                                                   uint8_t idxRegTmp = X86_GREG_xAX
     7906#elif defined(RT_ARCH_ARM64)
     7907                                                   uint8_t idxRegTmp = IEMNATIVE_REG_FIXED_TMP0
     7908#else
     7909# error "Port me"
     7910#endif
     7911                                                   )
     7912{
     7913    off = iemNativeEmitLoadGprImmEx(pCodeBuf, off, idxRegTmp, uPfn);
     7914
     7915#ifdef RT_ARCH_AMD64
     7916    /* call idxRegTmp */
     7917    if (idxRegTmp >= 8)
     7918        pCodeBuf[off++] = X86_OP_REX_B;
     7919    pCodeBuf[off++] = 0xff;
     7920    pCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, 2, idxRegTmp & 7);
     7921
     7922#elif defined(RT_ARCH_ARM64)
     7923    pCodeBuf[off++] = Armv8A64MkInstrBlr(idxRegTmp);
     7924
     7925#else
     7926# error "port me"
     7927#endif
     7928    return off;
     7929}
     7930
     7931
     7932/**
     7933 * Emits a call to a 64-bit address.
     7934 */
    78837935DECL_INLINE_THROW(uint32_t) iemNativeEmitCallImm(PIEMRECOMPILERSTATE pReNative, uint32_t off, uintptr_t uPfn)
    78847936{
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