VirtualBox

Changeset 101661 in vbox


Ignore:
Timestamp:
Oct 30, 2023 2:55:00 PM (15 months ago)
Author:
vboxsync
Message:

VMM/IEM: Windows build recompiler fixes. Fixed handling of 8-bit registers on AMD64 hosts (test instr). bugref:10371

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

Legend:

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

    r101641 r101661  
    613613        {
    614614#ifdef IEMEXECMEM_USE_ALT_SUB_ALLOCATOR
    615             uint32_t const idxFirst  = offChunk >> IEMEXECMEM_ALT_SUB_ALLOC_UNIT_SHIFT;
    616             uint32_t const cReqUnits = cb       >> IEMEXECMEM_ALT_SUB_ALLOC_UNIT_SHIFT;
     615            uint32_t const idxFirst  = (uint32_t)offChunk >> IEMEXECMEM_ALT_SUB_ALLOC_UNIT_SHIFT;
     616            uint32_t const cReqUnits = (uint32_t)cb       >> IEMEXECMEM_ALT_SUB_ALLOC_UNIT_SHIFT;
    617617
    618618            /* Check that it's valid and free it. */
     
    750750     */
    751751    uint8_t fRet = RtlAddFunctionTable(paFunctions, cFunctionEntries, (uintptr_t)pvChunk);
    752     AssertReturn(fRet, NULL); /* Nothing to clean up on failure, since its within the chunk itself. */
    753 
    754     return paFunctions;
     752    AssertReturn(fRet, VERR_INTERNAL_ERROR_3); /* Nothing to clean up on failure, since its within the chunk itself. */
     753
     754    return VINF_SUCCESS;
    755755}
    756756
     
    15721572    pVCpu->iem.s.cInstructions += idxInstr;
    15731573    iemRaiseGeneralProtectionFault0Jmp(pVCpu);
     1574#ifndef _MSC_VER
    15741575    return VINF_IEM_RAISED_XCPT; /* not reached */
     1576#endif
    15751577}
    15761578
     
    18991901
    19001902    uint32_t const cbNew = cNew * sizeof(IEMNATIVEINSTR);
    1901 #if RT_ARCH_ARM64
     1903#ifdef RT_ARCH_ARM64
    19021904    AssertReturn(cbNew <= _1M, NULL); /* Limited by the branch instruction range (18+2 bits). */
    19031905#else
     
    21222124} const g_aGstShadowInfo[] =
    21232125{
    2124 #define CPUMCTX_OFF_AND_SIZE(a_Reg) RT_UOFFSETOF(VMCPU, cpum.GstCtx. a_Reg), RT_SIZEOFMEMB(VMCPU, cpum.GstCtx. a_Reg)
     2126#define CPUMCTX_OFF_AND_SIZE(a_Reg) (uint32_t)RT_UOFFSETOF(VMCPU, cpum.GstCtx. a_Reg), RT_SIZEOFMEMB(VMCPU, cpum.GstCtx. a_Reg)
    21252127    /* [kIemNativeGstReg_GprFirst + X86_GREG_xAX] = */  { CPUMCTX_OFF_AND_SIZE(rax),                "rax", },
    21262128    /* [kIemNativeGstReg_GprFirst + X86_GREG_xCX] = */  { CPUMCTX_OFF_AND_SIZE(rcx),                "rcx", },
     
    34623464    if (cAddParams > 2)
    34633465        off = iemNativeEmitStoreImm64ByBp(pReNative, off, IEMNATIVE_FP_OFF_STACK_ARG1, uParam2);
    3464     off = iemNativeEmitLeaGrpByBp(pReNative, off, X86_GREG_xCX, IEMNATIVE_FP_OFF_IN_SHADOW_ARG0); /* rcStrict */
     3466    off = iemNativeEmitLeaGprByBp(pReNative, off, X86_GREG_xCX, IEMNATIVE_FP_OFF_IN_SHADOW_ARG0); /* rcStrict */
    34653467
    34663468#else
     
    35263528        off = iemNativeEmitLoadGprImm64(pReNative, off, X86_GREG_x10, pCallEntry->auParams[2]);
    35273529    off = iemNativeEmitStoreGprByBp(pReNative, off, IEMNATIVE_FP_OFF_STACK_ARG0, X86_GREG_x10);
    3528     off = iemNativeEmitLeaGrpByBp(pReNative, off, X86_GREG_xCX, IEMNATIVE_FP_OFF_IN_SHADOW_ARG0); /* rcStrict */
     3530    off = iemNativeEmitLeaGprByBp(pReNative, off, X86_GREG_xCX, IEMNATIVE_FP_OFF_IN_SHADOW_ARG0); /* rcStrict */
    35293531#  endif /* VBOXSTRICTRC_STRICT_ENABLED */
    35303532# else
     
    51255127    AssertCompile(RT_ELEMENTS(s_aModes) == IEM_F_MODE_MASK + 1);
    51265128    memcpy(pszBuf, s_aModes[fFlags & IEM_F_MODE_MASK].psz, s_aModes[fFlags & IEM_F_MODE_MASK].cch);
    5127     unsigned off = s_aModes[fFlags & IEM_F_MODE_MASK].cch;
     5129    size_t off = s_aModes[fFlags & IEM_F_MODE_MASK].cch;
    51285130
    51295131    pszBuf[off++] = ' ';
     
    55985600        }
    55995601        iemNativeDbgInfoAddThreadedCall(pReNative, (IEMTHREADEDFUNCS)pCallEntry->enmFunction, pfnRecom != NULL);
    5600 #endif
    5601 
    5602 #ifdef VBOX_STRICT
     5602#elif defined(VBOX_STRICT)
    56035603        off = iemNativeEmitMarker(pReNative, off,
    56045604                                  RT_MAKE_U32((pTb->Thrd.cCalls - cCallsLeft - 1) | (pfnRecom ? 0x8000 : 0),
  • trunk/src/VBox/VMM/VMMAll/IEMAllThrdPython.py

    r101640 r101661  
    8787    'IEMPCMPISTRXSRC':  (  256,   False, 'IEMPCMPISTRXSRC', ),
    8888    'IEMPCMPESTRXSRC':  (  384,   False, 'IEMPCMPESTRXSRC', ),
    89 } | g_kdTypeInfo;
     89}; #| g_kdTypeInfo; - requires 3.9
     90g_kdTypeInfo2.update(g_kdTypeInfo);
    9091
    9192def getTypeBitCount(sType):
     
    17851786                        cNative += 1;
    17861787            print('debug: %.1f%% / %u out of %u threaded function variations are recompilable'
    1787                   % (cNative * 100.0 / cTotal, cNative, cTotal));
     1788                  % (cNative * 100.0 / cTotal, cNative, cTotal), file = sys.stderr);
    17881789
    17891790        # Gather arguments + variable statistics for the MC blocks.
     
    18201821
    18211822        print('debug: max vars+args: %u bytes / %u; max vars: %u bytes / %u; max args: %u bytes / %u'
    1822               % (cbMaxVarsAndArgs, cMaxVarsAndArgs, cbMaxVars, cMaxVars, cbMaxArgs, cMaxArgs,));
     1823              % (cbMaxVarsAndArgs, cMaxVarsAndArgs, cbMaxVars, cMaxVars, cbMaxArgs, cMaxArgs,), file = sys.stderr);
    18231824
    18241825        return True;
     
    24732474                             help    = 'Displays the version/revision of the script and exit.');
    24742475        self.oOptions = oParser.parse_args(asArgs[1:]);
    2475         print("oOptions=%s" % (self.oOptions,));
     2476        print("oOptions=%s" % (self.oOptions,), file = sys.stderr);
    24762477
    24772478        #
  • trunk/src/VBox/VMM/include/IEMN8veRecompiler.h

    r101640 r101661  
    28722872    {
    28732873        /* test Eb, imm8 */
    2874         if (iGprSrc >= 8)
    2875             pbCodeBuf[off++] = X86_OP_REX_B;
     2874        if (iGprSrc >= 4)
     2875            pbCodeBuf[off++] = iGprSrc >= 8 ? X86_OP_REX_B : X86_OP_REX;
    28762876        pbCodeBuf[off++] = 0xf6;
    28772877        pbCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, 0, iGprSrc & 7);
     
    29622962        uint8_t * const pbCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 7);
    29632963        AssertReturn(pbCodeBuf, UINT32_MAX);
    2964         if (iGprSrc >= 8)
    2965             pbCodeBuf[off++] = X86_OP_REX_B;
    29662964        if (fBits <= UINT8_MAX)
    29672965        {
     2966            if (iGprSrc >= 4)
     2967                pbCodeBuf[off++] = iGprSrc >= 8 ? X86_OP_REX_B : X86_OP_REX;
    29682968            pbCodeBuf[off++] = 0xf6;
    29692969            pbCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, 0, iGprSrc & 7);
     
    29722972        else
    29732973        {
     2974            if (iGprSrc >= 8)
     2975                pbCodeBuf[off++] = X86_OP_REX_B;
    29742976            pbCodeBuf[off++] = 0xf7;
    29752977            pbCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, 0, iGprSrc & 7);
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