Changeset 40170 in vbox for trunk/src/VBox/VMM/VMMR3/CPUM.cpp
- Timestamp:
- Feb 17, 2012 2:22:26 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 76326
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/CPUM.cpp
r40075 r40170 64 64 *******************************************************************************/ 65 65 /** The current saved state version. */ 66 #define CPUM_SAVED_STATE_VERSION 12 66 #define CPUM_SAVED_STATE_VERSION 13 67 /** The saved state version before introducing the MSR size field. */ 68 #define CPUM_SAVED_STATE_VERSION_NO_MSR_SIZE 12 67 69 /** The saved state version of 3.2, 3.1 and 3.3 trunk before the hidden 68 70 * selector register change (CPUM_CHANGED_HIDDEN_SEL_REGS_INVALID). */ … … 130 132 AssertCompile(sizeof(pVM->cpum.s) <= sizeof(pVM->cpum.padding)); 131 133 AssertCompileSizeAlignment(CPUMCTX, 64); 132 AssertCompileSizeAlignment(CPUMCTXMSR , 64);134 AssertCompileSizeAlignment(CPUMCTXMSRS, 64); 133 135 AssertCompileSizeAlignment(CPUMHOSTCTX, 64); 134 136 AssertCompileMemberAlignment(VM, cpum, 64); … … 1938 1940 1939 1941 SSMR3PutU32(pSSM, pVM->cCpus); 1942 SSMR3PutU32(pSSM, sizeof(pVM->aCpus[0].cpum.s.GuestMsrs.msr)); 1940 1943 for (VMCPUID i = 0; i < pVM->cCpus; i++) 1941 1944 { … … 1945 1948 SSMR3PutU32(pSSM, pVCpu->cpum.s.fUseFlags); 1946 1949 SSMR3PutU32(pSSM, pVCpu->cpum.s.fChanged); 1947 SSMR3PutMem(pSSM, &pVCpu->cpum.s.GuestMsr, sizeof(pVCpu->cpum.s.GuestMsr)); 1950 AssertCompileSizeAlignment(pVM->aCpus[i].cpum.s.GuestMsrs.msr, sizeof(uint64_t)); 1951 SSMR3PutMem(pSSM, &pVCpu->cpum.s.GuestMsrs, sizeof(pVM->aCpus[i].cpum.s.GuestMsrs.msr)); 1948 1952 } 1949 1953 … … 2068 2072 */ 2069 2073 if ( uVersion != CPUM_SAVED_STATE_VERSION 2074 && uVersion != CPUM_SAVED_STATE_VERSION_NO_MSR_SIZE 2070 2075 && uVersion != CPUM_SAVED_STATE_VERSION_VER3_2 2071 2076 && uVersion != CPUM_SAVED_STATE_VERSION_VER3_0 … … 2129 2134 VERR_SSM_UNEXPECTED_DATA); 2130 2135 2136 uint32_t cbMsrs = 0; 2137 if (uVersion > CPUM_SAVED_STATE_VERSION_NO_MSR_SIZE) 2138 { 2139 int rc = SSMR3GetU32(pSSM, &cbMsrs); AssertRCReturn(rc, rc); 2140 AssertLogRelMsgReturn(RT_ALIGN(cbMsrs, sizeof(uint64_t)) == cbMsrs, ("Size of MSRs is misaligned: %#x\n", cbMsrs), 2141 VERR_SSM_UNEXPECTED_DATA); 2142 AssertLogRelMsgReturn(cbMsrs <= sizeof(CPUMCTXMSRS) && cbMsrs > 0, ("Size of MSRs is out of range: %#x\n", cbMsrs), 2143 VERR_SSM_UNEXPECTED_DATA); 2144 } 2145 2131 2146 for (VMCPUID i = 0; i < pVM->cCpus; i++) 2132 2147 { … … 2134 2149 SSMR3GetU32(pSSM, &pVM->aCpus[i].cpum.s.fUseFlags); 2135 2150 SSMR3GetU32(pSSM, &pVM->aCpus[i].cpum.s.fChanged); 2136 if (uVersion >= CPUM_SAVED_STATE_VERSION_VER3_0) 2137 SSMR3GetMem(pSSM, &pVM->aCpus[i].cpum.s.GuestMsr, sizeof(pVM->aCpus[i].cpum.s.GuestMsr)); 2151 if (uVersion > CPUM_SAVED_STATE_VERSION_NO_MSR_SIZE) 2152 SSMR3GetMem(pSSM, &pVM->aCpus[i].cpum.s.GuestMsrs.au64[0], cbMsrs); 2153 else if (uVersion >= CPUM_SAVED_STATE_VERSION_VER3_0) 2154 { 2155 SSMR3GetMem(pSSM, &pVM->aCpus[i].cpum.s.GuestMsrs.au64[0], 2 * sizeof(uint64_t)); /* Restore two MSRs. */ 2156 SSMR3Skip(pSSM, 62 * sizeof(uint64_t)); 2157 } 2138 2158 } 2139 2159 }
Note:
See TracChangeset
for help on using the changeset viewer.