VirtualBox

Changeset 105125 in vbox for trunk/src/VBox/VMM/include


Ignore:
Timestamp:
Jul 3, 2024 8:07:48 PM (5 months ago)
Author:
vboxsync
Message:

VMM/IEM,ValKit/bs3-cpu-weird-1: Fixed popf mistreatment of the new TF bit generally and the calculation of the VIF flags in VME+v86 mode; extended bs3-cpu-weird-1 with popf testcase. bugref:10715

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/include/IEMInline.h

    r105072 r105125  
    20982098 *              Stacks}
    20992099 */
     2100template<uint32_t const a_fTF = X86_EFL_TF>
    21002101static VBOXSTRICTRC iemFinishInstructionWithFlagsSet(PVMCPUCC pVCpu, int rcNormal) RT_NOEXCEPT
    21012102{
     
    21032104     * Normally we're just here to clear RF and/or interrupt shadow bits.
    21042105     */
    2105     if (RT_LIKELY((pVCpu->cpum.GstCtx.eflags.uBoth & (X86_EFL_TF | CPUMCTX_DBG_HIT_DRX_MASK | CPUMCTX_DBG_DBGF_MASK)) == 0))
     2106    if (RT_LIKELY((pVCpu->cpum.GstCtx.eflags.uBoth & (a_fTF | CPUMCTX_DBG_HIT_DRX_MASK | CPUMCTX_DBG_DBGF_MASK)) == 0))
    21062107        pVCpu->cpum.GstCtx.eflags.uBoth &= ~(X86_EFL_RF | CPUMCTX_INHIBIT_SHADOW);
    21072108    else
     
    21112112         */
    21122113        VBOXSTRICTRC rcStrict;
    2113         if (pVCpu->cpum.GstCtx.eflags.uBoth & (X86_EFL_TF | CPUMCTX_DBG_HIT_DRX_MASK))
     2114        if (pVCpu->cpum.GstCtx.eflags.uBoth & (a_fTF | CPUMCTX_DBG_HIT_DRX_MASK))
    21142115        {
    21152116            IEM_CTX_IMPORT_RET(pVCpu, CPUMCTX_EXTRN_DR6);
    21162117            pVCpu->cpum.GstCtx.dr[6] &= ~X86_DR6_B_MASK;
    2117             if (pVCpu->cpum.GstCtx.eflags.uBoth & X86_EFL_TF)
     2118            if (pVCpu->cpum.GstCtx.eflags.uBoth & a_fTF)
    21182119                pVCpu->cpum.GstCtx.dr[6] |= X86_DR6_BS;
    21192120            pVCpu->cpum.GstCtx.dr[6] |= (pVCpu->cpum.GstCtx.eflags.uBoth & CPUMCTX_DBG_HIT_DRX_MASK_NONSILENT)
     
    28622863    iemRegAddToRip(pVCpu, cbInstr);
    28632864    if (!(fEflOld & X86_EFL_TF))
    2864         return iemRegFinishClearingRF(pVCpu, VINF_SUCCESS);
     2865    {
     2866        /* Specialized iemRegFinishClearingRF edition here that doesn't check X86_EFL_TF. */
     2867        AssertCompile(CPUMCTX_INHIBIT_SHADOW < UINT32_MAX);
     2868        if (RT_LIKELY(!(  pVCpu->cpum.GstCtx.eflags.uBoth
     2869                        & (X86_EFL_RF | CPUMCTX_INHIBIT_SHADOW | CPUMCTX_DBG_HIT_DRX_MASK | CPUMCTX_DBG_DBGF_MASK)) ))
     2870            return VINF_SUCCESS;
     2871        return iemFinishInstructionWithFlagsSet<0 /*a_fTF*/>(pVCpu, VINF_SUCCESS); /* TF=0, so ignore it.  */
     2872    }
    28652873    return iemFinishInstructionWithTfSet(pVCpu);
    28662874}
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