VirtualBox

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


Ignore:
Timestamp:
Mar 4, 2024 3:48:34 PM (12 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
162031
Message:

VMM/IEM: Native translation of IEM_MC_RAISE_SSE_AVX_SIMD_FP_OR_UD_XCPT() body, bugref:10371

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

Legend:

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

    r103665 r103671  
    45284528    return iemRaiseXcptOrInt(pVCpu, 0, X86_XCPT_XF, IEM_XCPT_FLAGS_T_CPU_XCPT, 0, 0);
    45294529}
     4530
     4531
     4532#ifdef IEM_WITH_SETJMP
     4533/** \#XF(0)/\#XM(0) - 19s, longjmp.  */
     4534DECL_NO_RETURN(void) iemRaiseSimdFpExceptionJmp(PVMCPUCC pVCpu) IEM_NOEXCEPT_MAY_LONGJMP
     4535{
     4536    IEM_DO_LONGJMP(pVCpu, VBOXSTRICTRC_VAL(iemRaiseSimdFpException(pVCpu)));
     4537}
     4538#endif
    45304539
    45314540
  • trunk/src/VBox/VMM/VMMAll/IEMAllInstPython.py

    r103667 r103671  
    32083208    'IEM_MC_RAISE_GP0_IF_CPL_NOT_ZERO':                          (McBlock.parseMcGeneric,           True,  True,  False, ),
    32093209    'IEM_MC_RAISE_GP0_IF_EFF_ADDR_UNALIGNED':                    (McBlock.parseMcGeneric,           True,  True,  False, ),
    3210     'IEM_MC_RAISE_SSE_AVX_SIMD_FP_OR_UD_XCPT':                   (McBlock.parseMcGeneric,           True,  True,  False, ),
     3210    'IEM_MC_RAISE_SSE_AVX_SIMD_FP_OR_UD_XCPT':                   (McBlock.parseMcGeneric,           True,  True,  True, ),
    32113211    'IEM_MC_REF_EFLAGS':                                         (McBlock.parseMcGeneric,           False, False, True,  ),
    32123212    'IEM_MC_REF_FPUREG':                                         (McBlock.parseMcGeneric,           False, False, False, ),
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp

    r103670 r103671  
    16341634
    16351635/**
     1636 * Used by TB code when it wants to raise a \#XF.
     1637 */
     1638IEM_DECL_NATIVE_HLP_DEF(int, iemNativeHlpExecRaiseXf,(PVMCPUCC pVCpu))
     1639{
     1640    iemRaiseSimdFpExceptionJmp(pVCpu);
     1641#ifndef _MSC_VER
     1642    return VINF_IEM_RAISED_XCPT; /* not reached */
     1643#endif
     1644}
     1645
     1646
     1647/**
    16361648 * Used by TB code when detecting opcode changes.
    16371649 * @see iemThreadeFuncWorkerObsoleteTb
     
    29462958    pReNative->Core.u64ArgVars             = UINT64_MAX;
    29472959
    2948     AssertCompile(RT_ELEMENTS(pReNative->aidxUniqueLabels) == 12);
     2960    AssertCompile(RT_ELEMENTS(pReNative->aidxUniqueLabels) == 13);
    29492961    pReNative->aidxUniqueLabels[0]         = UINT32_MAX;
    29502962    pReNative->aidxUniqueLabels[1]         = UINT32_MAX;
     
    29592971    pReNative->aidxUniqueLabels[10]        = UINT32_MAX;
    29602972    pReNative->aidxUniqueLabels[11]        = UINT32_MAX;
     2973    pReNative->aidxUniqueLabels[12]        = UINT32_MAX;
    29612974
    29622975    /* Full host register reinit: */
     
    59825995
    59835996/**
     5997 * Emits the code at the RaiseXf label.
     5998 */
     5999static uint32_t iemNativeEmitRaiseXf(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint32_t idxReturnLabel)
     6000{
     6001    uint32_t const idxLabel = iemNativeLabelFind(pReNative, kIemNativeLabelType_RaiseXf);
     6002    if (idxLabel != UINT32_MAX)
     6003    {
     6004        iemNativeLabelDefine(pReNative, idxLabel, off);
     6005
     6006        /* iemNativeHlpExecRaiseXf(PVMCPUCC pVCpu) */
     6007        off = iemNativeEmitLoadGprFromGpr(pReNative, off, IEMNATIVE_CALL_ARG0_GREG, IEMNATIVE_REG_FIXED_PVMCPU);
     6008        off = iemNativeEmitCallImm(pReNative, off, (uintptr_t)iemNativeHlpExecRaiseXf);
     6009
     6010        /* jump back to the return sequence. */
     6011        off = iemNativeEmitJmpToLabel(pReNative, off, idxReturnLabel);
     6012    }
     6013    return off;
     6014}
     6015
     6016
     6017/**
    59846018 * Emits the code at the ReturnWithFlags label (returns
    59856019 * VINF_IEM_REEXEC_FINISH_WITH_FLAGS).
     
    71597193    iemNativeRegFreeTmp(pReNative, idxCr4Reg);
    71607194    iemNativeRegFreeTmp(pReNative, idxXcr0Reg);
     7195
     7196    return off;
     7197}
     7198
     7199
     7200#define IEM_MC_RAISE_SSE_AVX_SIMD_FP_OR_UD_XCPT() \
     7201    off = iemNativeEmitRaiseSseAvxSimdFpXcpt(pReNative, off, pCallEntry->idxInstr)
     7202
     7203/**
     7204 * Emits code to raise a SIMD floating point (either \#UD or \#XF) should be raised.
     7205 *
     7206 * @returns New code buffer offset, UINT32_MAX on failure.
     7207 * @param   pReNative       The native recompile state.
     7208 * @param   off             The code buffer offset.
     7209 * @param   idxInstr        The current instruction.
     7210 */
     7211DECL_INLINE_THROW(uint32_t)
     7212iemNativeEmitRaiseSseAvxSimdFpXcpt(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t idxInstr)
     7213{
     7214    /*
     7215     * Make sure we don't have any outstanding guest register writes as we may
     7216     * raise an \#UD or \#NM and all guest register must be up to date in CPUMCTX.
     7217     *
     7218     * @todo r=aeichner Can we postpone this to the RaiseNm/RaiseUd path?
     7219     */
     7220    off = iemNativeRegFlushPendingWrites(pReNative, off);
     7221
     7222#ifdef IEMNATIVE_WITH_INSTRUCTION_COUNTING
     7223    off = iemNativeEmitStoreImmToVCpuU8(pReNative, off, idxInstr, RT_UOFFSETOF(VMCPUCC, iem.s.idxTbCurInstr));
     7224#else
     7225    RT_NOREF(idxInstr);
     7226#endif
     7227
     7228    /* Allocate a temporary CR4 register. */
     7229    uint8_t const idxCr4Reg       = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_Cr4, kIemNativeGstRegUse_ReadOnly);
     7230    uint8_t const idxLabelRaiseXf = iemNativeLabelCreate(pReNative, kIemNativeLabelType_RaiseXf);
     7231    uint8_t const idxLabelRaiseUd = iemNativeLabelCreate(pReNative, kIemNativeLabelType_RaiseUd);
     7232
     7233    /*
     7234     * if (!(cr4 & X86_CR4_OSXMMEEXCPT))
     7235     *     return raisexcpt();
     7236     */
     7237    off = iemNativeEmitTestBitInGprAndJmpToLabelIfNotSet(pReNative, off, idxCr4Reg, X86_CR4_OSXMMEEXCPT_BIT, idxLabelRaiseXf);
     7238
     7239    /* raise \#UD exception unconditionally. */
     7240    off = iemNativeEmitJmpToLabel(pReNative, off, idxLabelRaiseUd);
     7241
     7242    /* Free but don't flush the CR4 register. */
     7243    iemNativeRegFreeTmp(pReNative, idxCr4Reg);
    71617244
    71627245    return off;
     
    1445114534                                    pszName = "RaiseMf";
    1445214535                                    break;
     14536                                case kIemNativeLabelType_RaiseXf:
     14537                                    pszName = "RaiseXf";
     14538                                    break;
    1445314539                                case kIemNativeLabelType_ObsoleteTb:
    1445414540                                    pszName = "ObsoleteTb";
     
    1505315139        if (pReNative->bmLabelTypes & RT_BIT_64(kIemNativeLabelType_RaiseMf))
    1505415140            off = iemNativeEmitRaiseMf(pReNative, off, idxReturnLabel);
     15141        if (pReNative->bmLabelTypes & RT_BIT_64(kIemNativeLabelType_RaiseXf))
     15142            off = iemNativeEmitRaiseXf(pReNative, off, idxReturnLabel);
    1505515143        if (pReNative->bmLabelTypes & RT_BIT_64(kIemNativeLabelType_ObsoleteTb))
    1505615144            off = iemNativeEmitObsoleteTb(pReNative, off, idxReturnLabel);
  • trunk/src/VBox/VMM/include/IEMInternal.h

    r103665 r103671  
    52275227#endif
    52285228VBOXSTRICTRC            iemRaiseSimdFpException(PVMCPUCC pVCpu) RT_NOEXCEPT;
     5229#ifdef IEM_WITH_SETJMP
     5230DECL_NO_RETURN(void)    iemRaiseSimdFpExceptionJmp(PVMCPUCC pVCpu) IEM_NOEXCEPT_MAY_LONGJMP;
     5231#endif
    52295232
    52305233void                    iemLogSyscallRealModeInt(PVMCPUCC pVCpu, uint8_t u8Vector, uint8_t cbInstr);
  • trunk/src/VBox/VMM/include/IEMN8veRecompiler.h

    r103667 r103671  
    331331    kIemNativeLabelType_RaiseUd,
    332332    kIemNativeLabelType_RaiseMf,
     333    kIemNativeLabelType_RaiseXf,
    333334    kIemNativeLabelType_ObsoleteTb,
    334335    kIemNativeLabelType_NeedCsLimChecking,
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