VirtualBox

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


Ignore:
Timestamp:
Feb 28, 2017 12:17:31 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
113688
Message:

VMM: Add TMR3TimerSkip to skip a saved timer state in a given SSM stream (for saved state comptibility if timers get removed)

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

Legend:

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

    r63739 r65896  
    26902690
    26912691/**
     2692 * Skips the state of a timer in a given saved state.
     2693 *
     2694 * @returns VBox status.
     2695 * @param   pSSM            Save State Manager handle.
     2696 * @param   pfActive        Where to store whether the timer was active
     2697 *                          when the state was saved.
     2698 */
     2699VMMR3DECL(int) TMR3TimerSkip(PSSMHANDLE pSSM, bool *pfActive)
     2700{
     2701    Assert(pSSM); AssertPtr(pfActive);
     2702    LogFlow(("TMR3TimerSkip: pSSM=%p pfActive=%p\n", pSSM, pfActive));
     2703
     2704    /*
     2705     * Load the state and validate it.
     2706     */
     2707    uint8_t u8State;
     2708    int rc = SSMR3GetU8(pSSM, &u8State);
     2709    if (RT_FAILURE(rc))
     2710        return rc;
     2711#if 1 /* Workaround for accidental state shift in r47786 (2009-05-26 19:12:12). */  /** @todo remove this in a few weeks! */
     2712    if (    u8State == TMTIMERSTATE_SAVED_PENDING_STOP + 1
     2713        ||  u8State == TMTIMERSTATE_SAVED_PENDING_SCHEDULE + 1)
     2714        u8State--;
     2715#endif
     2716    if (    u8State != TMTIMERSTATE_SAVED_PENDING_STOP
     2717        &&  u8State != TMTIMERSTATE_SAVED_PENDING_SCHEDULE)
     2718    {
     2719        AssertLogRelMsgFailed(("u8State=%d\n", u8State));
     2720        return SSMR3HandleSetStatus(pSSM, VERR_TM_LOAD_STATE);
     2721    }
     2722
     2723    *pfActive = (u8State == TMTIMERSTATE_SAVED_PENDING_SCHEDULE);
     2724    if (*pfActive)
     2725    {
     2726        /*
     2727         * Load the expire time.
     2728         */
     2729        uint64_t u64Expire;
     2730        rc = SSMR3GetU64(pSSM, &u64Expire);
     2731        if (RT_FAILURE(rc))
     2732            return rc;
     2733    }
     2734
     2735    /*
     2736     * On failure set SSM status.
     2737     */
     2738    if (RT_FAILURE(rc))
     2739        rc = SSMR3HandleSetStatus(pSSM, rc);
     2740    return rc;
     2741}
     2742
     2743
     2744/**
    26922745 * Associates a critical section with a timer.
    26932746 *
  • trunk/src/VBox/VMM/VMMR3/VMMR3.def

    r64590 r65896  
    356356    TMR3TimerLoad
    357357    TMR3TimerSave
     358    TMR3TimerSkip
    358359    TMR3TimerDestroy
    359360    TMTimerFromMicro
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette