PGMSavedState.cpp revision bc6627c3d17074e7857145c98d0580aff1fe6f8a
/* $Id$ */
/** @file
* PGM - Page Manager and Monitor, The Saved State Part.
*/
/*
* Copyright (C) 2006-2009 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP LOG_GROUP_PGM
#include "PGMInternal.h"
/*******************************************************************************
* Defined Constants And Macros *
*******************************************************************************/
/** Saved state data unit version. */
#ifdef VBOX_WITH_LIVE_MIGRATION
# define PGM_SAVED_STATE_VERSION 10
#else
# define PGM_SAVED_STATE_VERSION 9
#endif
/** Saved state data unit version for 3.0. (pre live migration) */
#define PGM_SAVED_STATE_VERSION_3_0_0 9
/** Saved state data unit version for 2.2.2 and later. */
#define PGM_SAVED_STATE_VERSION_2_2_2 8
/** Saved state data unit version for 2.2.0. */
#define PGM_SAVED_STATE_VERSION_RR_DESC 7
/** Saved state data unit version. */
#define PGM_SAVED_STATE_VERSION_OLD_PHYS_CODE 6
/** @name Sparse state record types
* @{ */
/** Zero page. No data. */
/** Raw page. */
/** Virgin ROM page. Followed by protection (8-bit) and the raw bits. */
/** Raw shadowed ROM page. The protection (8-bit) preceeds the raw bits. */
/** Zero shadowed ROM page. The protection (8-bit) is the only payload. */
/** ROM protection (8-bit). */
/** The last record type. */
/** End marker. */
/** Flag indicating that the data is preceeded by an RTGCPHYS containing the
* page address. If not set, the page follows the immediately after the
* previous one. */
/** @} */
/*******************************************************************************
* Structures and Typedefs *
*******************************************************************************/
/** For loading old saved states. (pre-smp) */
typedef struct
{
/** If set no conflict checks are required. (boolean) */
bool fMappingsFixed;
/** Size of fixed mapping */
/** Base address (GC) of fixed mapping */
/** A20 gate mask.
* Our current approach to A20 emulation is to let REM do it and don't bother
* anywhere else. The interesting Guests will be operating with it enabled anyway.
* But whould need arrise, we'll subject physical addresses to this mask. */
/** A20 gate state - boolean! */
bool fA20Enabled;
/** The guest paging mode. */
} PGMOLD;
/*******************************************************************************
* Global Variables *
*******************************************************************************/
static const SSMFIELD s_aPGMFields[] =
{
};
static const SSMFIELD s_aPGMCpuFields[] =
{
};
static const SSMFIELD s_aPGMFields_Old[] =
{
};
/**
* Find the ROM tracking structure for the given page.
*
* @returns Pointer to the ROM page structure. NULL if the caller didn't check
* that it's a ROM page.
* @param pVM The VM handle.
* @param GCPhys The address of the ROM page.
*/
static PPGMROMPAGE pgmR3GetRomPage(PVM pVM, RTGCPHYS GCPhys) /** @todo change this to take a hint. */
{
{
}
return NULL;
}
/**
* Prepare for a live save operation.
*
* This will attempt to allocate and initialize the tracking structures. It
* will also prepare for write monitoring of pages and initialize PGM::LiveSave.
* pgmR3SaveDone will do the cleanups.
*
* @returns VBox status code.
*
* @param pVM The VM handle.
* @param pSSM The SSM handle.
*/
{
/*
* Indicate that we will be using the write monitoring.
*/
/** @todo find a way of mediating this when more users are added. */
{
}
/*
* Initialize the statistics.
*/
/*
* Try allocating tracking structures for the ram ranges.
*
* To avoid lock contention, we leave the lock every time we're allocating
* a new array. This means we'll have to ditch the allocation and start
* all over again if the RAM range list changes in-between.
*
* Note! pgmR3SaveDone will always be called and it is therefore responsible
* for cleaning up.
*/
do
{
{
&& !PGM_RAM_RANGE_IS_AD_HOC(pCur))
{
PPGMLIVESAVEPAGE paLSPages = (PPGMLIVESAVEPAGE)MMR3HeapAllocZ(pVM, MM_TAG_PGM, cPages * sizeof(PGMLIVESAVEPAGE));
if (!paLSPages)
return VERR_NO_MEMORY;
{
break; /* try again */
}
/*
* Initialize the array.
*/
while (iPage-- > 0)
{
/** @todo yield critsect! (after moving this away from EMT0) */
switch (PGM_PAGE_GET_TYPE(pPage))
{
case PGMPAGETYPE_RAM:
if (PGM_PAGE_IS_ZERO(pPage))
{
}
else if (PGM_PAGE_IS_SHARED(pPage))
{
}
else
{
}
break;
case PGMPAGETYPE_ROM_SHADOW:
case PGMPAGETYPE_ROM:
{
: !PGM_PAGE_IS_ZERO(pPage);
break;
}
default:
case PGMPAGETYPE_MMIO2:
break;
case PGMPAGETYPE_MMIO:
break;
}
}
}
}
} while (pCur);
return VINF_SUCCESS;
}
/**
* Takes care of the virgin ROM pages in the first pass.
*
* This is an attempt at simplifying the handling of ROM pages a little bit.
* This ASSUMES that no new ROM ranges will be added and that they won't be
* relinked in any way.
*
* @param pVM The VM handle.
* @param pSSM The SSM handle.
*/
{
{
{
/* Get the virgin page descriptor. */
if (PGMROMPROT_IS_ROM(enmProt))
else
/* Get the page bits. (Cannot use pgmPhysGCPhys2CCPtrInternalReadOnly here!) */
int rc = VINF_SUCCESS;
if (!PGM_PAGE_IS_ZERO(pPage))
{
void *pvPage;
if (RT_SUCCESS(rc))
}
else
/* Save it. */
else
{
}
if (RT_FAILURE(rc))
return rc;
/* Update state. */
GCPhysLast = GCPhys;
/* If the page cannot be shadowed, mark it as done. */
{
}
}
}
return VINF_SUCCESS;
}
/**
* pgmR3LiveExec part 1: Scan for page modifications and reprotect them.
*
* Note! Since we don't care about MMIO or MMIO2 pages and since we don't
* have any movable ROMs yet, we can safely yield the PGM when we
* detect contention.
*
* This holds true for part 2 as well.
*
* @param pVM The VM handle.
*/
{
do
{
uint32_t cSinceYield = 0;
{
{
GCPhysCur = 0;
{
/* Do yield first. */
{
break; /* restart */
}
/* Process the page. */
continue;
{
case PGMPAGETYPE_RAM:
{
{
case PGM_PAGE_STATE_ALLOCATED:
/** @todo Optimize this: Don't always re-enable write
* monitoring if the page is known to be very busy. */
{
}
else
{
}
{
}
break;
break;
case PGM_PAGE_STATE_ZERO:
{
{
}
}
break;
case PGM_PAGE_STATE_SHARED:
{
{
}
}
break;
}
break;
}
/* All writes to the shadow page are intercepted. */
case PGMPAGETYPE_ROM_SHADOW: /* (The shadow page is active.) */
case PGMPAGETYPE_ROM: /* (The virgin page is active.) */
{
{
{
{
}
}
else
}
else
{
}
break;
}
default:
case PGMPAGETYPE_MMIO2:
case PGMPAGETYPE_MMIO:
{
}
else
{
}
{
{
}
{
}
}
break;
} /* switch on page type */
} /* for each page in range */
if (GCPhysCur != 0)
break; /* Yield + ramrange change */
}
} /* for each range */
} while (pCur);
}
/**
* pgmR3LiveExec part 2: Save quiescent pages.
*
* @returns VBox status code.
* @param pVM The VM handle.
* @param pSSM The SSM handle.
* @param uPass The pass.
*/
{
do
{
uint32_t cSinceYield = 0;
{
{
GCPhysCur = 0;
{
/* Do yield first. */
{
break; /* restart */
}
/*
* Save dirty pages that hasn't changed since part 1.
* (Use if instead of switch here so we can easily break out of the loop.)
*/
)
)
)
{
int rc;
{
/*
* Copy the page and then save it outside the lock (since any
* SSM call may block).
*/
void const *pvPage;
if (RT_SUCCESS(rc))
else
{
}
}
{
/*
* Dirty zero page.
*/
else
{
}
}
else
{
/*
* Dirty shadow ROM page.
*/
continue; /* modified already, skip it. */
if (!fZero)
{
void *pvPage;
if (RT_SUCCESS(rc))
}
else
{
SSMR3PutU8(pSSM, (fZero ? PGM_STATE_REC_ROM_SHADOW_ZERO : PGM_STATE_REC_ROM_SHADOW) | PGM_STATE_REC_FLAG_ADDR);
}
if (!fZero)
}
/* common tail */
if (RT_FAILURE(rc))
return rc;
GCPhysLast = GCPhys;
{
break; /* restart */
}
}
} /* for each page in range */
if (GCPhysCur != 0)
break; /* Yield + ramrange change */
}
} /* for each range */
} while (pCur);
return VINF_SUCCESS;
}
/**
* Execute a live save pass.
*
* @returns VBox status code.
*
* @param pVM The VM handle.
* @param pSSM The SSM handle.
*/
{
if (uPass == 0)
{
if (RT_FAILURE(rc))
return rc;
}
}
/**
* Votes on whether the live save phase is done or not.
*
* @returns VBox status code.
*
* @param pVM The VM handle.
* @param pSSM The SSM handle.
*/
{
return VINF_SUCCESS;
}
#ifdef VBOX_WITH_LIVE_MIGRATION
/**
* Worker for pgmR3SaveExec that saves the memory.
*
* @returns VBox status code.
*
* @param pVM The VM handle.
* @param pSSM The SSM handle.
* @param fLiveSave Whether we're in a live save or not.
*
*/
{
/*
* Save all ROM pages.
*/
/*
* Save all MMIO2 pages (including unmapped ones).
*/
/*
* Save all normal RAM pages.
*/
return VINF_SUCCESS;
}
#else /* !VBOX_WITH_LIVE_MIGRATION */
/**
* Save zero indicator + bits for the specified page.
*
* @param pVM The VM handle.
* @param pSSH The saved state handle.
* @param pPage The page to save.
* @param GCPhys The address of the page.
* @param pRam The ram range (for error logging).
*/
static int pgmR3SavePage(PVM pVM, PSSMHANDLE pSSM, PPGMPAGE pPage, RTGCPHYS GCPhys, PPGMRAMRANGE pRam)
{
int rc;
if (PGM_PAGE_IS_ZERO(pPage))
else
{
void const *pvPage;
AssertLogRelMsgRCReturn(rc, ("pPage=%R[pgmpage] GCPhys=%#x %s\n", pPage, GCPhys, pRam->pszDesc), rc);
}
return rc;
}
/**
* Save a shadowed ROM page.
*
* Format: Type, protection, and two pages with zero indicators.
*
* @param pVM The VM handle.
* @param pSSH The saved state handle.
* @param pPage The page to save.
* @param GCPhys The address of the page.
* @param pRam The ram range (for error logging).
*/
static int pgmR3SaveShadowedRomPage(PVM pVM, PSSMHANDLE pSSM, PPGMPAGE pPage, RTGCPHYS GCPhys, PPGMRAMRANGE pRam)
{
/* Need to save both pages and the current state. */
if (RT_SUCCESS(rc))
{
PPGMPAGE pPagePassive = PGMROMPROT_IS_ROM(pRomPage->enmProt) ? &pRomPage->Shadow : &pRomPage->Virgin;
}
return rc;
}
#endif /* !VBOX_WITH_LIVE_MIGRATION */
/**
* Execute state save operation.
*
* @returns VBox status code.
* @param pVM VM Handle.
* @param pSSM SSM operation handle.
*/
{
int rc;
unsigned i;
/*
* Lock PGM and set the no-more-writes indicator.
*/
/*
* Save basic data (required / unaffected by relocation).
*/
{
}
/*
* The guest mappings.
*/
i = 0;
{
SSMR3PutU32( pSSM, i);
}
#ifdef VBOX_WITH_LIVE_MIGRATION
/*
* Save the (remainder of the) memory.
*/
if (RT_SUCCESS(rc))
{
}
#else /* !VBOX_WITH_LIVE_MIGRATION */
/*
* Ram ranges and the memory they describe.
*/
i = 0;
{
/*
* Save the ram range details.
*/
SSMR3PutU32(pSSM, i);
/*
* Iterate the pages, only two special case.
*/
{
if (uType == PGMPAGETYPE_ROM_SHADOW) /** @todo This isn't right, but it doesn't currently matter. */
else if (uType == PGMPAGETYPE_MMIO2_ALIAS_MMIO)
{
/* MMIO2 alias -> MMIO; the device will just have to deal with this. */
}
else
{
}
if (RT_FAILURE(rc))
break;
}
if (RT_FAILURE(rc))
break;
}
#endif /* !VBOX_WITH_LIVE_MIGRATION */
return rc;
}
/**
* Cleans up after an save state operation.
*
* @returns VBox status code.
* @param pVM VM Handle.
* @param pSSM SSM operation handle.
*/
{
/*
* Free the tracking arrays and disable write monitoring.
*
* Play nice with the PGM lock in case we're called while the VM is still
* running. This means we have to delay the freeing since we wish to use
* paLSPages as an indicator of which RAM ranges which we need to scan for
* write monitored pages.
*/
uint32_t cMonitoredPages = 0;
do
{
{
{
if (pvToFree)
{
break; /* start over again. */
}
while (iPage--)
{
{
}
}
}
}
} while (pCur);
/** @todo this is blindly assuming that we're the only user of write
* monitoring. Fix this when more users are added. */
return VINF_SUCCESS;
}
/**
* Prepare state load operation.
*
* @returns VBox status code.
* @param pVM VM Handle.
* @param pSSM SSM operation handle.
*/
{
/*
* Call the reset function to make sure all the memory is cleared.
*/
return VINF_SUCCESS;
}
/**
* Load an ignored page.
*
* @returns VBox status code.
* @param pSSM The saved state handle.
*/
{
}
/**
* Loads a page without any bits in the saved state, i.e. making sure it's
* really zero.
*
* @returns VBox status code.
* @param pVM The VM handle.
* @param uType The page type or PGMPAGETYPE_INVALID (old saved
* state).
* @param pPage The guest page tracking structure.
* @param GCPhys The page address.
* @param pRam The ram range (logging).
*/
static int pgmR3LoadPageZeroOld(PVM pVM, uint8_t uType, PPGMPAGE pPage, RTGCPHYS GCPhys, PPGMRAMRANGE pRam)
{
&& uType != PGMPAGETYPE_INVALID)
return VERR_SSM_UNEXPECTED_DATA;
/* I think this should be sufficient. */
if (!PGM_PAGE_IS_ZERO(pPage))
return VERR_SSM_UNEXPECTED_DATA;
return VINF_SUCCESS;
}
/**
* Loads a page from the saved state.
*
* @returns VBox status code.
* @param pVM The VM handle.
* @param pSSM The SSM handle.
* @param uType The page type or PGMPAGETYEP_INVALID (old saved
* state).
* @param pPage The guest page tracking structure.
* @param GCPhys The page address.
* @param pRam The ram range (logging).
*/
static int pgmR3LoadPageBitsOld(PVM pVM, PSSMHANDLE pSSM, uint8_t uType, PPGMPAGE pPage, RTGCPHYS GCPhys, PPGMRAMRANGE pRam)
{
int rc;
/*
* Match up the type, dealing with MMIO2 aliases (dropped).
*/
|| uType == PGMPAGETYPE_INVALID,
/*
* Load the page.
*/
void *pvPage;
if (RT_SUCCESS(rc))
return rc;
}
/**
* Loads a page (counter part to pgmR3SavePage).
*
* @returns VBox status code, fully bitched errors.
* @param pVM The VM handle.
* @param pSSM The SSM handle.
* @param uType The page type.
* @param pPage The page.
* @param GCPhys The page address.
* @param pRam The RAM range (for error messages).
*/
static int pgmR3LoadPageOld(PVM pVM, PSSMHANDLE pSSM, uint8_t uType, PPGMPAGE pPage, RTGCPHYS GCPhys, PPGMRAMRANGE pRam)
{
AssertLogRelMsgRCReturn(rc, ("pPage=%R[pgmpage] GCPhys=%#x %s rc=%Rrc\n", pPage, GCPhys, pRam->pszDesc, rc), rc);
if (uState == 0 /* zero */)
else if (uState == 1)
else
rc);
return VINF_SUCCESS;
}
/**
* Loads a shadowed ROM page.
*
* @returns VBox status code, errors are fully bitched.
* @param pVM The VM handle.
* @param pSSM The saved state handle.
* @param pPage The page.
* @param GCPhys The page address.
* @param pRam The RAM range (for error messages).
*/
static int pgmR3LoadShadowedRomPageOld(PVM pVM, PSSMHANDLE pSSM, PPGMPAGE pPage, RTGCPHYS GCPhys, PPGMRAMRANGE pRam)
{
/*
* Load and set the protection first, then load the two pages, the first
* one is the active the other is the passive.
*/
AssertLogRelMsgRCReturn(rc, ("pPage=%R[pgmpage] GCPhys=%#x %s\n", pPage, GCPhys, pRam->pszDesc), rc);
&& enmProt < PGMROMPROT_END,
{
}
/** @todo this isn't entirely correct as long as pgmPhysGCPhys2CCPtrInternal is
* used down the line (will the 2nd page will be written to the first
* one because of a false TLB hit since the TLB is using GCPhys and
* doesn't check the HCPhys of the desired page). */
if (RT_SUCCESS(rc))
{
*pPageActive = *pPage;
}
return rc;
}
/**
* Ram range flags and bits for older versions of the saved state.
*
* @returns VBox status code.
*
* @param pVM The VM handle
* @param pSSM The SSM handle.
* @param uVersion The saved state version.
*/
{
/*
* Ram range flags and bits.
*/
uint32_t i = 0;
{
/* Check the seqence number / separator. */
if (RT_FAILURE(rc))
return rc;
if (u32Sep == ~0U)
break;
if (u32Sep != i)
{
}
/* Get the range details. */
if (RT_FAILURE(rc))
return rc;
if (fHaveBits & ~1)
{
}
char szDesc[256];
szDesc[0] = '\0';
{
if (RT_FAILURE(rc))
return rc;
/* Since we've modified the description strings in r45878, only compare
them if the saved state is more recent. */
}
/*
* Match it up with the current range.
*
* Note there is a hack for dealing with the high BIOS mapping
* in the old saved state format, this means we might not have
* a 1:1 match on success.
*/
|| ( cchDesc
/* Hack for PDMDevHlpPhysReserve(pDevIns, 0xfff80000, 0x80000, "High ROM Region"); */
|| !fHaveBits)
)
{
LogRel(("Ram range: %RGp-%RGp %RGp bytes %s %s\n"
"State : %RGp-%RGp %RGp bytes %s %s\n",
/*
* If we're loading a state for debugging purpose, don't make a fuss if
* the MMIO and ROM stuff isn't 100% right, just skip the mismatches.
*/
AssertMsgFailed(("debug skipping not implemented, sorry\n"));
continue;
}
{
/*
* Load the pages one by one.
*/
{
AssertLogRelMsgRCReturn(rc, ("pPage=%R[pgmpage] iPage=%#x GCPhysPage=%#x %s\n", pPage, iPage, GCPhysPage, pRam->pszDesc), rc);
if (uType == PGMPAGETYPE_ROM_SHADOW)
else
AssertLogRelMsgRCReturn(rc, ("rc=%Rrc iPage=%#x GCPhysPage=%#x %s\n", rc, iPage, GCPhysPage, pRam->pszDesc), rc);
}
}
else
{
/*
* Old format.
*/
The rest is generally irrelevant and wrong since the stuff have to match registrations. */
{
AssertLogRelMsgRCReturn(rc, ("rc=%Rrc iPage=%#x GCPhys=%#x %s\n", rc, iPage, pRam->GCPhys, pRam->pszDesc), rc);
}
/* Load the bits */
if ( !fHaveBits
{
/*
* Dynamic chunks.
*/
{
AssertLogRelMsgRCReturn(rc, ("rc=%Rrc iPage=%#x GCPhys=%#x %s\n", rc, iPage, pRam->GCPhys, pRam->pszDesc), rc);
{
if (fPresent)
{
else
}
else
AssertLogRelMsgRCReturn(rc, ("rc=%Rrc iPage=%#x GCPhysPage=%#x %s\n", rc, iPage, GCPhysPage, pRam->pszDesc), rc);
}
}
}
{
/*
* MMIO2.
*/
}
{
/*
* PCI MMIO, no pages saved.
*/
}
else
{
/*
* Load the 0xfff80000..0xffffffff BIOS range.
* It starts with X reserved pages that we have to skip over since
* the RAMRANGE create by the new code won't include those.
*/
/* Skip wasted reserved pages before the ROM. */
{
}
/* Load the bios pages. */
{
AssertLogRelMsgRCReturn(rc, ("rc=%Rrc iPage=%#x GCPhys=%#x %s\n", rc, iPage, pRam->GCPhys, pRam->pszDesc), rc);
}
}
}
}
return VINF_SUCCESS;
}
/**
* Worker for pgmR3Load and pgmR3LoadLocked.
*
* @returns VBox status code.
*
* @param pVM The VM handle.
* @param pSSM The SSM handle.
* @param uVersion The saved state version.
*/
{
/*
* Process page records until we hit the terminator.
*/
for (;;)
{
/* Get the record type and flags. */
if (RT_FAILURE(rc))
return rc;
if (u8 == PGM_STATE_REC_END)
return VINF_SUCCESS;
AssertLogRelMsgReturn((u8 & ~PGM_STATE_REC_FLAG_ADDR) <= PGM_STATE_REC_LAST, ("%#x\n", u8), VERR_SSM_DATA_UNIT_FORMAT_CHANGED);
/* Get the address. */
if (!(u8 & PGM_STATE_REC_FLAG_ADDR))
{
}
else
{
if (RT_FAILURE(rc))
return rc;
AssertLogRelMsgReturn(GCPhys & PAGE_OFFSET_MASK, ("%RGp\n", GCPhys), VERR_SSM_DATA_UNIT_FORMAT_CHANGED);
}
/* Get the ram range and page. */
/*
* Take action according to the record type.
*/
switch (u8 & ~PGM_STATE_REC_FLAG_ADDR)
{
case PGM_STATE_REC_ZERO:
{
if (PGM_PAGE_IS_ZERO(pPage))
break;
/** @todo implement zero page replacing. */
AssertLogRelMsgReturn(PGM_PAGE_GET_STATE(pPage) == PGM_PAGE_STATE_ALLOCATED, ("GCPhys=%RGp %R[pgmpage]\n", GCPhys, pPage), VERR_INTERNAL_ERROR_5);
void *pvDstPage;
break;
}
case PGM_STATE_REC_RAW:
{
void *pvDstPage;
if (RT_FAILURE(rc))
return rc;
break;
}
case PGM_STATE_REC_ROM_VIRGIN:
case PGM_STATE_REC_ROM_SHADOW:
case PGM_STATE_REC_ROM_PROT:
{
if (RT_FAILURE(rc))
return rc;
AssertLogRelMsgReturn(enmProt > PGMROMPROT_INVALID && enmProt < PGMROMPROT_END, ("GCPhys=%RGp enmProt=%d\n", GCPhys, enmProt), VERR_INTERNAL_ERROR);
/* Make the protection change. */
{
}
break; /* done */
/* Get the right page descriptor. */
switch (u8 & ~PGM_STATE_REC_FLAG_ADDR)
{
case PGM_STATE_REC_ROM_VIRGIN:
if (!PGMROMPROT_IS_ROM(enmProt))
else
break;
case PGM_STATE_REC_ROM_SHADOW:
if (PGMROMPROT_IS_ROM(enmProt))
else
break;
}
/* Map it if necessary. */
switch (u8 & ~PGM_STATE_REC_FLAG_ADDR)
{
if (PGM_PAGE_IS_ZERO(pRealPage))
break;
/** @todo implement zero page replacing. */
/* fall thru */
case PGM_STATE_REC_ROM_VIRGIN:
case PGM_STATE_REC_ROM_SHADOW:
{
{
}
break;
}
}
/* Load the bits. */
switch (u8 & ~PGM_STATE_REC_FLAG_ADDR)
{
if (pvDstPage)
break;
case PGM_STATE_REC_ROM_VIRGIN:
case PGM_STATE_REC_ROM_SHADOW:
if (RT_FAILURE(rc))
return rc;
break;
}
break;
}
default:
}
}
}
/**
* Worker for pgmR3Load.
*
* @returns VBox status code.
*
* @param pVM The VM handle.
* @param pSSM The SSM handle.
* @param uVersion The saved state version.
*/
{
int rc;
/*
* Load basic data (required / unaffected by relocation).
*/
{
{
}
}
else if (uVersion >= PGM_SAVED_STATE_VERSION_RR_DESC)
{
}
else
{
if (RT_FAILURE(rc))
return rc;
/* check separator. */
if (RT_FAILURE(rc))
return rc;
{
}
}
/*
* The guest mappings.
*/
uint32_t i = 0;
for (;; i++)
{
/* Check the seqence number / separator. */
if (RT_FAILURE(rc))
return rc;
if (u32Sep == ~0U)
break;
if (u32Sep != i)
{
}
/* get the mapping details. */
char szDesc[256];
szDesc[0] = '\0';
if (RT_FAILURE(rc))
return rc;
if (RT_FAILURE(rc))
return rc;
/* find matching range. */
break;
/* relocate it. */
{
}
else
}
/*
* Load the RAM contents.
*/
}
/**
* Execute state load operation.
*
* @returns VBox status code.
* @param pVM VM Handle.
* @param pSSM SSM operation handle.
* @param uVersion Data layout version.
* @param uPass The data pass.
*/
{
int rc;
/*
* Validate version.
*/
if ( ( uPass != SSM_PASS_FINAL
&& uVersion != PGM_SAVED_STATE_VERSION)
|| ( uVersion != PGM_SAVED_STATE_VERSION
)
{
AssertMsgFailed(("pgmR3Load: Invalid version uVersion=%d (current %d)!\n", uVersion, PGM_SAVED_STATE_VERSION));
}
if (uPass != SSM_PASS_FINAL)
{
/*
* The non-final passes contains only memory.
*/
}
else
{
/*
* Do the loading while owning the lock because a bunch of the functions
* we're using requires this.
*/
if (RT_SUCCESS(rc))
{
/*
* We require a full resync now.
*/
{
}
{
/*
* Change the paging mode.
*/
/* Restore pVM->pgm.s.GCPhysCR3. */
else
}
}
}
return rc;
}
/**
* Registers the saved state callbacks with SSM.
*
* @returns VBox status code.
* @param pVM Pointer to VM structure.
* @param cbRam The RAM size.
*/
{
}