Index: /trunk/src/VBox/VMM/PGMSavedState.cpp
===================================================================
--- /trunk/src/VBox/VMM/PGMSavedState.cpp	(revision 23531)
+++ /trunk/src/VBox/VMM/PGMSavedState.cpp	(revision 23532)
@@ -1097,5 +1097,4 @@
     {
         uint32_t const  idRamRangesGen = pVM->pgm.s.idRamRangesGen;
-        uint32_t        cSinceYield    = 0;
         for (pCur = pVM->pgm.s.pRamRangesR3; pCur; pCur = pCur->pNextR3)
         {
@@ -1107,11 +1106,11 @@
                 uint32_t         iPage     = GCPhysCur <= pCur->GCPhys ? 0 : (GCPhysCur - pCur->GCPhys) >> PAGE_SHIFT;
                 GCPhysCur = 0;
-                for (; iPage < cPages; iPage++, cSinceYield++)
+                for (; iPage < cPages; iPage++)
                 {
                     /* Do yield first. */
                     if (   !fFinalPass
-                        && (cSinceYield & 0x7ff) == 0x7ff
-                        &&  PDMR3CritSectYield(&pVM->pgm.s.CritSect)
-                        &&  pVM->pgm.s.idRamRangesGen != idRamRangesGen)
+                        && (iPage & 0x7ff) == 0x100
+                        && PDMR3CritSectYield(&pVM->pgm.s.CritSect)
+                        && pVM->pgm.s.idRamRangesGen != idRamRangesGen)
                     {
                         GCPhysCur = pCur->GCPhys + ((RTGCPHYS)iPage << PAGE_SHIFT);
@@ -1276,5 +1275,4 @@
     {
         uint32_t const  idRamRangesGen = pVM->pgm.s.idRamRangesGen;
-        uint32_t        cSinceYield    = 0;
         for (pCur = pVM->pgm.s.pRamRangesR3; pCur; pCur = pCur->pNextR3)
         {
@@ -1286,11 +1284,11 @@
                 uint32_t         iPage     = GCPhysCur <= pCur->GCPhys ? 0 : (GCPhysCur - pCur->GCPhys) >> PAGE_SHIFT;
                 GCPhysCur = 0;
-                for (; iPage < cPages; iPage++, cSinceYield++)
+                for (; iPage < cPages; iPage++)
                 {
                     /* Do yield first. */
-                    if (    uPass != SSM_PASS_FINAL
-                        &&  (cSinceYield & 0x7ff) == 0x7ff
-                        &&  PDMR3CritSectYield(&pVM->pgm.s.CritSect)
-                        &&  pVM->pgm.s.idRamRangesGen != idRamRangesGen)
+                    if (   uPass != SSM_PASS_FINAL
+                        && (iPage & 0x7ff) == 0x100
+                        && PDMR3CritSectYield(&pVM->pgm.s.CritSect)
+                        && pVM->pgm.s.idRamRangesGen != idRamRangesGen)
                     {
                         GCPhysCur = pCur->GCPhys + ((RTGCPHYS)iPage << PAGE_SHIFT);
@@ -1906,6 +1904,4 @@
 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).
@@ -1920,5 +1916,5 @@
      */
     void *pvPage;
-    rc = pgmPhysGCPhys2CCPtrInternal(pVM, pPage, GCPhys, &pvPage);
+    int rc = pgmPhysGCPhys2CCPtrInternal(pVM, pPage, GCPhys, &pvPage);
     if (RT_SUCCESS(rc))
         rc = SSMR3GetMem(pSSM, pvPage, PAGE_SIZE);
@@ -1941,5 +1937,5 @@
 static int pgmR3LoadPageOld(PVM pVM, PSSMHANDLE pSSM, uint8_t uType, PPGMPAGE pPage, RTGCPHYS GCPhys, PPGMRAMRANGE pRam)
 {
-    uint8_t         uState;
+    uint8_t uState;
     int rc = SSMR3GetU8(pSSM, &uState);
     AssertLogRelMsgRCReturn(rc, ("pPage=%R[pgmpage] GCPhys=%#x %s rc=%Rrc\n", pPage, GCPhys, pRam->pszDesc, rc), rc);
@@ -1976,5 +1972,5 @@
     AssertLogRelMsgReturn(pRomPage, ("GCPhys=%RGp %s\n", GCPhys, pRam->pszDesc), VERR_INTERNAL_ERROR);
 
-    uint8_t     uProt;
+    uint8_t uProt;
     int rc = SSMR3GetU8(pSSM, &uProt);
     AssertLogRelMsgRCReturn(rc, ("pPage=%R[pgmpage] GCPhys=%#x %s\n", pPage, GCPhys, pRam->pszDesc), rc);
@@ -2258,4 +2254,7 @@
  * @param   pSSM                The SSM handle.
  * @param   uVersion            The saved state version.
+ *
+ * @todo    This needs splitting up if more record types or code twists are
+ *          added...
  */
 static int pgmR3LoadMemory(PVM pVM, PSSMHANDLE pSSM, uint32_t uPass)
@@ -2264,10 +2263,10 @@
      * Process page records until we hit the terminator.
      */
-    RTGCPHYS        GCPhys     = NIL_RTGCPHYS;
-    PPGMRAMRANGE    pRamHint   = NULL;
-    uint8_t         id         = UINT8_MAX;
-    uint32_t        iPage      = UINT32_MAX - 10;
-    PPGMROMRANGE    pRom       = NULL;
-    PPGMMMIO2RANGE  pMmio2     = NULL;
+    RTGCPHYS        GCPhys   = NIL_RTGCPHYS;
+    PPGMRAMRANGE    pRamHint = NULL;
+    uint8_t         id       = UINT8_MAX;
+    uint32_t        iPage    = UINT32_MAX - 10;
+    PPGMROMRANGE    pRom     = NULL;
+    PPGMMMIO2RANGE  pMmio2   = NULL;
     for (;;)
     {
@@ -2340,5 +2339,4 @@
                 }
                 id = UINT8_MAX;
-                iPage = UINT32_MAX - 10;
                 break;
             }
