VirtualBox

Changeset 97370 in vbox for trunk


Ignore:
Timestamp:
Nov 2, 2022 12:53:30 AM (2 years ago)
Author:
vboxsync
Message:

VMM/IEM: iemRegAddToRipAndClearRF -> iemRegUpdateRipAndFinishClearingRF and made callers use the return code. bugref:9898

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

Legend:

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

    r97346 r97370  
    41694169    if (pVCpu->cpum.GstCtx.cr0 & X86_CR0_NE)
    41704170        return iemRaiseXcptOrInt(pVCpu, 0, X86_XCPT_MF, IEM_XCPT_FLAGS_T_CPU_XCPT, 0, 0);
    4171     else
    4172     {
    4173         /* Convert a #MF into a FERR -> IRQ 13. See @bugref{6117}. */
    4174         PDMIsaSetIrq(pVCpu->CTX_SUFF(pVM), 13 /* u8Irq */, 1 /* u8Level */, 0 /* uTagSrc */);
    4175         iemRegUpdateRipAndClearRF(pVCpu);
    4176         return VINF_SUCCESS;
    4177     }
     4171
     4172    /* Convert a #MF into a FERR -> IRQ 13. See @bugref{6117}. */
     4173    PDMIsaSetIrq(pVCpu->CTX_SUFF(pVM), 13 /* u8Irq */, 1 /* u8Level */, 0 /* uTagSrc */);
     4174    return iemRegUpdateRipAndFinishClearingRF(pVCpu);
    41784175}
    41794176
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp

    r97297 r97370  
    332332        {
    333333            pVCpu->cpum.GstCtx.rsp = TmpRsp.u;
    334             iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     334            rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    335335        }
    336336    }
     
    353353            {
    354354                iemRegAddToRsp(pVCpu, 16);
    355                 iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     355                rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    356356            }
    357357        }
     
    412412#endif
    413413            pVCpu->cpum.GstCtx.rsp = TmpRsp.u;
    414             iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     414            rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    415415        }
    416416    }
     
    433433            {
    434434                iemRegAddToRsp(pVCpu, 32);
    435                 iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     435                rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    436436            }
    437437        }
     
    482482        {
    483483            pVCpu->cpum.GstCtx.rsp = TmpRsp.u;
    484             iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     484            rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    485485        }
    486486    }
     
    504504            {
    505505                iemRegSubFromRsp(pVCpu, 16);
    506                 iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     506                rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    507507            }
    508508        }
     
    553553        {
    554554            pVCpu->cpum.GstCtx.rsp = TmpRsp.u;
    555             iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     555            rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    556556        }
    557557    }
     
    575575            {
    576576                iemRegSubFromRsp(pVCpu, 32);
    577                 iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     577                rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    578578            }
    579579        }
     
    641641        }
    642642    }
    643     if (rcStrict != VINF_SUCCESS)
    644         return rcStrict;
    645 
    646     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    647     return VINF_SUCCESS;
     643
     644    if (rcStrict == VINF_SUCCESS)
     645        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
     646    return rcStrict;
    648647}
    649648
     
    807806    Assert(fEflNew & RT_BIT_32(1));
    808807    IEMMISC_SET_EFL(pVCpu, fEflNew);
    809     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    810 
    811     return VINF_SUCCESS;
     808    return iemRegAddToRipAndFinishingClearingRfEx(pVCpu, cbInstr, fEflOld);
    812809}
    813810
     
    28172814    pVCpu->cpum.GstCtx.rbp = NewRbp.u;
    28182815    pVCpu->cpum.GstCtx.rsp = NewRsp.u;
    2819     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    2820 
    2821     return VINF_SUCCESS;
     2816    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    28222817}
    28232818
     
    28722867    pVCpu->cpum.GstCtx.rbp = NewRbp.u;
    28732868    pVCpu->cpum.GstCtx.rsp = NewRsp.u;
    2874     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    2875 
    2876     return VINF_SUCCESS;
     2869    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    28772870}
    28782871
     
    45474540#endif
    45484541        CPUMSetChangedFlags(pVCpu, CPUM_CHANGED_HIDDEN_SEL_REGS);
    4549         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    4550         return VINF_SUCCESS;
     4542        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    45514543    }
    45524544
     
    45844576        CPUMSetChangedFlags(pVCpu, CPUM_CHANGED_HIDDEN_SEL_REGS);
    45854577
    4586         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    4587         return VINF_SUCCESS;
     4578        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    45884579    }
    45894580
     
    46904681
    46914682    CPUMSetChangedFlags(pVCpu, CPUM_CHANGED_HIDDEN_SEL_REGS);
    4692     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    4693     return VINF_SUCCESS;
     4683    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    46944684}
    46954685
     
    49124902    pVCpu->cpum.GstCtx.eflags.Bits.u1ZF = fAccessible;
    49134903
    4914     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    4915     return VINF_SUCCESS;
     4904    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    49164905}
    49174906
     
    50175006    /* commit flags value and advance rip. */
    50185007    pVCpu->cpum.GstCtx.eflags.Bits.u1ZF = fDescOk;
    5019     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    5020 
    5021     return VINF_SUCCESS;
     5008    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    50225009}
    50235010
     
    50805067            rcStrict = CPUMSetGuestGDTR(pVCpu, GCPtrBase, cbLimit);
    50815068            if (rcStrict == VINF_SUCCESS)
    5082                 iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     5069                rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    50835070        }
    50845071        else
     
    51225109    VBOXSTRICTRC rcStrict = iemMemStoreDataXdtr(pVCpu, pVCpu->cpum.GstCtx.gdtr.cbGdt, pVCpu->cpum.GstCtx.gdtr.pGdt, iEffSeg, GCPtrEffDst);
    51235110    if (rcStrict == VINF_SUCCESS)
    5124         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     5111        rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    51255112    return rcStrict;
    51265113}
     
    51595146        {
    51605147            CPUMSetGuestIDTR(pVCpu, GCPtrBase, cbLimit);
    5161             iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     5148            rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    51625149        }
    51635150        else
     
    51945181    VBOXSTRICTRC rcStrict = iemMemStoreDataXdtr(pVCpu, pVCpu->cpum.GstCtx.idtr.cbIdt, pVCpu->cpum.GstCtx.idtr.pIdt, iEffSeg, GCPtrEffDst);
    51955182    if (rcStrict == VINF_SUCCESS)
    5196         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     5183        rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    51975184    return rcStrict;
    51985185}
     
    52635250        }
    52645251
    5265         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    5266         return VINF_SUCCESS;
     5252        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    52675253    }
    52685254
     
    53325318    pVCpu->cpum.GstCtx.ldtr.u64Base  = u64Base;
    53335319
    5334     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    5335     return VINF_SUCCESS;
     5320    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    53365321}
    53375322
     
    53625347        IEM_NOT_REACHED_DEFAULT_CASE_RET();
    53635348    }
    5364     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    5365     return VINF_SUCCESS;
     5349    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    53665350}
    53675351
     
    53805364    VBOXSTRICTRC rcStrict = iemMemStoreDataU16(pVCpu, iEffSeg, GCPtrEffDst, pVCpu->cpum.GstCtx.ldtr.Sel);
    53815365    if (rcStrict == VINF_SUCCESS)
    5382         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     5366        rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    53835367    return rcStrict;
    53845368}
     
    55105494    pVCpu->cpum.GstCtx.tr.u64Base  = u64Base;
    55115495
    5512     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    5513     return VINF_SUCCESS;
     5496    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    55145497}
    55155498
     
    55405523        IEM_NOT_REACHED_DEFAULT_CASE_RET();
    55415524    }
    5542     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    5543     return VINF_SUCCESS;
     5525    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    55445526}
    55455527
     
    55655547    VBOXSTRICTRC rcStrict = iemMemStoreDataU16(pVCpu, iEffSeg, GCPtrEffDst, pVCpu->cpum.GstCtx.tr.Sel);
    55665548    if (rcStrict == VINF_SUCCESS)
    5567         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     5549        rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    55685550    return rcStrict;
    55695551}
     
    56845666        *(uint64_t *)iemGRegRef(pVCpu, iGReg) = (uint32_t)crX;
    56855667
    5686     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    5687     return VINF_SUCCESS;
     5668    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    56885669}
    56895670
     
    57325713    }
    57335714
    5734     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    5735     return VINF_SUCCESS;
     5715    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    57365716}
    57375717
     
    57685748    VBOXSTRICTRC rcStrict = iemMemStoreDataU16(pVCpu, iEffSeg, GCPtrEffDst, u16Value);
    57695749    if (rcStrict == VINF_SUCCESS)
    5770         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     5750        rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    57715751    return rcStrict;
    57725752}
     
    62406220    {
    62416221        if (rcStrict != VINF_SUCCESS)
    6242             rcStrict = iemSetPassUpStatus(pVCpu, rcStrict);
    6243         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     6222            iemSetPassUpStatus(pVCpu, rcStrict);
     6223        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    62446224    }
    62456225
     
    64556435        *(uint64_t *)iemGRegRef(pVCpu, iGReg) = (uint32_t)drX;
    64566436
    6457     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    6458     return VINF_SUCCESS;
     6437    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    64596438}
    64606439
     
    65786557    AssertRCSuccessReturn(rc, RT_SUCCESS_NP(rc) ? VERR_IEM_IPE_1 : rc);
    65796558
    6580     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    6581     return VINF_SUCCESS;
     6559    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    65826560}
    65836561
     
    66296607    *(uint64_t *)iemGRegRef(pVCpu, iGReg) = (uint32_t)trX;
    66306608
    6631     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    6632     return VINF_SUCCESS;
     6609    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    66336610}
    66346611
     
    66756652    RT_NOREF(uNewTrX);
    66766653
    6677     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    6678     return VINF_SUCCESS;
     6654    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    66796655}
    66806656
     
    67126688
    67136689    int rc = PGMInvalidatePage(pVCpu, GCPtrPage);
    6714     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    6715 
    67166690    if (rc == VINF_SUCCESS)
    6717         return VINF_SUCCESS;
     6691        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    67186692    if (rc == VINF_PGM_SYNC_CR3)
    6719         return iemSetPassUpStatus(pVCpu, rc);
    6720 
    6721     AssertMsg(rc == VINF_EM_RAW_EMULATE_INSTR || RT_FAILURE_NP(rc), ("%Rrc\n", rc));
     6693    {
     6694        iemSetPassUpStatus(pVCpu, rc);
     6695        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
     6696    }
     6697
     6698    AssertMsg(RT_FAILURE_NP(rc), ("%Rrc\n", rc));
    67226699    Log(("PGMInvalidatePage(%RGv) -> %Rrc\n", GCPtrPage, rc));
    67236700    return rc;
     
    68516828            IEM_NOT_REACHED_DEFAULT_CASE_RET();
    68526829        }
    6853         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     6830        rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    68546831    }
    68556832    return rcStrict;
     
    68746851
    68756852    /* We currently take no action here. */
    6876     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    6877     return VINF_SUCCESS;
     6853    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    68786854}
    68796855
     
    68966872
    68976873    /* We currently take no action here. */
    6898     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    6899     return VINF_SUCCESS;
     6874    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    69006875}
    69016876
     
    69556930    pVCpu->cpum.GstCtx.rdx = RT_HI_U32(uTicks);
    69566931    pVCpu->cpum.GstCtx.fExtrn &= ~(CPUMCTX_EXTRN_RAX | CPUMCTX_EXTRN_RDX); /* For IEMExecDecodedRdtsc. */
    6957     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    6958     return VINF_SUCCESS;
     6932    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    69596933}
    69606934
     
    70196993        pVCpu->cpum.GstCtx.rdx = RT_HI_U32(uTicks);
    70206994        pVCpu->cpum.GstCtx.fExtrn &= ~(CPUMCTX_EXTRN_RAX | CPUMCTX_EXTRN_RDX | CPUMCTX_EXTRN_RCX); /* For IEMExecDecodedRdtscp. */
    7021         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     6995        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    70226996    }
    70236997    return rcStrict;
     
    70577031     *        ecx but see @bugref{3472}! */
    70587032
    7059     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    7060     return VINF_SUCCESS;
     7033    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    70617034}
    70627035
     
    71147087        pVCpu->cpum.GstCtx.fExtrn &= ~(CPUMCTX_EXTRN_RAX | CPUMCTX_EXTRN_RDX);
    71157088
    7116         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    7117         return VINF_SUCCESS;
     7089        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    71187090    }
    71197091
     
    71927164    VBOXSTRICTRC rcStrict = CPUMSetGuestMsr(pVCpu, idMsr, uValue.u);
    71937165    if (rcStrict == VINF_SUCCESS)
    7194     {
    7195         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    7196         return VINF_SUCCESS;
    7197     }
     7166        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    71987167
    71997168#ifndef IN_RING3
     
    72807249     * Perform the I/O.
    72817250     */
    7282     uint32_t u32Value = 0;
    7283     rcStrict = IOMIOPortRead(pVCpu->CTX_SUFF(pVM), pVCpu, u16Port, &u32Value, cbReg);
     7251    PVMCC const pVM      = pVCpu->CTX_SUFF(pVM);
     7252    uint32_t    u32Value = 0;
     7253    rcStrict = IOMIOPortRead(pVM, pVCpu, u16Port, &u32Value, cbReg);
    72847254    if (IOM_SUCCESS(rcStrict))
    72857255    {
     
    72917261            default: AssertFailedReturn(VERR_IEM_IPE_3);
    72927262        }
    7293         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     7263
    72947264        pVCpu->iem.s.cPotentialExits++;
    72957265        if (rcStrict != VINF_SUCCESS)
    7296             rcStrict = iemSetPassUpStatus(pVCpu, rcStrict);
    7297         Assert(rcStrict == VINF_SUCCESS); /* assumed below */
     7266            iemSetPassUpStatus(pVCpu, rcStrict);
     7267        rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    72987268
    72997269        /*
    73007270         * Check for I/O breakpoints.
    73017271         */
     7272        /** @todo this should set a internal flag and be raised by
     7273         *        iemRegAddToRipAndFinishingClearingRF! */
    73027274        uint32_t const uDr7 = pVCpu->cpum.GstCtx.dr[7];
    7303         if (RT_UNLIKELY(   (   (uDr7 & X86_DR7_ENABLED_MASK)
    7304                             && X86_DR7_ANY_RW_IO(uDr7)
    7305                             && (pVCpu->cpum.GstCtx.cr4 & X86_CR4_DE))
    7306                         || DBGFBpIsHwIoArmed(pVCpu->CTX_SUFF(pVM))))
     7275        if (RT_UNLIKELY(   (   (   (uDr7 & X86_DR7_ENABLED_MASK)
     7276                                && X86_DR7_ANY_RW_IO(uDr7)
     7277                                && (pVCpu->cpum.GstCtx.cr4 & X86_CR4_DE))
     7278                            || DBGFBpIsHwIoArmed(pVM))
     7279                        && rcStrict == VINF_SUCCESS))
    73077280        {
    73087281            IEM_CTX_IMPORT_RET(pVCpu, CPUMCTX_EXTRN_DR0_DR3 | CPUMCTX_EXTRN_DR6);
    7309             rcStrict = DBGFBpCheckIo(pVCpu->CTX_SUFF(pVM), pVCpu, IEM_GET_CTX(pVCpu), u16Port, cbReg);
     7282            rcStrict = DBGFBpCheckIo(pVM, pVCpu, IEM_GET_CTX(pVCpu), u16Port, cbReg);
    73107283            if (rcStrict == VINF_EM_RAW_GUEST_TRAP)
    73117284                rcStrict = iemRaiseDebugException(pVCpu);
     
    73897362     * Perform the I/O.
    73907363     */
     7364    PVMCC const pVM      = pVCpu->CTX_SUFF(pVM);
    73917365    uint32_t u32Value;
    73927366    switch (cbReg)
     
    73977371        default: AssertFailedReturn(VERR_IEM_IPE_4);
    73987372    }
    7399     rcStrict = IOMIOPortWrite(pVCpu->CTX_SUFF(pVM), pVCpu, u16Port, u32Value, cbReg);
     7373    rcStrict = IOMIOPortWrite(pVM, pVCpu, u16Port, u32Value, cbReg);
    74007374    if (IOM_SUCCESS(rcStrict))
    74017375    {
    7402         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    74037376        pVCpu->iem.s.cPotentialExits++;
    74047377        if (rcStrict != VINF_SUCCESS)
    7405             rcStrict = iemSetPassUpStatus(pVCpu, rcStrict);
    7406         Assert(rcStrict == VINF_SUCCESS); /* assumed below */
     7378            iemSetPassUpStatus(pVCpu, rcStrict);
     7379        rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    74077380
    74087381        /*
    74097382         * Check for I/O breakpoints.
    74107383         */
     7384        /** @todo this should set a internal flag and be raised by
     7385         *        iemRegAddToRipAndFinishingClearingRF! */
    74117386        uint32_t const uDr7 = pVCpu->cpum.GstCtx.dr[7];
    7412         if (RT_UNLIKELY(   (   (uDr7 & X86_DR7_ENABLED_MASK)
    7413                             && X86_DR7_ANY_RW_IO(uDr7)
    7414                             && (pVCpu->cpum.GstCtx.cr4 & X86_CR4_DE))
    7415                         || DBGFBpIsHwIoArmed(pVCpu->CTX_SUFF(pVM))))
     7387        if (RT_UNLIKELY(   (   (   (uDr7 & X86_DR7_ENABLED_MASK)
     7388                                && X86_DR7_ANY_RW_IO(uDr7)
     7389                                && (pVCpu->cpum.GstCtx.cr4 & X86_CR4_DE))
     7390                            || DBGFBpIsHwIoArmed(pVM))
     7391                        && rcStrict == VINF_SUCCESS))
    74167392        {
    74177393            IEM_CTX_IMPORT_RET(pVCpu, CPUMCTX_EXTRN_DR0_DR3 | CPUMCTX_EXTRN_DR6);
    7418             rcStrict = DBGFBpCheckIo(pVCpu->CTX_SUFF(pVM), pVCpu, IEM_GET_CTX(pVCpu), u16Port, cbReg);
     7394            rcStrict = DBGFBpCheckIo(pVM, pVCpu, IEM_GET_CTX(pVCpu), u16Port, cbReg);
    74197395            if (rcStrict == VINF_EM_RAW_GUEST_TRAP)
    74207396                rcStrict = iemRaiseDebugException(pVCpu);
     
    74427418{
    74437419    uint32_t        fEfl    = IEMMISC_GET_EFL(pVCpu);
     7420#ifdef LOG_ENABLED
    74447421    uint32_t const  fEflOld = fEfl;
     7422#endif
    74457423
    74467424    IEM_CTX_ASSERT(pVCpu, CPUMCTX_EXTRN_CR0 | CPUMCTX_EXTRN_CR4);
     
    74737451    /* Commit. */
    74747452    IEMMISC_SET_EFL(pVCpu, fEfl);
    7475     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    7476     Log2(("CLI: %#x -> %#x\n", fEflOld, fEfl)); NOREF(fEflOld);
    7477     return VINF_SUCCESS;
     7453    VBOXSTRICTRC const rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
     7454    Log2(("CLI: %#x -> %#x\n", fEflOld, fEfl));
     7455    return rcStrict;
    74787456}
    74797457
     
    75227500     */
    75237501    IEMMISC_SET_EFL(pVCpu, fEfl);
    7524     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     7502    VBOXSTRICTRC const rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    75257503    if (!(fEflOld & X86_EFL_IF) && (fEfl & X86_EFL_IF))
    75267504    {
     
    75297507    }
    75307508    Log2(("STI: %#x -> %#x\n", fEflOld, fEfl));
    7531     return VINF_SUCCESS;
     7509    return rcStrict;
    75327510}
    75337511
     
    75557533    }
    75567534
    7557     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    7558     return VINF_EM_HALT;
     7535    /** @todo finish: This ASSUMES that iemRegAddToRipAndFinishingClearingRF won't
     7536     * be returning any status codes relating to non-guest events being raised, as
     7537     * we'll mess up the guest HALT otherwise.  */
     7538    VBOXSTRICTRC rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
     7539    if (rcStrict == VINF_SUCCESS)
     7540        rcStrict = VINF_EM_HALT;
     7541    return rcStrict;
    75597542}
    75607543
     
    76447627    rcStrict = EMMonitorWaitPrepare(pVCpu, pVCpu->cpum.GstCtx.rax, pVCpu->cpum.GstCtx.rcx, pVCpu->cpum.GstCtx.rdx, GCPhysMem);
    76457628    Assert(rcStrict == VINF_SUCCESS);
    7646 
    7647     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     7629    if (rcStrict == VINF_SUCCESS)
     7630        rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    76487631    return rcStrict;
    76497632}
     
    77127695            if (   IEM_VMX_IS_PROCCTLS_SET(pVCpu, VMX_PROC_CTLS_INT_WINDOW_EXIT)
    77137696                || VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_NESTED_GUEST))
    7714             {
    7715                 iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    7716                 return VINF_SUCCESS;
    7717             }
     7697                /** @todo finish: check up this out after we move int window stuff out of the
     7698                 *        run loop and into the instruction finishing logic here. */
     7699                return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    77187700        }
    77197701#endif
     
    77397721    /*
    77407722     * Call EM to prepare the monitor/wait.
     7723     *
     7724     * This will return VINF_EM_HALT. If there the trap flag is set, we may
     7725     * override it when executing iemRegAddToRipAndFinishingClearingRF ASSUMING
     7726     * that will only return guest related events.
    77417727     */
    77427728    VBOXSTRICTRC rcStrict = EMMonitorWaitPerform(pVCpu, uEax, uEcx);
    77437729
    7744     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     7730    /** @todo finish: This needs more thinking as we should suppress internal
     7731     * debugger events here, or we'll bugger up the guest state even more than we
     7732     * alread do around VINF_EM_HALT. */
     7733    VBOXSTRICTRC rcStrict2 = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
     7734    if (rcStrict2 != VINF_SUCCESS)
     7735    {
     7736        Log2(("mwait: %Rrc (perform) -> %Rrc (finish)!\n", VBOXSTRICTRC_VAL(rcStrict), VBOXSTRICTRC_VAL(rcStrict2) ));
     7737        rcStrict = rcStrict2;
     7738    }
     7739
    77457740    return rcStrict;
    77467741}
     
    77717766    pVCpu->cpum.GstCtx.gs.u64Base = uOtherGsBase;
    77727767
    7773     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    7774     return VINF_SUCCESS;
     7768    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    77757769}
    77767770
     
    79177911    pVCpu->cpum.GstCtx.fExtrn &= ~(CPUMCTX_EXTRN_RAX | CPUMCTX_EXTRN_RCX | CPUMCTX_EXTRN_RDX | CPUMCTX_EXTRN_RBX);
    79187912
    7919     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    79207913    pVCpu->iem.s.cPotentialExits++;
    7921     return VINF_SUCCESS;
     7914    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    79227915}
    79237916
     
    79377930                              X86_EFL_OF | X86_EFL_AF | X86_EFL_CF);
    79387931
    7939     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    7940     return VINF_SUCCESS;
     7932    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    79417933}
    79427934
     
    79597951                              X86_EFL_OF | X86_EFL_AF | X86_EFL_CF);
    79607952
    7961     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    7962     return VINF_SUCCESS;
     7953    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    79637954}
    79647955
     
    79907981
    79917982    iemHlpUpdateArithEFlagsU8(pVCpu, pVCpu->cpum.GstCtx.al, X86_EFL_SF | X86_EFL_ZF | X86_EFL_PF, X86_EFL_OF);
    7992     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    7993     return VINF_SUCCESS;
     7983    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    79947984}
    79957985
     
    80248014
    80258015    iemHlpUpdateArithEFlagsU8(pVCpu, pVCpu->cpum.GstCtx.al, X86_EFL_SF | X86_EFL_ZF | X86_EFL_PF, X86_EFL_OF);
    8026     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8027     return VINF_SUCCESS;
     8016    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    80288017}
    80298018
     
    80698058    }
    80708059
    8071     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8072     return VINF_SUCCESS;
     8060    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    80738061}
    80748062
     
    81148102    }
    81158103
    8116     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8117     return VINF_SUCCESS;
     8104    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    81188105}
    81198106
     
    81338120    if (   idxArray >= idxLowerBound
    81348121        && idxArray <= idxUpperBound)
    8135     {
    8136         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8137         return VINF_SUCCESS;
    8138     }
    8139 
     8122        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    81408123    return iemRaiseBoundRangeExceeded(pVCpu);
    81418124}
     
    81528135    if (   idxArray >= idxLowerBound
    81538136        && idxArray <= idxUpperBound)
    8154     {
    8155         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8156         return VINF_SUCCESS;
    8157     }
    8158 
     8137        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    81598138    return iemRaiseBoundRangeExceeded(pVCpu);
    81608139}
     
    82278206        pVCpu->cpum.GstCtx.rdx = RT_HI_U32(pVCpu->cpum.GstCtx.aXcr[uEcx]);
    82288207
    8229         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8230         return VINF_SUCCESS;
     8208        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    82318209    }
    82328210    Log(("xgetbv CR4.OSXSAVE=0 -> UD\n"));
     
    82778255            }
    82788256
    8279             iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8280             return VINF_SUCCESS;
     8257            return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    82818258        }
    82828259
     
    83528329                pVCpu->cpum.GstCtx.rdx = pu128RaxRdx->s.Hi;
    83538330            }
    8354             iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     8331            rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    83558332        }
    83568333    }
     
    84018378                if (   rcStrict != VINF_VMX_INTERCEPT_NOT_ACTIVE
    84028379                    && rcStrict != VINF_VMX_MODIFIES_BEHAVIOR)
    8403                         return rcStrict;
     8380                    return rcStrict;
    84048381            }
    84058382#endif
    8406             iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8407             return VINF_SUCCESS;
     8383            return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    84088384        }
    84098385    }
     
    84618437
    84628438    iemHlpUsedFpu(pVCpu);
    8463     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8464     return VINF_SUCCESS;
     8439    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    84658440}
    84668441
     
    85538528        return rcStrict;
    85548529
    8555     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8556     return VINF_SUCCESS;
     8530    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    85578531}
    85588532
     
    86608634
    86618635    iemHlpUsedFpu(pVCpu);
    8662     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8663     return VINF_SUCCESS;
     8636    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    86648637}
    86658638
     
    88128785        return rcStrict;
    88138786
    8814     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8815     return VINF_SUCCESS;
     8787    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    88168788}
    88178789
     
    90299001    }
    90309002
    9031     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9032     return VINF_SUCCESS;
     9003    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    90339004}
    90349005
     
    90599030            VBOXSTRICTRC rcStrict = iemMemStoreDataU32(pVCpu, iEffSeg, GCPtrEff, pVCpu->cpum.GstCtx.XState.x87.MXCSR);
    90609031            if (rcStrict == VINF_SUCCESS)
    9061             {
    9062                 iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9063                 return VINF_SUCCESS;
    9064             }
     9032                return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    90659033            return rcStrict;
    90669034        }
     
    90969064            VBOXSTRICTRC rcStrict = iemMemStoreDataU32(pVCpu, iEffSeg, GCPtrEff, pVCpu->cpum.GstCtx.XState.x87.MXCSR);
    90979065            if (rcStrict == VINF_SUCCESS)
    9098             {
    9099                 iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9100                 return VINF_SUCCESS;
    9101             }
     9066                return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    91029067            return rcStrict;
    91039068        }
     
    91399104                {
    91409105                    pVCpu->cpum.GstCtx.XState.x87.MXCSR = fNewMxCsr;
    9141                     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9142                     return VINF_SUCCESS;
     9106                    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    91439107                }
    91449108                Log(("ldmxcsr: New MXCSR=%#RX32 & ~MASK=%#RX32 = %#RX32 -> #GP(0)\n",
     
    93409304
    93419305    /* Note: C0, C1, C2 and C3 are documented as undefined, we leave them untouched! */
    9342     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9343     return VINF_SUCCESS;
     9306    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    93449307}
    93459308
     
    93949357
    93959358    iemHlpUsedFpu(pVCpu);
    9396     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9397     return VINF_SUCCESS;
     9359    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    93989360}
    93999361
     
    94239385
    94249386    iemHlpUsedFpu(pVCpu);
    9425     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9426     return VINF_SUCCESS;
     9387    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    94279388}
    94289389
     
    94599420
    94609421    iemHlpUsedFpu(pVCpu);
    9461     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9462     return VINF_SUCCESS;
     9422    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    94639423}
    94649424
     
    94929452    /* Note: C0, C1, C2 and C3 are documented as undefined, we leave them untouched! */
    94939453    iemHlpUsedFpu(pVCpu);
    9494     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9495     return VINF_SUCCESS;
     9454    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    94969455}
    94979456
     
    95449503    iemFpuUpdateOpcodeAndIpWorker(pVCpu, pFpuCtx);
    95459504    iemHlpUsedFpu(pVCpu);
    9546     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9547     return VINF_SUCCESS;
     9505    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    95489506}
    95499507
     
    96199577    iemFpuUpdateOpcodeAndIpWorker(pVCpu, pFpuCtx);
    96209578    iemHlpUsedFpu(pVCpu);
    9621     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9622     return VINF_SUCCESS;
     9579    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    96239580}
    96249581
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplStrInstr.cpp.h

    r96407 r97370  
    148148    ADDR_TYPE       uCounterReg  = pVCpu->cpum.GstCtx.ADDR_rCX;
    149149    if (uCounterReg == 0)
    150     {
    151         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    152         return VINF_SUCCESS;
    153     }
     150        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    154151
    155152    IEM_CTX_IMPORT_RET(pVCpu, CPUMCTX_EXTRN_SREG_FROM_IDX(iEffSeg) | CPUMCTX_EXTRN_ES);
     
    301298     * Done.
    302299     */
    303     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    304     return VINF_SUCCESS;
     300    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    305301}
    306302
     
    318314    ADDR_TYPE       uCounterReg = pVCpu->cpum.GstCtx.ADDR_rCX;
    319315    if (uCounterReg == 0)
    320     {
    321         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    322         return VINF_SUCCESS;
    323     }
     316        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    324317
    325318    IEM_CTX_IMPORT_RET(pVCpu, CPUMCTX_EXTRN_SREG_FROM_IDX(iEffSeg) | CPUMCTX_EXTRN_ES);
     
    471464     * Done.
    472465     */
    473     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    474     return VINF_SUCCESS;
     466    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    475467}
    476468
     
    488480    ADDR_TYPE       uCounterReg = pVCpu->cpum.GstCtx.ADDR_rCX;
    489481    if (uCounterReg == 0)
    490     {
    491         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    492         return VINF_SUCCESS;
    493     }
     482        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    494483
    495484    IEM_CTX_IMPORT_RET(pVCpu, CPUMCTX_EXTRN_ES);
     
    603592     * Done.
    604593     */
    605     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    606     return VINF_SUCCESS;
     594    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    607595}
    608596
     
    620608    ADDR_TYPE       uCounterReg = pVCpu->cpum.GstCtx.ADDR_rCX;
    621609    if (uCounterReg == 0)
    622     {
    623         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    624         return VINF_SUCCESS;
    625     }
     610        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    626611
    627612    IEM_CTX_IMPORT_RET(pVCpu, CPUMCTX_EXTRN_ES);
     
    734719     * Done.
    735720     */
    736     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    737     return VINF_SUCCESS;
     721    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    738722}
    739723
     
    753737    ADDR_TYPE       uCounterReg = pVCpu->cpum.GstCtx.ADDR_rCX;
    754738    if (uCounterReg == 0)
    755     {
    756         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    757         return VINF_SUCCESS;
    758     }
     739        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    759740
    760741    IEM_CTX_IMPORT_RET(pVCpu, CPUMCTX_EXTRN_SREG_FROM_IDX(iEffSeg) | CPUMCTX_EXTRN_ES);
     
    896877     * Done.
    897878     */
    898     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    899     return VINF_SUCCESS;
     879    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    900880}
    901881
     
    913893    ADDR_TYPE       uCounterReg = pVCpu->cpum.GstCtx.ADDR_rCX;
    914894    if (uCounterReg == 0)
    915     {
    916         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    917         return VINF_SUCCESS;
    918     }
     895        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    919896
    920897    IEM_CTX_IMPORT_RET(pVCpu, CPUMCTX_EXTRN_ES);
     
    10451022     * Done.
    10461023     */
    1047     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    1048     return VINF_SUCCESS;
     1024    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    10491025}
    10501026
     
    10621038    ADDR_TYPE       uCounterReg = pVCpu->cpum.GstCtx.ADDR_rCX;
    10631039    if (uCounterReg == 0)
    1064     {
    1065         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    1066         return VINF_SUCCESS;
    1067     }
     1040        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    10681041
    10691042    IEM_CTX_IMPORT_RET(pVCpu, CPUMCTX_EXTRN_SREG_FROM_IDX(iEffSeg));
     
    11711144     * Done.
    11721145     */
    1173     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    1174     return VINF_SUCCESS;
     1146    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    11751147}
    11761148
     
    12501222    if (IOM_SUCCESS(rcStrict))
    12511223    {
     1224        /**
     1225         * @todo I/O breakpoint support for INS
     1226         */
    12521227        *puMem = (OP_TYPE)u32Value;
    12531228# ifdef IN_RING3
     
    12621237            else
    12631238                pVCpu->cpum.GstCtx.ADDR_rDI -= OP_SIZE / 8;
    1264             iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     1239
     1240            /** @todo finish: work out how this should work wrt status codes. Not sure we
     1241             * can use iemSetPassUpStatus here, but it depends on what
     1242             * iemRegAddToRipAndFinishingClearingRF may eventually return (if anything)... */
     1243            rcStrict2 = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
     1244            if (rcStrict2 != VINF_SUCCESS)
     1245            {
     1246                iemSetPassUpStatus(pVCpu, rcStrict);
     1247                rcStrict = rcStrict2;
     1248            }
     1249            pVCpu->iem.s.cPotentialExits++;
    12651250        }
    12661251        else
     
    13281313    ADDR_TYPE       uCounterReg = pVCpu->cpum.GstCtx.ADDR_rCX;
    13291314    if (uCounterReg == 0)
    1330     {
    1331         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    1332         return VINF_SUCCESS;
    1333     }
     1315        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    13341316
    13351317    uint64_t        uBaseAddr   = 0; /* gcc may not be used uninitialized */
     
    13991381                    if (IOM_SUCCESS(rcStrict))
    14001382                    {
     1383                        /** @todo finish: work out how this should work wrt status codes. Not sure we
     1384                         * can use iemSetPassUpStatus here, but it depends on what
     1385                         * iemRegAddToRipAndFinishingClearingRF may eventually return (if anything)... */
    14011386                        rcStrict = iemSetPassUpStatus(pVCpu, rcStrict);
    14021387                        if (uCounterReg == 0)
    1403                             iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     1388                            rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
     1389                        pVCpu->iem.s.cPotentialExits++;
    14041390                    }
    14051391                    return rcStrict;
     
    14631449            if (rcStrict != VINF_SUCCESS)
    14641450            {
     1451                /** @todo finish: work out how this should work wrt status codes. Not sure we
     1452                 * can use iemSetPassUpStatus here, but it depends on what
     1453                 * iemRegAddToRipAndFinishingClearingRF may eventually return (if anything)... */
     1454                rcStrict = iemSetPassUpStatus(pVCpu, rcStrict);
    14651455                if (uCounterReg == 0)
    1466                     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    1467                 rcStrict = iemSetPassUpStatus(pVCpu, rcStrict);
     1456                    rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
     1457                pVCpu->iem.s.cPotentialExits++;
    14681458                return rcStrict;
    14691459            }
     
    14841474     * Done.
    14851475     */
    1486     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    1487     return VINF_SUCCESS;
     1476    pVCpu->iem.s.cPotentialExits++;
     1477    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    14881478}
    14891479
     
    15531543            else
    15541544                pVCpu->cpum.GstCtx.ADDR_rSI -= OP_SIZE / 8;
    1555             iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     1545            /** @todo finish: work out how this should work wrt status codes. Not sure we
     1546             * can use iemSetPassUpStatus here, but it depends on what
     1547             * iemRegAddToRipAndFinishingClearingRF may eventually return (if anything)... */
    15561548            if (rcStrict != VINF_SUCCESS)
    15571549                rcStrict = iemSetPassUpStatus(pVCpu, rcStrict);
     1550            rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
     1551            pVCpu->iem.s.cPotentialExits++;
    15581552        }
    15591553    }
     
    16171611    ADDR_TYPE       uCounterReg = pVCpu->cpum.GstCtx.ADDR_rCX;
    16181612    if (uCounterReg == 0)
    1619     {
    1620         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    1621         return VINF_SUCCESS;
    1622     }
     1613        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    16231614
    16241615    PCCPUMSELREGHID pHid      = iemSRegGetHid(pVCpu, iEffSeg);
     
    16801671                    if (IOM_SUCCESS(rcStrict))
    16811672                    {
     1673                        /** @todo finish: work out how this should work wrt status codes. Not sure we
     1674                         * can use iemSetPassUpStatus here, but it depends on what
     1675                         * iemRegAddToRipAndFinishingClearingRF may eventually return (if anything)... */
    16821676                        rcStrict = iemSetPassUpStatus(pVCpu, rcStrict);
    16831677                        if (uCounterReg == 0)
    1684                             iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     1678                            rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
     1679                        pVCpu->iem.s.cPotentialExits++;
    16851680                    }
    16861681                    return rcStrict;
     
    17291724                if (IOM_SUCCESS(rcStrict))
    17301725                {
     1726                    /** @todo finish: work out how this should work wrt status codes. Not sure we
     1727                     * can use iemSetPassUpStatus here, but it depends on what
     1728                     * iemRegAddToRipAndFinishingClearingRF may eventually return (if anything)... */
     1729                    rcStrict = iemSetPassUpStatus(pVCpu, rcStrict);
    17311730                    if (uCounterReg == 0)
    1732                         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    1733                     rcStrict = iemSetPassUpStatus(pVCpu, rcStrict);
     1731                        iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
     1732                    pVCpu->iem.s.cPotentialExits++;
    17341733                }
    17351734                return rcStrict;
     
    17501749     * Done.
    17511750     */
    1752     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    1753     return VINF_SUCCESS;
     1751    pVCpu->iem.s.cPotentialExits++;
     1752    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    17541753}
    17551754
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplSvmInstr.cpp

    r97286 r97370  
    12521252        pVCpu->cpum.GstCtx.SysEnter.eip    = VmcbNstGst.u64SysEnterEIP;
    12531253
    1254         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     1254        rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    12551255    }
    12561256    return rcStrict;
     
    13321332                                            sizeof(SVMVMCBSTATESAVE));
    13331333        if (rcStrict == VINF_SUCCESS)
    1334             iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     1334            rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    13351335    }
    13361336    return rcStrict;
     
    13761376
    13771377    CPUMSetGuestGif(&pVCpu->cpum.GstCtx, false);
    1378     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    13791378
    13801379#  if defined(VBOX_WITH_NESTED_HWVIRT_ONLY_IN_IEM) && defined(IN_RING3)
     1380    iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    13811381    return EMR3SetExecutionPolicy(pVCpu->CTX_SUFF(pVM)->pUVM, EMEXECPOLICY_IEM_ALL, true);
    13821382#  else
    1383     return VINF_SUCCESS;
     1383    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    13841384#  endif
    13851385# endif
     
    14241424
    14251425    CPUMSetGuestGif(&pVCpu->cpum.GstCtx, true);
    1426     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    14271426
    14281427#  if defined(VBOX_WITH_NESTED_HWVIRT_ONLY_IN_IEM) && defined(IN_RING3)
     1428    iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    14291429    return EMR3SetExecutionPolicy(pVCpu->CTX_SUFF(pVM)->pUVM, EMEXECPOLICY_IEM_ALL, false);
    14301430#  else
    1431     return VINF_SUCCESS;
     1431    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    14321432#  endif
    14331433# endif
     
    14741474
    14751475    PGMInvalidatePage(pVCpu, GCPtrPage);
    1476     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    1477     return VINF_SUCCESS;
     1476    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    14781477}
    14791478
     
    15531552        IEM_SVM_CHECK_INSTR_INTERCEPT(pVCpu, SVM_CTRL_INTERCEPT_PAUSE, SVM_EXIT_PAUSE, 0, 0);
    15541553
    1555     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    1556     return VINF_SUCCESS;
     1554    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    15571555}
    15581556
     
    15701568        if (RT_SUCCESS(rcStrict))
    15711569        {
     1570            /** @todo finish: Sort out assertion here when iemRegAddToRipAndFinishingClearingRF
     1571             * starts returning non-VINF_SUCCESS statuses. */
    15721572            if (rcStrict == VINF_SUCCESS)
    1573                 iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     1573                rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    15741574            if (   rcStrict == VINF_SUCCESS
    15751575                || rcStrict == VINF_GIM_HYPERCALL_CONTINUING)
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp

    r97286 r97370  
    77347734        pVCpu->cpum.GstCtx.hwvirt.vmx.enmDiag = kVmxVDiag_Vmentry_PtrInvalid;
    77357735        iemVmxVmFailInvalid(pVCpu);
    7736         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    7737         return VINF_SUCCESS;
     7736        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    77387737    }
    77397738
     
    77467745        pVCpu->cpum.GstCtx.hwvirt.vmx.enmDiag = kVmxVDiag_Vmentry_PtrShadowVmcs;
    77477746        iemVmxVmFailInvalid(pVCpu);
    7748         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    7749         return VINF_SUCCESS;
     7747        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    77507748    }
    77517749
     
    77597757        pVCpu->cpum.GstCtx.hwvirt.vmx.enmDiag = kVmxVDiag_Vmentry_BlocKMovSS;
    77607758        iemVmxVmFail(pVCpu, VMXINSTRERR_VMENTRY_BLOCK_MOVSS);
    7761         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    7762         return VINF_SUCCESS;
     7759        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    77637760    }
    77647761
     
    77737770            pVCpu->cpum.GstCtx.hwvirt.vmx.enmDiag = kVmxVDiag_Vmentry_VmcsClear;
    77747771            iemVmxVmFail(pVCpu, VMXINSTRERR_VMLAUNCH_NON_CLEAR_VMCS);
    7775             iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    7776             return VINF_SUCCESS;
     7772            return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    77777773        }
    77787774    }
     
    77877783            pVCpu->cpum.GstCtx.hwvirt.vmx.enmDiag = kVmxVDiag_Vmentry_VmcsLaunch;
    77887784            iemVmxVmFail(pVCpu, VMXINSTRERR_VMRESUME_NON_LAUNCHED_VMCS);
    7789             iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    7790             return VINF_SUCCESS;
     7785            return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    77917786        }
    77927787    }
     
    79337928
    79347929        iemVmxVmFail(pVCpu, VMXINSTRERR_VMENTRY_INVALID_HOST_STATE);
    7935         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    7936         return VINF_SUCCESS;
     7930        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    79377931    }
    79387932
    79397933    iemVmxVmFail(pVCpu, VMXINSTRERR_VMENTRY_INVALID_CTLS);
    7940     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    7941     return VINF_SUCCESS;
     7934    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    79427935# endif
    79437936}
     
    81138106        pVCpu->cpum.GstCtx.hwvirt.vmx.enmDiag = kVmxVDiag_Vmread_PtrInvalid;
    81148107        iemVmxVmFailInvalid(pVCpu);
    8115         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8116         return VINF_SUCCESS;
     8108        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    81178109    }
    81188110
     
    81268118        pVCpu->cpum.GstCtx.hwvirt.vmx.enmDiag = kVmxVDiag_Vmread_LinkPtrInvalid;
    81278119        iemVmxVmFailInvalid(pVCpu);
    8128         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8129         return VINF_SUCCESS;
     8120        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    81308121    }
    81318122
     
    81398130        pVCpu->cpum.GstCtx.hwvirt.vmx.uDiagAux = u64VmcsField;
    81408131        iemVmxVmFail(pVCpu, VMXINSTRERR_VMREAD_INVALID_COMPONENT);
    8141         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8142         return VINF_SUCCESS;
     8132        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    81438133    }
    81448134
     
    81738163    {
    81748164        iemVmxVmSucceed(pVCpu);
    8175         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8176         return VINF_SUCCESS;
     8165        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    81778166    }
    81788167
     
    82028191        *pu32Dst = u64Dst;
    82038192        iemVmxVmSucceed(pVCpu);
    8204         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8205         return VINF_SUCCESS;
     8193        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    82068194    }
    82078195
     
    82428230        {
    82438231            iemVmxVmSucceed(pVCpu);
    8244             iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8245             return VINF_SUCCESS;
     8232            return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    82468233        }
    82478234
     
    84168403        pVCpu->cpum.GstCtx.hwvirt.vmx.enmDiag = kVmxVDiag_Vmwrite_PtrInvalid;
    84178404        iemVmxVmFailInvalid(pVCpu);
    8418         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8419         return VINF_SUCCESS;
     8405        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    84208406    }
    84218407
     
    84298415        pVCpu->cpum.GstCtx.hwvirt.vmx.enmDiag = kVmxVDiag_Vmwrite_LinkPtrInvalid;
    84308416        iemVmxVmFailInvalid(pVCpu);
    8431         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8432         return VINF_SUCCESS;
     8417        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    84338418    }
    84348419
     
    84648449        pVCpu->cpum.GstCtx.hwvirt.vmx.uDiagAux = u64VmcsField;
    84658450        iemVmxVmFail(pVCpu, VMXINSTRERR_VMWRITE_INVALID_COMPONENT);
    8466         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8467         return VINF_SUCCESS;
     8451        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    84688452    }
    84698453
     
    84798463        pVCpu->cpum.GstCtx.hwvirt.vmx.uDiagAux = u64VmcsField;
    84808464        iemVmxVmFail(pVCpu, VMXINSTRERR_VMWRITE_RO_COMPONENT);
    8481         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8482         return VINF_SUCCESS;
     8465        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    84838466    }
    84848467
     
    85018484
    85028485    iemVmxVmSucceed(pVCpu);
    8503     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8504     return VINF_SUCCESS;
     8486    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    85058487}
    85068488
     
    86028584        pVCpu->cpum.GstCtx.hwvirt.vmx.uDiagAux = GCPhysVmcs;
    86038585        iemVmxVmFail(pVCpu, VMXINSTRERR_VMCLEAR_INVALID_PHYSADDR);
    8604         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8605         return VINF_SUCCESS;
     8586        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    86068587    }
    86078588
     
    86158596        pVCpu->cpum.GstCtx.hwvirt.vmx.uDiagAux = GCPhysVmcs;
    86168597        iemVmxVmFail(pVCpu, VMXINSTRERR_VMCLEAR_INVALID_PHYSADDR);
    8617         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8618         return VINF_SUCCESS;
     8598        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    86198599    }
    86208600
     
    86288608        pVCpu->cpum.GstCtx.hwvirt.vmx.uDiagAux = GCPhysVmcs;
    86298609        iemVmxVmFail(pVCpu, VMXINSTRERR_VMCLEAR_VMXON_PTR);
    8630         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8631         return VINF_SUCCESS;
     8610        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    86328611    }
    86338612
     
    86428621        pVCpu->cpum.GstCtx.hwvirt.vmx.uDiagAux = GCPhysVmcs;
    86438622        iemVmxVmFail(pVCpu, VMXINSTRERR_VMCLEAR_INVALID_PHYSADDR);
    8644         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8645         return VINF_SUCCESS;
     8623        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    86468624    }
    86478625
     
    86718649
    86728650    iemVmxVmSucceed(pVCpu);
    8673     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8674     return VINF_SUCCESS;
     8651    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    86758652}
    86768653
     
    87448721    {
    87458722        iemVmxVmSucceed(pVCpu);
    8746         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8747         return rcStrict;
     8723        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    87488724    }
    87498725
     
    88378813        pVCpu->cpum.GstCtx.hwvirt.vmx.uDiagAux = GCPhysVmcs;
    88388814        iemVmxVmFail(pVCpu, VMXINSTRERR_VMPTRLD_INVALID_PHYSADDR);
    8839         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8840         return VINF_SUCCESS;
     8815        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    88418816    }
    88428817
     
    88508825        pVCpu->cpum.GstCtx.hwvirt.vmx.uDiagAux = GCPhysVmcs;
    88518826        iemVmxVmFail(pVCpu, VMXINSTRERR_VMPTRLD_INVALID_PHYSADDR);
    8852         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8853         return VINF_SUCCESS;
     8827        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    88548828    }
    88558829
     
    88638837        pVCpu->cpum.GstCtx.hwvirt.vmx.uDiagAux = GCPhysVmcs;
    88648838        iemVmxVmFail(pVCpu, VMXINSTRERR_VMPTRLD_VMXON_PTR);
    8865         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8866         return VINF_SUCCESS;
     8839        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    88678840    }
    88688841
     
    88778850        pVCpu->cpum.GstCtx.hwvirt.vmx.uDiagAux = GCPhysVmcs;
    88788851        iemVmxVmFail(pVCpu, VMXINSTRERR_VMPTRLD_INVALID_PHYSADDR);
    8879         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8880         return VINF_SUCCESS;
     8852        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    88818853    }
    88828854
     
    89098881                 VMX_V_VMCS_REVISION_ID, VmcsRevId.n.u31RevisionId, GCPtrVmcs, GCPhysVmcs));
    89108882            pVCpu->cpum.GstCtx.hwvirt.vmx.enmDiag = kVmxVDiag_Vmptrld_VmcsRevId;
    8911             iemVmxVmFail(pVCpu, VMXINSTRERR_VMPTRLD_INCORRECT_VMCS_REV);
    8912             iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8913             return VINF_SUCCESS;
    8914         }
    8915 
    8916         Log(("vmptrld: Shadow VMCS -> VMFail()\n"));
    8917         pVCpu->cpum.GstCtx.hwvirt.vmx.enmDiag = kVmxVDiag_Vmptrld_ShadowVmcs;
     8883        }
     8884        else
     8885        {
     8886            Log(("vmptrld: Shadow VMCS -> VMFail()\n"));
     8887            pVCpu->cpum.GstCtx.hwvirt.vmx.enmDiag = kVmxVDiag_Vmptrld_ShadowVmcs;
     8888        }
    89188889        iemVmxVmFail(pVCpu, VMXINSTRERR_VMPTRLD_INCORRECT_VMCS_REV);
    8919         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8920         return VINF_SUCCESS;
     8890        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    89218891    }
    89228892
     
    89548924    Assert(IEM_VMX_HAS_CURRENT_VMCS(pVCpu));
    89558925    iemVmxVmSucceed(pVCpu);
    8956     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    8957     return VINF_SUCCESS;
     8926    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    89588927}
    89598928
     
    90549023        pVCpu->cpum.GstCtx.hwvirt.vmx.uDiagAux = u64InvvpidType;
    90559024        iemVmxVmFail(pVCpu, VMXINSTRERR_INVEPT_INVVPID_INVALID_OPERAND);
    9056         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9057         return VINF_SUCCESS;
     9025        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    90589026    }
    90599027
     
    90769044            pVCpu->cpum.GstCtx.hwvirt.vmx.uDiagAux = uDesc.s.Lo;
    90779045            iemVmxVmFail(pVCpu, VMXINSTRERR_INVEPT_INVVPID_INVALID_OPERAND);
    9078             iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9079             return VINF_SUCCESS;
     9046            return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    90809047        }
    90819048
     
    91639130            IEM_NOT_REACHED_DEFAULT_CASE_RET();
    91649131        }
    9165         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     9132        rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    91669133    }
    91679134    return rcStrict;
     
    92669233        pVCpu->cpum.GstCtx.hwvirt.vmx.uDiagAux = u64InveptType;
    92679234        iemVmxVmFail(pVCpu, VMXINSTRERR_INVEPT_INVVPID_INVALID_OPERAND);
    9268         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9269         return VINF_SUCCESS;
     9235        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    92709236    }
    92719237
     
    92919257            pVCpu->cpum.GstCtx.hwvirt.vmx.uDiagAux = uDesc.s.Hi;
    92929258            iemVmxVmFail(pVCpu, VMXINSTRERR_INVEPT_INVVPID_INVALID_OPERAND);
    9293             iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9294             return VINF_SUCCESS;
     9259            return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    92959260        }
    92969261
     
    93109275                pVCpu->cpum.GstCtx.hwvirt.vmx.uDiagAux = GCPhysEptPtr;
    93119276                iemVmxVmFail(pVCpu, VMXINSTRERR_INVEPT_INVVPID_INVALID_OPERAND);
    9312                 iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9313                 return VINF_SUCCESS;
     9277                return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    93149278            }
    93159279        }
     
    93219285
    93229286        iemVmxVmSucceed(pVCpu);
    9323         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     9287        rcStrict = iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    93249288    }
    93259289
     
    94879451            pVCpu->cpum.GstCtx.hwvirt.vmx.uDiagAux = GCPhysVmxon;
    94889452            iemVmxVmFailInvalid(pVCpu);
    9489             iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9490             return VINF_SUCCESS;
     9453            return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    94919454        }
    94929455
     
    95009463            pVCpu->cpum.GstCtx.hwvirt.vmx.uDiagAux = GCPhysVmxon;
    95019464            iemVmxVmFailInvalid(pVCpu);
    9502             iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9503             return VINF_SUCCESS;
     9465            return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    95049466        }
    95059467
     
    95149476            pVCpu->cpum.GstCtx.hwvirt.vmx.uDiagAux = GCPhysVmxon;
    95159477            iemVmxVmFailInvalid(pVCpu);
    9516             iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9517             return VINF_SUCCESS;
     9478            return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    95189479        }
    95199480
     
    95429503                pVCpu->cpum.GstCtx.hwvirt.vmx.enmDiag = kVmxVDiag_Vmxon_VmcsRevId;
    95439504                iemVmxVmFailInvalid(pVCpu);
    9544                 iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9545                 return VINF_SUCCESS;
     9505                return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    95469506            }
    95479507
     
    95509510            pVCpu->cpum.GstCtx.hwvirt.vmx.enmDiag = kVmxVDiag_Vmxon_ShadowVmcs;
    95519511            iemVmxVmFailInvalid(pVCpu);
    9552             iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9553             return VINF_SUCCESS;
     9512            return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    95549513        }
    95559514
     
    95669525
    95679526        iemVmxVmSucceed(pVCpu);
    9568         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9569         return VINF_SUCCESS;
    9570     }
    9571     else if (IEM_VMX_IS_NON_ROOT_MODE(pVCpu))
     9527        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
     9528    }
     9529    if (IEM_VMX_IS_NON_ROOT_MODE(pVCpu))
    95729530    {
    95739531        /* Nested-guest intercept. */
     
    95909548    iemVmxVmFail(pVCpu, VMXINSTRERR_VMXON_IN_VMXROOTMODE);
    95919549    pVCpu->cpum.GstCtx.hwvirt.vmx.enmDiag = kVmxVDiag_Vmxon_VmxAlreadyRoot;
    9592     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9593     return VINF_SUCCESS;
     9550    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    95949551}
    95959552
     
    96499606    {
    96509607        iemVmxVmFail(pVCpu, VMXINSTRERR_VMXOFF_DUAL_MON);
    9651         iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9652         return VINF_SUCCESS;
     9608        return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    96539609    }
    96549610
     
    96649620
    96659621    iemVmxVmSucceed(pVCpu);
    9666     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9667     return VINF_SUCCESS;
     9622    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    96689623}
    96699624
     
    98339788     * a VM-exit, the instruction operates normally.
    98349789     */
    9835     iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    9836     return VINF_SUCCESS;
     9790    return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr);
    98379791}
    98389792
  • trunk/src/VBox/VMM/VMMAll/IEMAllInstructionsOneByte.cpp.h

    r97361 r97370  
    43484348    {
    43494349        pVCpu->cpum.GstCtx.rsp = TmpRsp.u;
    4350         iemRegUpdateRipAndClearRF(pVCpu);
     4350        return iemRegUpdateRipAndFinishClearingRF(pVCpu);
    43514351    }
    43524352    return rcStrict;
  • trunk/src/VBox/VMM/include/IEMInline.h

    r97358 r97370  
    16141614 * @param   cbInstr             The number of bytes to add.
    16151615 */
    1616 DECLINLINE(VBOXSTRICTRC) iemRegAddToRipAndClearRF(PVMCPUCC pVCpu, uint8_t cbInstr)
     1616DECLINLINE(VBOXSTRICTRC) iemRegAddToRipAndFinishingClearingRF(PVMCPUCC pVCpu, uint8_t cbInstr)
    16171617{
    16181618    /*
     
    16471647
    16481648/**
     1649 * Extended version of iemRegAddToRipAndFinishingClearingRF for use by POPF and
     1650 * others potentially updating EFLAGS.TF.
     1651 *
     1652 * The single step event must be generated using the TF value at the start of
     1653 * the instruction, not the new value set by it.
     1654 *
     1655 * @param   pVCpu               The cross context virtual CPU structure of the calling thread.
     1656 * @param   cbInstr             The number of bytes to add.
     1657 * @param   fEflOld             The EFLAGS at the start of the instruction
     1658 *                              execution.
     1659 */
     1660DECLINLINE(VBOXSTRICTRC) iemRegAddToRipAndFinishingClearingRfEx(PVMCPUCC pVCpu, uint8_t cbInstr, uint32_t fEflOld)
     1661{
     1662    /*
     1663     * Advance RIP.
     1664     *
     1665     * When we're targetting 8086/8, 80186/8 or 80286 mode the updates are 16-bit,
     1666     * while in all other modes except LM64 the updates are 32-bit.  This means
     1667     * we need to watch for both 32-bit and 16-bit "carry" situations, i.e.
     1668     * 4GB and 64KB rollovers, and decide whether anything needs masking.
     1669     *
     1670     * See PC wrap around tests in bs3-cpu-weird-1.
     1671     */
     1672    uint64_t const uRipPrev = pVCpu->cpum.GstCtx.rip;
     1673    uint64_t const uRipNext = uRipPrev + cbInstr;
     1674    if (RT_LIKELY(   !((uRipNext ^ uRipPrev) & (RT_BIT_64(32) | RT_BIT_64(16)))
     1675                  || CPUMIsGuestIn64BitCodeEx(&pVCpu->cpum.GstCtx)))
     1676        pVCpu->cpum.GstCtx.rip = uRipNext;
     1677    else if (IEM_GET_TARGET_CPU(pVCpu) >= IEMTARGETCPU_386)
     1678        pVCpu->cpum.GstCtx.rip = (uint32_t)uRipNext;
     1679    else
     1680        pVCpu->cpum.GstCtx.rip = (uint16_t)uRipNext;
     1681
     1682    /*
     1683     * Clear RF and interrupt shadowing.
     1684     */
     1685    AssertCompile(CPUMCTX_INHIBIT_SHADOW < UINT32_MAX);
     1686    pVCpu->cpum.GstCtx.eflags.uBoth &= ~(X86_EFL_RF | CPUMCTX_INHIBIT_SHADOW);
     1687
     1688    RT_NOREF(fEflOld);
     1689    return VINF_SUCCESS;
     1690}
     1691
     1692
     1693/**
    16491694 * Updates the RIP/EIP/IP to point to the next instruction and clears EFLAGS.RF.
    16501695 *
    16511696 * @param   pVCpu               The cross context virtual CPU structure of the calling thread.
    16521697 */
    1653 DECLINLINE(VBOXSTRICTRC) iemRegUpdateRipAndClearRF(PVMCPUCC pVCpu)
    1654 {
    1655     return iemRegAddToRipAndClearRF(pVCpu, IEM_GET_INSTR_LEN(pVCpu));
     1698DECLINLINE(VBOXSTRICTRC) iemRegUpdateRipAndFinishClearingRF(PVMCPUCC pVCpu)
     1699{
     1700    return iemRegAddToRipAndFinishingClearingRF(pVCpu, IEM_GET_INSTR_LEN(pVCpu));
    16561701}
    16571702
  • trunk/src/VBox/VMM/include/IEMMc.h

    r97358 r97370  
    5555/** Advances RIP, finishes the instruction and returns.
    5656 * This may include raising debug exceptions and such. */
    57 #define IEM_MC_ADVANCE_RIP_AND_FINISH()                 return iemRegUpdateRipAndClearRF(pVCpu)
     57#define IEM_MC_ADVANCE_RIP_AND_FINISH()                 return iemRegUpdateRipAndFinishClearingRF(pVCpu)
    5858/** Sets RIP (may trigger \#GP), finishes the instruction and returns. */
    5959#define IEM_MC_REL_JMP_S8_AND_FINISH(a_i8)              return iemRegRipRelativeJumpS8(pVCpu, (a_i8))
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