VirtualBox

Changeset 38612 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Sep 2, 2011 12:31:33 PM (13 years ago)
Author:
vboxsync
Message:

EM:

  • Don't reschedule after clearing the inhibit irq flag, it breaks sti+hlt sequences by continuing execution instead of halting.
  • Restore the previous state on resume if we were halted or in a sipi wait.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/EM.cpp

    r38378 r38612  
    13601360            rc2 = VMMR3EmtRendezvousFF(pVM, pVCpu);
    13611361            UPDATE_RC();
    1362             /** @todo HACK ALERT! The following test is to make sure EM+TM things the VM is
    1363              * stopped/reset before the next VM state change is made. We need a better
    1364              * solution for this, or at least make it possible to do: (rc >= VINF_EM_FIRST
    1365              * && rc >= VINF_EM_SUSPEND). */
     1362            /** @todo HACK ALERT! The following test is to make sure EM+TM
     1363             * thinks the VM is stopped/reset before the next VM state change
     1364             * is made. We need a better solution for this, or at least make it
     1365             * possible to do: (rc >= VINF_EM_FIRST && rc <=
     1366             * VINF_EM_SUSPEND). */
    13661367            if (RT_UNLIKELY(rc == VINF_EM_SUSPEND || rc == VINF_EM_RESET || rc == VINF_EM_OFF))
    13671368            {
     
    14701471            rc2 = VMMR3EmtRendezvousFF(pVM, pVCpu);
    14711472            UPDATE_RC();
    1472             /** @todo HACK ALERT! The following test is to make sure EM+TM things the VM is
    1473              * stopped/reset before the next VM state change is made. We need a better
    1474              * solution for this, or at least make it possible to do: (rc >= VINF_EM_FIRST
    1475              * && rc >= VINF_EM_SUSPEND). */
     1473            /** @todo HACK ALERT! The following test is to make sure EM+TM
     1474             * thinks the VM is stopped/reset before the next VM state change
     1475             * is made. We need a better solution for this, or at least make it
     1476             * possible to do: (rc >= VINF_EM_FIRST && rc <=
     1477             * VINF_EM_SUSPEND). */
    14761478            if (RT_UNLIKELY(rc == VINF_EM_SUSPEND || rc == VINF_EM_RESET || rc == VINF_EM_OFF))
    14771479            {
     
    14951497            }
    14961498            UPDATE_RC();
    1497             /** @todo HACK ALERT! The following test is to make sure EM+TM things the VM is
    1498              * stopped/reset before the next VM state change is made. We need a better
    1499              * solution for this, or at least make it possible to do: (rc >= VINF_EM_FIRST
    1500              * && rc >= VINF_EM_SUSPEND). */
     1499            /** @todo HACK ALERT! The following test is to make sure EM+TM
     1500             * thinks the VM is stopped/reset before the next VM state change
     1501             * is made. We need a better solution for this, or at least make it
     1502             * possible to do: (rc >= VINF_EM_FIRST && rc <=
     1503             * VINF_EM_SUSPEND). */
    15011504            if (RT_UNLIKELY(rc == VINF_EM_SUSPEND || rc == VINF_EM_RESET || rc == VINF_EM_OFF))
    15021505            {
     
    15461549            }
    15471550            UPDATE_RC();
    1548             /** @todo HACK ALERT! The following test is to make sure EM+TM things the VM is
    1549              * stopped/reset before the next VM state change is made. We need a better
    1550              * solution for this, or at least make it possible to do: (rc >= VINF_EM_FIRST
    1551              * && rc >= VINF_EM_SUSPEND). */
     1551            /** @todo HACK ALERT! The following test is to make sure EM+TM
     1552             * thinks the VM is stopped/reset before the next VM state change
     1553             * is made. We need a better solution for this, or at least make it
     1554             * possible to do: (rc >= VINF_EM_FIRST && rc <=
     1555             * VINF_EM_SUSPEND). */
    15521556            if (RT_UNLIKELY(rc == VINF_EM_SUSPEND || rc == VINF_EM_RESET || rc == VINF_EM_OFF))
    15531557            {
     
    15781582        /*
    15791583         * The instruction following an emulated STI should *always* be executed!
    1580          * 
     1584         *
    15811585         * Note! We intentionally don't clear VM_FF_INHIBIT_INTERRUPTS here if
    15821586         *       the eip is the same as the inhibited instr address.  Before we
     
    15911595            &&  !VM_FF_ISPENDING(pVM, VM_FF_PGM_NO_MEMORY))
    15921596        {
    1593             Log(("VMCPU_FF_INHIBIT_INTERRUPTS at %RGv successor %RGv\n", (RTGCPTR)CPUMGetGuestRIP(pVCpu), EMGetInhibitInterruptsPC(pVCpu)));
    15941597            if (CPUMGetGuestRIP(pVCpu) != EMGetInhibitInterruptsPC(pVCpu))
     1598            {
     1599                Log(("Clearing VMCPU_FF_INHIBIT_INTERRUPTS at %RGv - successor %RGv\n", (RTGCPTR)CPUMGetGuestRIP(pVCpu), EMGetInhibitInterruptsPC(pVCpu)));
    15951600                VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS);
    1596 
    1597             if (EMIsSupervisorCodeRecompiled(pVM))
    1598                 rc2 = VINF_EM_RESCHEDULE_REM;
    1599             else if (HWACCMR3IsActive(pVCpu))
    1600                 rc2 = VINF_EM_RESCHEDULE_HWACC;
     1601            }
    16011602            else
    1602                 rc2 = PATMAreInterruptsEnabled(pVM) ? VINF_EM_RESCHEDULE_RAW : VINF_EM_RESCHEDULE_REM;
    1603 
    1604             UPDATE_RC();
     1603                Log(("Leaving VMCPU_FF_INHIBIT_INTERRUPTS set at %RGv\n", (RTGCPTR)CPUMGetGuestRIP(pVCpu)));
    16051604        }
    16061605
     
    19001899                    if (    pVCpu->em.s.enmPrevState == EMSTATE_WAIT_SIPI
    19011900                        ||  pVCpu->em.s.enmPrevState == EMSTATE_HALTED)
     1901                    {
     1902                        pVCpu->em.s.enmState = pVCpu->em.s.enmPrevState;
    19021903                        break;
     1904                    }
    19031905                    /* fall through and get scheduled. */
    19041906
     
    19371939                case VINF_EM_SUSPEND:
    19381940                    Log2(("EMR3ExecuteVM: VINF_EM_SUSPEND: %d -> %d\n", pVCpu->em.s.enmState, EMSTATE_SUSPENDED));
     1941                    Assert(pVCpu->em.s.enmState != EMSTATE_SUSPENDED);
    19391942                    pVCpu->em.s.enmPrevState = pVCpu->em.s.enmState;
    19401943                    pVCpu->em.s.enmState     = EMSTATE_SUSPENDED;
     
    19881991                case VINF_EM_NO_MEMORY:
    19891992                    Log2(("EMR3ExecuteVM: VINF_EM_NO_MEMORY: %d -> %d\n", pVCpu->em.s.enmState, EMSTATE_SUSPENDED));
     1993                    Assert(pVCpu->em.s.enmState != EMSTATE_SUSPENDED);
    19901994                    pVCpu->em.s.enmPrevState = pVCpu->em.s.enmState;
    19911995                    pVCpu->em.s.enmState = EMSTATE_SUSPENDED;
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