VirtualBox

Changeset 104270 in vbox for trunk/src


Ignore:
Timestamp:
Apr 10, 2024 10:25:04 AM (10 months ago)
Author:
vboxsync
Message:

VMM/IEM: Implement native emitter for IEM_MC_MAYBE_RAISE_WAIT_DEVICE_NOT_AVAILABLE() (enables wait instruction recompilation), bugref:10371

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

Legend:

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

    r104195 r104270  
    31943194    'IEM_MC_MAYBE_RAISE_SSE_AVX_SIMD_FP_OR_UD_XCPT':             (McBlock.parseMcGeneric,           True,  True,  g_fNativeSimd),
    31953195    'IEM_MC_MAYBE_RAISE_SSE_RELATED_XCPT':                       (McBlock.parseMcGeneric,           True,  True,  True,  ),
    3196     'IEM_MC_MAYBE_RAISE_WAIT_DEVICE_NOT_AVAILABLE':              (McBlock.parseMcGeneric,           True,  True,  False, ),
     3196    'IEM_MC_MAYBE_RAISE_WAIT_DEVICE_NOT_AVAILABLE':              (McBlock.parseMcGeneric,           True,  True,  True, ),
    31973197    'IEM_MC_MEM_COMMIT_AND_UNMAP_ATOMIC':                        (McBlock.parseMcGeneric,           True,  True,  True,  ),
    31983198    'IEM_MC_MEM_COMMIT_AND_UNMAP_RW':                            (McBlock.parseMcGeneric,           True,  True,  True,  ),
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8veLiveness.cpp

    r104195 r104270  
    453453#define IEM_MC_RAISE_DIVIDE_ERROR()                                 IEM_LIVENESS_MARK_XCPT_OR_CALL()
    454454#define IEM_MC_MAYBE_RAISE_DEVICE_NOT_AVAILABLE()                   IEM_LIVENESS_MARK_XCPT_OR_CALL(); IEM_LIVENESS_CR0_INPUT()
    455 #define IEM_MC_MAYBE_RAISE_WAIT_DEVICE_NOT_AVAILABLE() \            IEM_LIVENESS_MARK_XCPT_OR_CALL(); IEM_LIVENESS_CR0_INPUT()
     455#define IEM_MC_MAYBE_RAISE_WAIT_DEVICE_NOT_AVAILABLE()              IEM_LIVENESS_MARK_XCPT_OR_CALL(); IEM_LIVENESS_CR0_INPUT()
    456456#define IEM_MC_MAYBE_RAISE_FPU_XCPT()                               IEM_LIVENESS_MARK_XCPT_OR_CALL(); IEM_LIVENESS_FSW_INPUT()
    457457#define IEM_MC_MAYBE_RAISE_AVX_RELATED_XCPT() \
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompFuncs.h

    r104195 r104270  
    894894    else
    895895        STAM_COUNTER_INC(&pReNative->pVCpu->iem.s.StatNativeMaybeDeviceNotAvailXcptCheckOmitted);
     896#endif
     897
     898    return off;
     899}
     900
     901
     902#define IEM_MC_MAYBE_RAISE_WAIT_DEVICE_NOT_AVAILABLE() \
     903    off = iemNativeEmitMaybeRaiseWaitDeviceNotAvailable(pReNative, off, pCallEntry->idxInstr)
     904
     905/**
     906 * Emits code to check if a \#NM exception should be raised.
     907 *
     908 * @returns New code buffer offset, UINT32_MAX on failure.
     909 * @param   pReNative       The native recompile state.
     910 * @param   off             The code buffer offset.
     911 * @param   idxInstr        The current instruction.
     912 */
     913DECL_INLINE_THROW(uint32_t)
     914iemNativeEmitMaybeRaiseWaitDeviceNotAvailable(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t idxInstr)
     915{
     916#ifdef IEMNATIVE_WITH_SIMD_REG_ALLOCATOR
     917    STAM_COUNTER_INC(&pReNative->pVCpu->iem.s.StatNativeMaybeWaitDeviceNotAvailXcptCheckPotential);
     918
     919    if (!(pReNative->fSimdRaiseXcptChecksEmitted & IEMNATIVE_SIMD_RAISE_XCPT_CHECKS_EMITTED_MAYBE_WAIT_DEVICE_NOT_AVAILABLE))
     920    {
     921#endif
     922        /*
     923         * Make sure we don't have any outstanding guest register writes as we may
     924         * raise an #NM and all guest register must be up to date in CPUMCTX.
     925         */
     926        /** @todo r=aeichner Can we postpone this to the RaiseNm path? */
     927        off = iemNativeRegFlushPendingWrites(pReNative, off);
     928
     929#ifdef IEMNATIVE_WITH_INSTRUCTION_COUNTING
     930        off = iemNativeEmitStoreImmToVCpuU8(pReNative, off, idxInstr, RT_UOFFSETOF(VMCPUCC, iem.s.idxTbCurInstr));
     931#else
     932        RT_NOREF(idxInstr);
     933#endif
     934
     935        /* Allocate a temporary CR0 register. */
     936        uint8_t const idxCr0Reg = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_Cr0, kIemNativeGstRegUse_Calculation);
     937
     938        /*
     939         * if (cr0 & (X86_CR0_MP | X86_CR0_TS) == (X86_CR0_MP | X86_CR0_TS))
     940         *     return raisexcpt();
     941         */
     942        off = iemNativeEmitAndGpr32ByImm(pReNative, off, idxCr0Reg, X86_CR0_MP | X86_CR0_TS);
     943        /* Test and jump. */
     944        off = iemNativeEmitTestIfGpr32EqualsImmAndJmpToNewLabel(pReNative, off, idxCr0Reg, X86_CR0_MP | X86_CR0_TS, kIemNativeLabelType_RaiseNm);
     945
     946        /* Free the CR0 register. */
     947        iemNativeRegFreeTmp(pReNative, idxCr0Reg);
     948
     949#ifdef IEMNATIVE_WITH_SIMD_REG_ALLOCATOR
     950        pReNative->fSimdRaiseXcptChecksEmitted |= IEMNATIVE_SIMD_RAISE_XCPT_CHECKS_EMITTED_MAYBE_WAIT_DEVICE_NOT_AVAILABLE;
     951    }
     952    else
     953        STAM_COUNTER_INC(&pReNative->pVCpu->iem.s.StatNativeMaybeWaitDeviceNotAvailXcptCheckOmitted);
    896954#endif
    897955
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