Changeset 23730 in vbox for trunk/src/VBox/VMM/VMM.cpp
- Timestamp:
- Oct 13, 2009 2:33:08 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMM.cpp
r23145 r23730 100 100 *******************************************************************************/ 101 101 /** 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 103 105 104 106 … … 924 926 925 927 /* 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 /*937 928 * Save the started/stopped state of all CPUs except 0 as it will always 938 929 * be running. This avoids breaking the saved state version. :-) … … 941 932 SSMR3PutBool(pSSM, VMCPUSTATE_IS_STARTED(VMCPU_GET_STATE(&pVM->aCpus[i]))); 942 933 943 return SSMR3PutU32(pSSM, ~0); /* terminator */934 return SSMR3PutU32(pSSM, UINT32_MAX); /* terminator */ 944 935 } 945 936 … … 962 953 * Validate version. 963 954 */ 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)); 967 959 return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 968 960 } 969 961 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 */ 986 974 VMCPU_SET_STATE(&pVM->aCpus[0], VMCPUSTATE_STARTED); 987 975 for (VMCPUID i = 1; i < pVM->cCpus; i++) 988 976 { 989 977 bool fStarted; 990 rc = SSMR3GetBool(pSSM, &fStarted);978 int rc = SSMR3GetBool(pSSM, &fStarted); 991 979 if (RT_FAILURE(rc)) 992 980 return rc; … … 996 984 /* terminator */ 997 985 uint32_t u32; 998 rc = SSMR3GetU32(pSSM, &u32);986 int rc = SSMR3GetU32(pSSM, &u32); 999 987 if (RT_FAILURE(rc)) 1000 988 return rc; 1001 if (u32 != ~0U)989 if (u32 != UINT32_MAX) 1002 990 { 1003 991 AssertMsgFailed(("u32=%#x\n", u32));
Note:
See TracChangeset
for help on using the changeset viewer.