VirtualBox

Changeset 105728 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Aug 19, 2024 2:09:39 PM (6 months ago)
Author:
vboxsync
Message:

VMM/IEM: Ditch the if (pTlbe->pbMappingR3) check from the native TLB lookup code (todo 12). Reduced the TLB data lookup on ARM by one instruction in most cases (todo 13). bugref:10720

File:
1 edited

Legend:

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

    r105318 r105728  
    10571057     *    IEMCPU members and we return a GCPhys address rather than a host pointer.
    10581058     */
     1059# if defined(RT_ARCH_ARM64)
     1060    uint8_t const idxRegMappingPtr = a_fDataTlb && idxRegFlatPtr != idxRegMemResult /* See step 1b. */
     1061                                   ? idxRegMemResult /* saves one instruction */ : pTlbState->idxReg1;
     1062# else
     1063    uint8_t const idxRegMappingPtr = pTlbState->idxReg1; /** @todo optimize the AMD64 case as well. */
     1064# endif
    10591065# if defined(RT_ARCH_ARM64) && defined(IEMNATIVE_WITH_TLB_LOOKUP_LOAD_STORE_PAIR)
    10601066    if (!a_fDataTlb)
     
    10631069        AssertCompileMemberAlignment(IEMTLBENTRY, GCPhys, 16);
    10641070        AssertCompileAdjacentMembers(IEMTLBENTRY, GCPhys, pbMappingR3);
    1065         pCodeBuf[off++] = Armv8A64MkInstrLdPairGpr(pTlbState->idxReg4, pTlbState->idxReg1,
     1071        pCodeBuf[off++] = Armv8A64MkInstrLdPairGpr(pTlbState->idxReg4, idxRegMappingPtr,
    10661072                                                   pTlbState->idxReg2, RT_UOFFSETOF(IEMTLBENTRY, GCPhys) / 8);
    10671073    }
     
    10701076    {
    10711077        /* mov  reg1, [reg2->pbMappingR3] */
    1072         off = iemNativeEmitLoadGprByGprU64Ex(pCodeBuf, off, pTlbState->idxReg1, pTlbState->idxReg2,
     1078        off = iemNativeEmitLoadGprByGprU64Ex(pCodeBuf, off, idxRegMappingPtr, pTlbState->idxReg2,
    10731079                                             RT_UOFFSETOF(IEMTLBENTRY, pbMappingR3));
    10741080    }
    1075     /* if (!reg1) goto tlbmiss; */
    1076     /** @todo eliminate the need for this test? */
    1077     off = iemNativeEmitTestIfGprIsZeroAndJmpToLabelEx(pReNative, pCodeBuf, off, pTlbState->idxReg1,
    1078                                                       true /*f64Bit*/, idxLabelTlbMiss);
    10791081
    10801082    if (a_fDataTlb)
     
    10821084        if (idxRegFlatPtr == idxRegMemResult) /* See step 1b. */
    10831085        {
     1086            Assert(idxRegMappingPtr == pTlbState->idxReg1);
    10841087            /* and result, 0xfff */
    10851088            off = iemNativeEmitAndGpr32ByImmEx(pCodeBuf, off, idxRegMemResult, GUEST_PAGE_OFFSET_MASK);
     1089            /* add result, reg1 */
     1090            off = iemNativeEmitAddTwoGprsEx(pCodeBuf, off, idxRegMemResult, idxRegMappingPtr);
    10861091        }
    10871092        else
    10881093        {
    10891094            Assert(idxRegFlatPtr == pTlbState->idxRegPtr);
     1095# if defined(RT_ARCH_ARM64)
     1096            Assert(idxRegMappingPtr == idxRegMemResult);
     1097            AssertCompile(GUEST_PAGE_SIZE <= HOST_PAGE_SIZE);
     1098            pCodeBuf[off++] = Armv8A64MkInstrBfxil(idxRegMemResult, idxRegFlatPtr, 0, GUEST_PAGE_SHIFT);
     1099# else
     1100            Assert(idxRegMappingPtr == pTlbState->idxReg1);
    10901101            /* result = regflat & 0xfff */
    10911102            off = iemNativeEmitGpr32EqGprAndImmEx(pCodeBuf, off, idxRegMemResult, idxRegFlatPtr, GUEST_PAGE_OFFSET_MASK);
    1092         }
    1093 
    1094         /* add result, reg1 */
    1095         off = iemNativeEmitAddTwoGprsEx(pCodeBuf, off, idxRegMemResult, pTlbState->idxReg1);
     1103            /* add result, reg1 */
     1104            off = iemNativeEmitAddTwoGprsEx(pCodeBuf, off, idxRegMemResult, pTlbState->idxReg1);
     1105# endif
     1106        }
    10961107    }
    10971108    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