VirtualBox

Changeset 100790 in vbox


Ignore:
Timestamp:
Aug 4, 2023 8:53:14 AM (16 months ago)
Author:
vboxsync
Message:

VMM/IEM: Don't generate IRQ checks as the first call in a code block, it prevents anything from getting done if we get the IRQ/NMI scheduling conditions wrong. Account for instructions executed in iemThreadedTbExec when completing blocks. bugref:10369

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

Legend:

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

    r100788 r100790  
    109109                                  | VMCPU_FF_TLB_FLUSH
    110110                                  | VMCPU_FF_UNHALT );
     111    /** @todo this isn't even close to the NMI and interrupt conditions in EM! */
    111112    if (RT_LIKELY(   (   !fCpu
    112113                      || (   !(fCpu & ~(VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC))
  • trunk/src/VBox/VMM/VMMAll/IEMAllThrdRecompiler.cpp

    r100789 r100790  
    11941194    fCpu &= VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_INTERRUPT_NMI | VMCPU_FF_INTERRUPT_SMI;
    11951195#if 1
     1196    /** @todo this isn't even close to the NMI/IRQ conditions in EM. */
    11961197    if (RT_LIKELY(   !fCpu
    11971198                  || (   !(fCpu & ~(VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC))
     
    12211222{
    12221223    /*
    1223      * Skip this we've already emitted a call after the previous instruction.
     1224     * Skip this we've already emitted a call after the previous instruction
     1225     * or if it's the first call, as we're always checking FFs between blocks.
    12241226     */
    12251227    uint32_t const idxCall = pTb->Thrd.cCalls;
    1226     if (   idxCall == 0
    1227         || pTb->Thrd.paCalls[idxCall - 1].enmFunction != kIemThreadedFunc_BltIn_CheckIrq)
     1228    if (   idxCall > 0
     1229        && pTb->Thrd.paCalls[idxCall - 1].enmFunction != kIemThreadedFunc_BltIn_CheckIrq)
    12281230    {
    12291231        /* Emit the call. */
     
    13281330    pVCpu->iem.s.pCurTbR3 = pTb;
    13291331
     1332#if 0
     1333    /* Make sure the CheckIrq condition matches the one in EM. */
     1334    iemThreadedCompileCheckIrqAfter(pVCpu, pTb);
     1335    const uint32_t cZeroCalls = 1;
     1336#else
     1337    const uint32_t cZeroCalls = 0;
     1338#endif
     1339
    13301340    /*
    13311341     * Now for the recomplication. (This mimicks IEMExecLots in many ways.)
     
    13621372                rcStrict = VINF_SUCCESS;
    13631373
    1364             if (pTb->Thrd.cCalls > 0)
     1374            if (pTb->Thrd.cCalls > cZeroCalls)
    13651375            {
    13661376                if (cCallsPrev != pTb->Thrd.cCalls)
     
    14561466                                                                                          pCallEntry->auParams[1],
    14571467                                                                                          pCallEntry->auParams[2]);
    1458 
    14591468        if (RT_LIKELY(   rcStrict == VINF_SUCCESS
    14601469                      && pVCpu->iem.s.rcPassUp == VINF_SUCCESS /** @todo this isn't great. */))
     
    14721481    }
    14731482
     1483    pVCpu->iem.s.cInstructions += pTb->cInstructions;
    14741484    pVCpu->iem.s.pCurTbR3 = NULL;
    14751485    return VINF_SUCCESS;
     
    16061616                                                  | VMCPU_FF_TLB_FLUSH
    16071617                                                  | VMCPU_FF_UNHALT );
     1618                    /** @todo this isn't even close to the NMI/IRQ conditions in EM. */
    16081619                    if (RT_LIKELY(   (   !fCpu
    16091620                                      || (   !(fCpu & ~(VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC))
    1610                                           && !pVCpu->cpum.GstCtx.rflags.Bits.u1IF) )
     1621                                          && (   !pVCpu->cpum.GstCtx.rflags.Bits.u1IF
     1622                                              || CPUMIsInInterruptShadow(&pVCpu->cpum.GstCtx) )) )
    16111623                                  && !VM_FF_IS_ANY_SET(pVM, VM_FF_ALL_MASK) ))
    16121624                    {
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