VirtualBox

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


Ignore:
Timestamp:
Dec 12, 2023 9:23:50 AM (14 months ago)
Author:
vboxsync
Message:

VMM/IEM: IEM_MC_FETCH_SREG_U16 and friend. bugref:10371

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

Legend:

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

    r102579 r102583  
    29442944    'IEM_MC_FETCH_SREG_BASE_U32':                                (McBlock.parseMcGeneric,           False, False, ),
    29452945    'IEM_MC_FETCH_SREG_BASE_U64':                                (McBlock.parseMcGeneric,           False, False, ),
    2946     'IEM_MC_FETCH_SREG_U16':                                     (McBlock.parseMcGeneric,           False, False, ),
    2947     'IEM_MC_FETCH_SREG_ZX_U32':                                  (McBlock.parseMcGeneric,           False, False, ),
    2948     'IEM_MC_FETCH_SREG_ZX_U64':                                  (McBlock.parseMcGeneric,           False, False, ),
     2946    'IEM_MC_FETCH_SREG_U16':                                     (McBlock.parseMcGeneric,           False, True, ),
     2947    'IEM_MC_FETCH_SREG_ZX_U32':                                  (McBlock.parseMcGeneric,           False, True, ),
     2948    'IEM_MC_FETCH_SREG_ZX_U64':                                  (McBlock.parseMcGeneric,           False, True, ),
    29492949    'IEM_MC_FETCH_XREG_U128':                                    (McBlock.parseMcGeneric,           False, False, ),
    29502950    'IEM_MC_FETCH_XREG_U16':                                     (McBlock.parseMcGeneric,           False, False, ),
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp

    r102581 r102583  
    76147614iemNativeEmitFetchGregU8(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t idxDstVar, uint8_t iGRegEx, int8_t cbZeroExtended)
    76157615{
    7616     Assert(idxDstVar < RT_ELEMENTS(pReNative->Core.aVars) && (pReNative->Core.bmVars & RT_BIT_32(idxDstVar)));
     7616    IEMNATIVE_ASSERT_VAR_IDX(pReNative, idxDstVar);
    76177617    Assert(pReNative->Core.aVars[idxDstVar].cbVar == cbZeroExtended); RT_NOREF(cbZeroExtended);
    76187618    Assert(iGRegEx < 20);
     
    76507650iemNativeEmitFetchGregU8Sx(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t idxDstVar, uint8_t iGRegEx, uint8_t cbSignExtended)
    76517651{
    7652     Assert(idxDstVar < RT_ELEMENTS(pReNative->Core.aVars) && (pReNative->Core.bmVars & RT_BIT_32(idxDstVar)));
     7652    IEMNATIVE_ASSERT_VAR_IDX(pReNative, idxDstVar);
    76537653    Assert(pReNative->Core.aVars[idxDstVar].cbVar == cbSignExtended);
    76547654    Assert(iGRegEx < 20);
     
    77157715iemNativeEmitFetchGregU16(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t idxDstVar, uint8_t iGReg, uint8_t cbZeroExtended)
    77167716{
    7717     Assert(idxDstVar < RT_ELEMENTS(pReNative->Core.aVars) && (pReNative->Core.bmVars & RT_BIT_32(idxDstVar)));
     7717    IEMNATIVE_ASSERT_VAR_IDX(pReNative, idxDstVar);
    77187718    Assert(pReNative->Core.aVars[idxDstVar].cbVar == cbZeroExtended); RT_NOREF(cbZeroExtended);
    77197719    Assert(iGReg < 16);
     
    77497749iemNativeEmitFetchGregU16Sx(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t idxDstVar, uint8_t iGReg, uint8_t cbSignExtended)
    77507750{
    7751     Assert(idxDstVar < RT_ELEMENTS(pReNative->Core.aVars) && (pReNative->Core.bmVars & RT_BIT_32(idxDstVar)));
     7751    IEMNATIVE_ASSERT_VAR_IDX(pReNative, idxDstVar);
    77527752    Assert(pReNative->Core.aVars[idxDstVar].cbVar == cbSignExtended);
    77537753    Assert(iGReg < 16);
     
    77897789iemNativeEmitFetchGregU32(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t idxDstVar, uint8_t iGReg, uint8_t cbZeroExtended)
    77907790{
    7791     Assert(idxDstVar < RT_ELEMENTS(pReNative->Core.aVars) && (pReNative->Core.bmVars & RT_BIT_32(idxDstVar)));
     7791    IEMNATIVE_ASSERT_VAR_IDX(pReNative, idxDstVar);
    77927792    Assert(pReNative->Core.aVars[idxDstVar].cbVar == cbZeroExtended); RT_NOREF_PV(cbZeroExtended);
    77937793    Assert(iGReg < 16);
     
    78207820iemNativeEmitFetchGregU32SxU64(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t idxDstVar, uint8_t iGReg)
    78217821{
    7822     Assert(idxDstVar < RT_ELEMENTS(pReNative->Core.aVars) && (pReNative->Core.bmVars & RT_BIT_32(idxDstVar)));
     7822    IEMNATIVE_ASSERT_VAR_IDX(pReNative, idxDstVar);
    78237823    Assert(pReNative->Core.aVars[idxDstVar].cbVar == sizeof(uint64_t));
    78247824    Assert(iGReg < 16);
     
    78557855iemNativeEmitFetchGregU64(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t idxDstVar, uint8_t iGReg)
    78567856{
    7857     Assert(idxDstVar < RT_ELEMENTS(pReNative->Core.aVars) && (pReNative->Core.bmVars & RT_BIT_32(idxDstVar)));
     7857    IEMNATIVE_ASSERT_VAR_IDX(pReNative, idxDstVar);
    78587858    Assert(pReNative->Core.aVars[idxDstVar].cbVar == sizeof(uint64_t));
    78597859    Assert(iGReg < 16);
     
    84358435    off = iemNativeEmitStoreGprToVCpuU32(pReNative, off, idxReg, RT_UOFFSETOF_DYN(VMCPUCC, cpum.GstCtx.eflags));
    84368436    iemNativeVarRegisterRelease(pReNative, idxVarEFlags);
     8437    return off;
     8438}
     8439
     8440
     8441
     8442/*********************************************************************************************************************************
     8443*   Emitters for segment register fetches (IEM_MC_FETCH_SREG_XXX).
     8444*********************************************************************************************************************************/
     8445
     8446#define IEM_MC_FETCH_SREG_U16(a_u16Dst, a_iSReg) \
     8447    off = iemNativeEmitFetchSReg(pReNative, off, a_u16Dst, a_iSReg, sizeof(uint16_t))
     8448
     8449#define IEM_MC_FETCH_SREG_ZX_U32(a_u32Dst, a_iSReg) \
     8450    off = iemNativeEmitFetchSReg(pReNative, off, a_u32Dst, a_iSReg, sizeof(uint32_t))
     8451
     8452#define IEM_MC_FETCH_SREG_ZX_U64(a_u64Dst, a_iSReg) \
     8453    off = iemNativeEmitFetchSReg(pReNative, off, a_u64Dst, a_iSReg, sizeof(uint64_t))
     8454
     8455
     8456/** Emits code for IEM_MC_FETCH_SREG_U16, IEM_MC_FETCH_SREG_ZX_U32 and
     8457 *  IEM_MC_FETCH_SREG_ZX_U64. */
     8458DECL_INLINE_THROW(uint32_t)
     8459iemNativeEmitFetchSReg(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t idxDstVar, uint8_t iSReg, int8_t cbVar)
     8460{
     8461    IEMNATIVE_ASSERT_VAR_IDX(pReNative, idxDstVar);
     8462    Assert(pReNative->Core.aVars[idxDstVar].cbVar == cbVar); RT_NOREF(cbVar);
     8463    Assert(iSReg < X86_SREG_COUNT);
     8464
     8465    /*
     8466     * For now, we will not create a shadow copy of a selector.  The rational
     8467     * is that since we do not recompile the popping and loading of segment
     8468     * registers and that the the IEM_MC_FETCH_SREG_U* MCs are only used for
     8469     * pushing and moving to registers, there is only a small chance that the
     8470     * shadow copy will be accessed again before the register is reloaded.  One
     8471     * scenario would be nested called in 16-bit code, but I doubt it's worth
     8472     * the extra register pressure atm.
     8473     *
     8474     * What we really need first, though, is to combine iemNativeRegAllocTmpForGuestReg
     8475     * and iemNativeVarRegisterAcquire for a load scenario. We only got the
     8476     * store scencario covered at present (r160730).
     8477     */
     8478    iemNativeVarSetKindToStack(pReNative, idxDstVar);
     8479    uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxDstVar, &off);
     8480    off = iemNativeEmitLoadGprFromVCpuU16(pReNative, off, idxVarReg, RT_UOFFSETOF_DYN(VMCPU, cpum.GstCtx.aSRegs[iSReg].Sel));
     8481    iemNativeVarRegisterRelease(pReNative, idxDstVar);
    84378482    return off;
    84388483}
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