VirtualBox

Changeset 101849 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 6, 2023 9:48:15 AM (13 months ago)
Author:
vboxsync
Message:

VMM/IEM: Enabled native translation of IEM_MC_CALL_CIMPL_2. Fixed some related bugs. bugref:10371

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8vePython.py

    r101844 r101849  
    7070
    7171    'IEM_MC_CALL_CIMPL_1_THREADED':                              (None, True,  True,  ),
    72     'IEM_MC_CALL_CIMPL_2_THREADED':                              (None, True,  False, ),
     72    'IEM_MC_CALL_CIMPL_2_THREADED':                              (None, True,  True, ),
    7373    'IEM_MC_CALL_CIMPL_3_THREADED':                              (None, True,  False, ),
    7474    'IEM_MC_CALL_CIMPL_4_THREADED':                              (None, True,  False, ),
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp

    r101844 r101849  
    23852385            while (fGstRegShadows)
    23862386            {
    2387                 unsigned const idxGstReg = ASMBitFirstSetU64(fGstRegShadows);
     2387                unsigned const idxGstReg = ASMBitFirstSetU64(fGstRegShadows) - 1;
    23882388                fGstRegShadows &= ~RT_BIT_64(idxGstReg);
    23892389
     
    48674867    uint8_t const a_Name = iemNativeArgAlloc(pReNative, (a_iArg), sizeof(a_Type))
    48684868
    4869 #define IEM_MC_ARG_CONST(a_Type, a_Name, a_iArg) \
     4869#define IEM_MC_ARG_CONST(a_Type, a_Name, a_Value, a_iArg) \
    48704870    uint8_t const a_Name = iemNativeArgAllocConst(pReNative, (a_iArg), sizeof(a_Type), (a_Value))
    48714871
     
    49034903{
    49044904    Assert(cbType > 0 && cbType <= 64);
    4905     unsigned const idxVar = ASMBitFirstSetU32(~pReNative->Core.bmVars);
     4905    unsigned const idxVar = ASMBitFirstSetU32(~pReNative->Core.bmVars) - 1;
    49064906    AssertStmt(idxVar < RT_ELEMENTS(pReNative->Core.aVars), IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_VAR_EXHAUSTED));
    49074907    pReNative->Core.bmVars |= RT_BIT_32(idxVar);
     
    49604960            if (pReNative->Core.aVars[idxVar].cbVar <= sizeof(uint64_t))
    49614961            {
    4962                 unsigned const iSlot = ASMBitFirstSetU32(~pReNative->Core.bmStack);
     4962                unsigned const iSlot = ASMBitFirstSetU32(~pReNative->Core.bmStack) - 1;
    49634963                AssertStmt(iSlot < IEMNATIVE_FRAME_VAR_SLOTS, IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_VAR_OUT_OF_STACK_SLOTS));
    49644964                pReNative->Core.bmStack |= RT_BIT_32(iSlot);
     
    53335333            {
    53345334                uint8_t const idxVar = pReNative->Core.aidxArgVars[i];
    5335                 if (pReNative->Core.aVars[idxVar].uArgNo < RT_ELEMENTS(pReNative->Core.aHstRegs))
     5335                if (pReNative->Core.aVars[idxVar].idxReg < RT_ELEMENTS(pReNative->Core.aHstRegs))
    53365336                {
    53375337                    Assert(pReNative->Core.aVars[idxVar].enmKind == kIemNativeVarKind_Stack);
    53385338                    off = iemNativeEmitLoadGprFromGpr(pReNative, off, idxArgReg, pReNative->Core.aVars[idxVar].idxReg);
     5339                    pReNative->Core.bmHstRegs = (pReNative->Core.bmHstRegs & ~RT_BIT_32(pReNative->Core.aVars[idxVar].idxReg))
     5340                                              | RT_BIT_32(idxArgReg);
     5341                    pReNative->Core.aVars[idxVar].idxReg = idxArgReg;
    53395342                }
    53405343                else
     
    54025405            uint8_t const idxVar    = pReNative->Core.aidxArgVars[i];
    54035406            int32_t const offBpDisp = g_aoffIemNativeCallStackArgBpDisp[i - IEMNATIVE_CALL_ARG_GREG_COUNT];
    5404             if (pReNative->Core.aVars[idxVar].uArgNo < RT_ELEMENTS(pReNative->Core.aHstRegs))
     5407            if (pReNative->Core.aVars[idxVar].idxReg < RT_ELEMENTS(pReNative->Core.aHstRegs))
    54055408            {
    54065409                Assert(pReNative->Core.aVars[idxVar].enmKind == kIemNativeVarKind_Stack); /* Imm as well? */
    5407                 off = iemNativeEmitStoreGprByBp(pReNative, off, offBpDisp, pReNative->Core.aVars[idxVar].uArgNo);
     5410                off = iemNativeEmitStoreGprByBp(pReNative, off, offBpDisp, pReNative->Core.aVars[idxVar].idxReg);
     5411                pReNative->Core.bmHstRegs &= ~RT_BIT_32(pReNative->Core.aVars[idxVar].idxReg);
     5412                pReNative->Core.aVars[idxVar].idxReg = UINT8_MAX;
    54085413            }
    54095414            else
     
    54715476        pReNative->Core.aidxArgVars[i] = UINT8_MAX;
    54725477        pReNative->Core.bmVars        &= ~RT_BIT_32(idxVar);
    5473         Assert(   pReNative->Core.aVars[idxVar].idxReg
    5474                == (i < RT_ELEMENTS(g_aidxIemNativeCallRegs) ? g_aidxIemNativeCallRegs[i] : UINT8_MAX));
    54755478    }
    54765479    Assert(pReNative->Core.u64ArgVars == UINT64_MAX);
     
    54915494
    54925495{
    5493 //pReNative->pInstrBuf[off++] = 0xcc;
    54945496    /*
    54955497     * Do all the call setup and cleanup.
     
    55645566                        uintptr_t pfnCImpl, uint8_t idxArg0, uint8_t idxArg1, uint8_t idxArg2)
    55655567{
     5568pReNative->pInstrBuf[off++] = 0xcc;
    55665569    Assert(idxArg0 < RT_ELEMENTS(pReNative->Core.aVars) && (pReNative->Core.bmVars & RT_BIT_32(idxArg0)));
    55675570    Assert(pReNative->Core.aVars[idxArg0].uArgNo == 0 + IEM_CIMPL_HIDDEN_ARGS);
     
    55885591                        uintptr_t pfnCImpl, uint8_t idxArg0, uint8_t idxArg1, uint8_t idxArg2, uint8_t idxArg3)
    55895592{
     5593pReNative->pInstrBuf[off++] = 0xcc;
    55905594    Assert(idxArg0 < RT_ELEMENTS(pReNative->Core.aVars) && (pReNative->Core.bmVars & RT_BIT_32(idxArg0)));
    55915595    Assert(pReNative->Core.aVars[idxArg0].uArgNo == 0 + IEM_CIMPL_HIDDEN_ARGS);
     
    56165620                        uintptr_t pfnCImpl, uint8_t idxArg0, uint8_t idxArg1, uint8_t idxArg2, uint8_t idxArg3, uint8_t idxArg4)
    56175621{
     5622pReNative->pInstrBuf[off++] = 0xcc;
    56185623    Assert(idxArg0 < RT_ELEMENTS(pReNative->Core.aVars) && (pReNative->Core.bmVars & RT_BIT_32(idxArg0)));
    56195624    Assert(pReNative->Core.aVars[idxArg0].uArgNo == 0 + IEM_CIMPL_HIDDEN_ARGS);
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