VirtualBox

Ignore:
Timestamp:
Feb 17, 2012 2:22:26 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
76326
Message:

MSRs and MTRRs, CPUM saved state changed. (linux 2.4.31 seems to ignore the capabilites when it comes to fixed MTRRs.)

File:
1 edited

Legend:

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

    r40075 r40170  
    6464*******************************************************************************/
    6565/** 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
    6769/** The saved state version of 3.2, 3.1 and 3.3 trunk before the hidden
    6870 * selector register change (CPUM_CHANGED_HIDDEN_SEL_REGS_INVALID). */
     
    130132    AssertCompile(sizeof(pVM->cpum.s) <= sizeof(pVM->cpum.padding));
    131133    AssertCompileSizeAlignment(CPUMCTX, 64);
    132     AssertCompileSizeAlignment(CPUMCTXMSR, 64);
     134    AssertCompileSizeAlignment(CPUMCTXMSRS, 64);
    133135    AssertCompileSizeAlignment(CPUMHOSTCTX, 64);
    134136    AssertCompileMemberAlignment(VM, cpum, 64);
     
    19381940
    19391941    SSMR3PutU32(pSSM, pVM->cCpus);
     1942    SSMR3PutU32(pSSM, sizeof(pVM->aCpus[0].cpum.s.GuestMsrs.msr));
    19401943    for (VMCPUID i = 0; i < pVM->cCpus; i++)
    19411944    {
     
    19451948        SSMR3PutU32(pSSM, pVCpu->cpum.s.fUseFlags);
    19461949        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));
    19481952    }
    19491953
     
    20682072     */
    20692073    if (    uVersion != CPUM_SAVED_STATE_VERSION
     2074        &&  uVersion != CPUM_SAVED_STATE_VERSION_NO_MSR_SIZE
    20702075        &&  uVersion != CPUM_SAVED_STATE_VERSION_VER3_2
    20712076        &&  uVersion != CPUM_SAVED_STATE_VERSION_VER3_0
     
    21292134                                  VERR_SSM_UNEXPECTED_DATA);
    21302135
     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
    21312146            for (VMCPUID i = 0; i < pVM->cCpus; i++)
    21322147            {
     
    21342149                SSMR3GetU32(pSSM, &pVM->aCpus[i].cpum.s.fUseFlags);
    21352150                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                }
    21382158            }
    21392159        }
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