VirtualBox

Changeset 23730 in vbox for trunk/src/VBox/VMM/VMM.cpp


Ignore:
Timestamp:
Oct 13, 2009 2:33:08 PM (15 years ago)
Author:
vboxsync
Message:

VMM: Don't save the R0/RC stack (old todo).

File:
1 edited

Legend:

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

    r23145 r23730  
    100100*******************************************************************************/
    101101/** The saved state version. */
    102 #define VMM_SAVED_STATE_VERSION     3
     102#define VMM_SAVED_STATE_VERSION     4
     103/** The saved state version used by v3.0 and earlier. (Live migration.) */
     104#define VMM_SAVED_STATE_VERSION_3_0 3
    103105
    104106
     
    924926
    925927    /*
    926      * The hypervisor stack.
    927      * Note! See note in vmmR3Load (remove this on version change).
    928      */
    929     PVMCPU pVCpu0 = &pVM->aCpus[0];
    930     SSMR3PutRCPtr(pSSM, pVCpu0->vmm.s.pbEMTStackBottomRC);
    931     RTRCPTR RCPtrESP = CPUMGetHyperESP(pVCpu0);
    932     AssertMsg(pVCpu0->vmm.s.pbEMTStackBottomRC - RCPtrESP <= VMM_STACK_SIZE, ("Bottom %RRv ESP=%RRv\n", pVCpu0->vmm.s.pbEMTStackBottomRC, RCPtrESP));
    933     SSMR3PutRCPtr(pSSM, RCPtrESP);
    934     SSMR3PutMem(pSSM, pVCpu0->vmm.s.pbEMTStackR3, VMM_STACK_SIZE);
    935 
    936     /*
    937928     * Save the started/stopped state of all CPUs except 0 as it will always
    938929     * be running. This avoids breaking the saved state version. :-)
     
    941932        SSMR3PutBool(pSSM, VMCPUSTATE_IS_STARTED(VMCPU_GET_STATE(&pVM->aCpus[i])));
    942933
    943     return SSMR3PutU32(pSSM, ~0); /* terminator */
     934    return SSMR3PutU32(pSSM, UINT32_MAX); /* terminator */
    944935}
    945936
     
    962953     * Validate version.
    963954     */
    964     if (uVersion != VMM_SAVED_STATE_VERSION)
    965     {
    966         AssertMsgFailed(("vmmR3Load: Invalid version uVersion=%d!\n", uVersion));
     955    if (    uVersion != VMM_SAVED_STATE_VERSION
     956        &&  uVersion != VMM_SAVED_STATE_VERSION_3_0)
     957    {
     958        AssertMsgFailed(("vmmR3Load: Invalid version uVersion=%u!\n", uVersion));
    967959        return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
    968960    }
    969961
    970     /*
    971      * Check that the stack is in the same place, or that it's fearly empty.
    972      *
    973      * Note! This can be skipped next time we update saved state as we will
    974      *       never be in a R0/RC -> ring-3 call when saving the state. The
    975      *       stack and the two associated pointers are not required.
    976      */
    977     RTRCPTR RCPtrStackBottom;
    978     SSMR3GetRCPtr(pSSM, &RCPtrStackBottom);
    979     RTRCPTR RCPtrESP;
    980     int rc = SSMR3GetRCPtr(pSSM, &RCPtrESP);
    981     if (RT_FAILURE(rc))
    982         return rc;
    983     SSMR3GetMem(pSSM, pVM->aCpus[0].vmm.s.pbEMTStackR3, VMM_STACK_SIZE);
    984 
    985     /* Restore the VMCPU states. VCPU 0 is always started. */
     962    if (uVersion <= VMM_SAVED_STATE_VERSION_3_0)
     963    {
     964        /* Ignore the stack bottom, stack pointer and stack bits. */
     965        RTRCPTR RCPtrIgnored;
     966        SSMR3GetRCPtr(pSSM, &RCPtrIgnored);
     967        SSMR3GetRCPtr(pSSM, &RCPtrIgnored);
     968        SSMR3Skip(pSSM, VMM_STACK_SIZE);
     969    }
     970
     971    /*
     972     * Restore the VMCPU states. VCPU 0 is always started.
     973     */
    986974    VMCPU_SET_STATE(&pVM->aCpus[0], VMCPUSTATE_STARTED);
    987975    for (VMCPUID i = 1; i < pVM->cCpus; i++)
    988976    {
    989977        bool fStarted;
    990         rc = SSMR3GetBool(pSSM, &fStarted);
     978        int rc = SSMR3GetBool(pSSM, &fStarted);
    991979        if (RT_FAILURE(rc))
    992980            return rc;
     
    996984    /* terminator */
    997985    uint32_t u32;
    998     rc = SSMR3GetU32(pSSM, &u32);
     986    int rc = SSMR3GetU32(pSSM, &u32);
    999987    if (RT_FAILURE(rc))
    1000988        return rc;
    1001     if (u32 != ~0U)
     989    if (u32 != UINT32_MAX)
    1002990    {
    1003991        AssertMsgFailed(("u32=%#x\n", u32));
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