VirtualBox

Changeset 20122 in vbox


Ignore:
Timestamp:
May 28, 2009 2:13:40 PM (16 years ago)
Author:
vboxsync
Message:

EM.cpp: Fixed enmState assertion in EMR3ExecuteVM on restore. Restore can be handled the same way as resume after suspend.

File:
1 edited

Legend:

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

    r20072 r20122  
    511511static DECLCALLBACK(int) emR3Save(PVM pVM, PSSMHANDLE pSSM)
    512512{
    513     for (unsigned i=0;i<pVM->cCPUs;i++)
     513    for (VMCPUID i = 0; i < pVM->cCPUs; i++)
    514514    {
    515515        PVMCPU pVCpu = &pVM->aCpus[i];
     
    552552     * Load the saved state.
    553553     */
    554     for (unsigned i=0;i<pVM->cCPUs;i++)
     554    for (VMCPUID i = 0; i < pVM->cCPUs; i++)
    555555    {
    556556        PVMCPU pVCpu = &pVM->aCpus[i];
     
    562562        if (u32Version > EM_SAVED_STATE_VERSION_PRE_SMP)
    563563        {
    564             EMSTATE     enmState;
    565             uint32_t    u32;
    566             rc = SSMR3GetU32(pSSM, &u32);
     564            AssertCompile(sizeof(pVCpu->em.s.enmPrevState) == sizeof(uint32_t));
     565            rc = SSMR3GetU32(pSSM, (uint32_t *)&pVCpu->em.s.enmPrevState);
    567566            AssertRCReturn(rc, rc);
    568 
    569             enmState = (EMSTATE)u32;
    570             Assert(enmState != EMSTATE_SUSPENDED);
    571             pVCpu->em.s.enmState     = enmState;
    572             pVCpu->em.s.enmPrevState = EMSTATE_NONE;
     567            Assert(pVCpu->em.s.enmPrevState != EMSTATE_SUSPENDED);
     568
     569            pVCpu->em.s.enmState = EMSTATE_SUSPENDED;
    573570        }
    574571        Assert(!pVCpu->em.s.pCliStatTree);
     
    36673664             pVCpu->em.s.enmState, EMR3GetStateName(pVCpu->em.s.enmState), pVCpu->em.s.fForceRAW));
    36683665    VM_ASSERT_EMT(pVM);
    3669     Assert(pVCpu->em.s.enmState == EMSTATE_NONE || pVCpu->em.s.enmState == EMSTATE_WAIT_SIPI || pVCpu->em.s.enmState == EMSTATE_SUSPENDED || pVCpu->em.s.enmState == EMSTATE_HALTED);
     3666    AssertMsg(   pVCpu->em.s.enmState == EMSTATE_NONE
     3667              || pVCpu->em.s.enmState == EMSTATE_WAIT_SIPI
     3668              || pVCpu->em.s.enmState == EMSTATE_SUSPENDED,
     3669              ("%s\n", EMR3GetStateName(pVCpu->em.s.enmState)));
    36703670
    36713671    int rc = setjmp(pVCpu->em.s.u.FatalLongJump);
     
    36853685        rc = VINF_SUCCESS;
    36863686
     3687        /* If resuming after a pause or a state load, restore the previous
     3688           state or else we'll start executing code. Else, just reschedule. */
    36873689        if (    pVCpu->em.s.enmState == EMSTATE_SUSPENDED
    36883690            &&  (   pVCpu->em.s.enmPrevState == EMSTATE_WAIT_SIPI
    36893691                 || pVCpu->em.s.enmPrevState == EMSTATE_HALTED))
    3690         {
    3691             /* Pause->Resume: Restore the old wait state or else we'll start executing code. */
    36923692            pVCpu->em.s.enmState = pVCpu->em.s.enmPrevState;
    3693         }
    36943693        else
    36953694            pVCpu->em.s.enmState = emR3Reschedule(pVM, pVCpu, pVCpu->em.s.pCtx);
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