VirtualBox

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


Ignore:
Timestamp:
Jan 28, 2017 10:36:58 PM (8 years ago)
Author:
vboxsync
Message:

IEM: some cmpxchg16b notes.

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

Legend:

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

    r65207 r65501  
    63626362
    63636363
     6364/**
     6365 * Implements 'CMPXCHG16B' fallback using rendezvous.
     6366 */
     6367IEM_CIMPL_DEF_4(iemCImpl_cmpxchg16b_fallback_rendezvous, PRTUINT128U, pu128Dst, PRTUINT128U, pu64RaxRdx,
     6368                PRTUINT128U, pu64RbxRcx, uint32_t *, pEFlags)
     6369{
     6370    RT_NOREF(pVCpu, cbInstr, pu128Dst, pu64RaxRdx, pu64RbxRcx, pEFlags);
     6371#ifdef IN_RING3
     6372    /** @todo VMMR3EmtRendezvous() */
     6373    return VERR_NOT_IMPLEMENTED;
     6374#else
     6375    return VINF_EM_RAW_EMULATE_INSTR;
     6376#endif
     6377}
     6378
    63646379
    63656380/**
  • trunk/src/VBox/VMM/VMMAll/IEMAllInstructions.cpp.h

    r65493 r65501  
    68336833    if (IEM_GET_GUEST_CPU_FEATURES(pVCpu)->fMovCmpXchg16b)
    68346834    {
     6835#if 1
    68356836        RT_NOREF(bRm);
    68366837        IEMOP_BITCH_ABOUT_STUB();
    68376838        return VERR_IEM_INSTR_NOT_IMPLEMENTED;
     6839#else
     6840        IEM_MC_BEGIN(4, 3);
     6841        IEM_MC_ARG(PRTUINT128U, pu128MemDst,     0);
     6842        IEM_MC_ARG(PRTUINT128U, pu128RaxRdx,     1);
     6843        IEM_MC_ARG(PRTUINT128U, pu128RbxRcx,     2);
     6844        IEM_MC_ARG_LOCAL_EFLAGS(pEFlags, EFlags, 3);
     6845        IEM_MC_LOCAL(RTUINT128U, u128RaxRdx);
     6846        IEM_MC_LOCAL(RTUINT128U, u128RbxRcx);
     6847        IEM_MC_LOCAL(RTGCPTR, GCPtrEffDst);
     6848
     6849        IEM_MC_CALC_RM_EFF_ADDR(GCPtrEffDst, bRm, 0);
     6850        IEMOP_HLP_DONE_DECODING();
     6851        IEM_MC_MEM_MAP(pu128MemDst, IEM_ACCESS_DATA_RW, pVCpu->iem.s.iEffSeg, GCPtrEffDst, 0 /*arg*/);
     6852
     6853        IEM_MC_FETCH_GREG_U64(u128RaxRdx.s.Lo, X86_GREG_xAX);
     6854        IEM_MC_FETCH_GREG_U64(u128RaxRdx.s.Hi, X86_GREG_xDX);
     6855        IEM_MC_REF_LOCAL(pu128RaxRdx, u128RaxRdx);
     6856
     6857        IEM_MC_FETCH_GREG_U64(u128RbxRcx.s.Lo, X86_GREG_xBX);
     6858        IEM_MC_FETCH_GREG_U64(u128RbxRcx.s.Hi, X86_GREG_xCX);
     6859        IEM_MC_REF_LOCAL(pu128RbxRcx, u128RbxRcx);
     6860
     6861        IEM_MC_FETCH_EFLAGS(EFlags);
     6862# ifdef RT_ARCH_AMD64
     6863        if (IEM_GET_HOST_CPU_FEATURES(pVCpu)->fMovCmpXchg16b)
     6864        {
     6865            if (!(pVCpu->iem.s.fPrefixes & IEM_OP_PRF_LOCK))
     6866                IEM_MC_CALL_VOID_AIMPL_4(iemAImpl_cmpxchg16b, pu128MemDst, pu128RaxRdx, pu128RbxRcx, pEFlags);
     6867            else
     6868                IEM_MC_CALL_VOID_AIMPL_4(iemAImpl_cmpxchg16b_locked, pu128MemDst, pu128RaxRdx, pu128RbxRcx, pEFlags);
     6869        }
     6870        else
     6871# endif
     6872        {
     6873            /* Note! The fallback for 32-bit systems and systems without CX16 is to use
     6874                     SSE instructions for 16-byte loads and stores.  Since these aren't
     6875                     atomic and there are cycles between the loading and storing, this
     6876                     only works correctly in UNI CPU guests.  If guest SMP is active
     6877                     we have no choice but to use a rendezvous callback here.  Sigh. */
     6878            IEM_MC_ACTUALIZE_SSE_STATE_FOR_READ(); /* HACK ALERT! */
     6879            if (pVCpu->CTX_SUFF(pVM)->cCpus == 1)
     6880                IEM_MC_CALL_VOID_AIMPL_4(iemAImpl_cmpxchg16b_fallback_sse, pu128MemDst, pu128RaxRdx, pu128RbxRcx, pEFlags);
     6881            else
     6882                IEM_MC_CALL_CIMPL_4(iemCImpl_cmpxchg16b_fallback_rendezvous, pu128MemDst, pu128RaxRdx, pu128RbxRcx, pEFlags);
     6883        }
     6884
     6885        IEM_MC_MEM_COMMIT_AND_UNMAP(pu128MemDst, IEM_ACCESS_DATA_RW);
     6886        IEM_MC_COMMIT_EFLAGS(EFlags);
     6887        IEM_MC_IF_EFL_BIT_NOT_SET(X86_EFL_ZF)
     6888            IEM_MC_STORE_GREG_U64(X86_GREG_xAX, u128RaxRdx.s.Lo);
     6889            IEM_MC_STORE_GREG_U64(X86_GREG_xDX, u128RaxRdx.s.Hi);
     6890        IEM_MC_ENDIF();
     6891        IEM_MC_ADVANCE_RIP();
     6892
     6893        IEM_MC_END();
     6894        return VINF_SUCCESS;
     6895#endif
    68386896    }
    68396897    Log(("cmpxchg16b -> #UD\n"));
  • trunk/src/VBox/VMM/include/IEMInternal.h

    r65194 r65501  
    11021102IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg8b_locked,(uint64_t *pu64Dst, PRTUINT64U pu64EaxEdx, PRTUINT64U pu64EbxEcx,
    11031103                                                   uint32_t *pEFlags));
    1104 IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg16b,(PRTUINT128U *pu128Dst, PRTUINT128U pu64RaxRdx, PRTUINT128U pu64RbxRcx,
     1104IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg16b,(PRTUINT128U pu128Dst, PRTUINT128U pu64RaxRdx, PRTUINT128U pu64RbxRcx,
    11051105                                             uint32_t *pEFlags));
    1106 IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg16b_locked,(PRTUINT128U *pu128Dst, PRTUINT128U pu64RaxRdx, PRTUINT128U pu64RbxRcx,
     1106IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg16b_locked,(PRTUINT128U pu128Dst, PRTUINT128U pu64RaxRdx, PRTUINT128U pu64RbxRcx,
    11071107                                                    uint32_t *pEFlags));
     1108IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg16b_fallback_sse,(PRTUINT128U pu128Dst, PRTUINT128U pu64RaxRdx,
     1109                                                          PRTUINT128U pu64RbxRcx, uint32_t *pEFlags));
    11081110/** @} */
    11091111
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