VirtualBox

Changeset 20121 in vbox for trunk/src/VBox/VMM


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

TM.cpp: Fixed saved state bustage from two days back. Enter the critical section associated with the timer on restore to make TMTimerSet/Stop happy.

File:
1 edited

Legend:

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

    r20096 r20121  
    22282228
    22292229
     2230/** @name Saved state values
     2231 * @{ */
     2232#define TMTIMERSTATE_SAVED_PENDING_STOP         4
     2233#define TMTIMERSTATE_SAVED_PENDING_SCHEDULE     7
     2234/** @}  */
     2235
     2236
    22302237/**
    22312238 * Saves the state of a timer to a saved state.
     
    22432250        case TMTIMERSTATE_PENDING_STOP:
    22442251        case TMTIMERSTATE_PENDING_STOP_SCHEDULE:
    2245             return SSMR3PutU8(pSSM, (uint8_t)TMTIMERSTATE_PENDING_STOP);
     2252            return SSMR3PutU8(pSSM, TMTIMERSTATE_SAVED_PENDING_STOP);
    22462253
    22472254        case TMTIMERSTATE_PENDING_SCHEDULE_SET_EXPIRE:
     
    22542261        case TMTIMERSTATE_PENDING_SCHEDULE:
    22552262        case TMTIMERSTATE_PENDING_RESCHEDULE:
    2256             SSMR3PutU8(pSSM, (uint8_t)TMTIMERSTATE_PENDING_SCHEDULE);
     2263            SSMR3PutU8(pSSM, TMTIMERSTATE_SAVED_PENDING_SCHEDULE);
    22572264            return SSMR3PutU64(pSSM, pTimer->u64Expire);
    22582265
     
    22892296    if (RT_FAILURE(rc))
    22902297        return rc;
    2291     TMTIMERSTATE enmState = (TMTIMERSTATE)u8State;
    2292     if (    enmState != TMTIMERSTATE_PENDING_STOP
    2293         &&  enmState != TMTIMERSTATE_PENDING_SCHEDULE
    2294         &&  enmState != TMTIMERSTATE_PENDING_STOP_SCHEDULE)
    2295     {
    2296         AssertMsgFailed(("enmState=%d %s\n", enmState, tmTimerState(enmState)));
     2298#if 1 /* Workaround for accidental state shift in r47786 (2009-05-26 19:12:12). */  /** @todo remove this in a few weeks! */
     2299    if (    u8State == TMTIMERSTATE_SAVED_PENDING_STOP + 1
     2300        ||  u8State == TMTIMERSTATE_SAVED_PENDING_SCHEDULE + 1)
     2301        u8State--;
     2302#endif
     2303    if (    u8State != TMTIMERSTATE_SAVED_PENDING_STOP
     2304        &&  u8State != TMTIMERSTATE_SAVED_PENDING_SCHEDULE)
     2305    {
     2306        AssertLogRelMsgFailed(("u8State=%d\n", u8State));
    22972307        return SSMR3HandleSetStatus(pSSM, VERR_TM_LOAD_STATE);
    22982308    }
    22992309
    2300     if (enmState == TMTIMERSTATE_PENDING_SCHEDULE)
     2310    /* Enter the critical section to make TMTimerSet/Stop happy. */
     2311    PPDMCRITSECT pCritSect = pTimer->pCritSect;
     2312    if (pCritSect)
     2313        PDMCritSectEnter(pCritSect, VERR_INTERNAL_ERROR);
     2314
     2315    if (u8State == TMTIMERSTATE_SAVED_PENDING_SCHEDULE)
    23012316    {
    23022317        /*
     
    23112326         * Set it.
    23122327         */
    2313         Log(("enmState=%d %s u64Expire=%llu\n", enmState, tmTimerState(enmState), u64Expire));
     2328        Log(("u8State=%d u64Expire=%llu\n", u8State, u64Expire));
    23142329        rc = TMTimerSet(pTimer, u64Expire);
    23152330    }
     
    23192334         * Stop it.
    23202335         */
    2321         Log(("enmState=%d %s\n", enmState, tmTimerState(enmState)));
     2336        Log(("u8State=%d\n", u8State));
    23222337        rc = TMTimerStop(pTimer);
    23232338    }
     2339
     2340    if (pCritSect)
     2341        PDMCritSectLeave(pCritSect);
    23242342
    23252343    /*
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