Index: trunk/src/VBox/VMM/PGM.cpp
===================================================================
--- trunk/src/VBox/VMM/PGM.cpp	(revision 2663)
+++ trunk/src/VBox/VMM/PGM.cpp	(revision 2679)
@@ -158,4 +158,5 @@
 static DECLCALLBACK(int) pgmR3RelocatePhysHandler(PAVLROGCPHYSNODECORE pNode, void *pvUser);
 static DECLCALLBACK(int) pgmR3RelocateVirtHandler(PAVLROGCPTRNODECORE pNode, void *pvUser);
+static DECLCALLBACK(void) pgmR3ResetNoMorePhysWritesFlag(PVM pVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser);
 static DECLCALLBACK(int) pgmR3Save(PVM pVM, PSSMHANDLE pSSM);
 static DECLCALLBACK(int) pgmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version);
@@ -447,18 +448,4 @@
 
 /**
- * The only purpose of this function is to clear the fNoMorePhysWrites flag
- * which prevents writing to physical memory once pgmR3Save() is called.
- */
-#ifdef VBOX_STRICT
-DECLCALLBACK(void)
-PGMR3ResetNoMorePhysWritesFlag(PVM pVM, VMSTATE aState, VMSTATE aOldState, void *aUser)
-{
-    if (aState == VMSTATE_RUNNING)
-        pVM->pgm.s.fNoMorePhysWrites = false;
-}
-#endif
-
-
-/**
  * Initiates the paging of VM.
  *
@@ -495,5 +482,5 @@
 
 #ifdef VBOX_STRICT
-    VMR3AtStateRegister (pVM, PGMR3ResetNoMorePhysWritesFlag, NULL);
+    VMR3AtStateRegister(pVM, pgmR3ResetNoMorePhysWritesFlag, NULL);
 #endif
 
@@ -799,5 +786,5 @@
 #if HC_ARCH_BITS == 64
 LogRel(("Debug: HCPhys32BitPD=%VHp aHCPhysPaePDs={%VHp,%VHp,%VHp,%VHp} HCPhysPaePDPTR=%VHp HCPhysPaePML4=%VHp\n",
-        pVM->pgm.s.HCPhys32BitPD, pVM->pgm.s.aHCPhysPaePDs[0], pVM->pgm.s.aHCPhysPaePDs[1], pVM->pgm.s.aHCPhysPaePDs[2], pVM->pgm.s.aHCPhysPaePDs[3], 
+        pVM->pgm.s.HCPhys32BitPD, pVM->pgm.s.aHCPhysPaePDs[0], pVM->pgm.s.aHCPhysPaePDs[1], pVM->pgm.s.aHCPhysPaePDs[2], pVM->pgm.s.aHCPhysPaePDs[3],
         pVM->pgm.s.HCPhysPaePDPTR, pVM->pgm.s.HCPhysPaePML4));
 LogRel(("Debug: HCPhysInterPD=%VHp HCPhysInterPaePDPTR=%VHp HCPhysInterPaePML4=%VHp\n",
@@ -806,5 +793,5 @@
         MMPage2Phys(pVM, pVM->pgm.s.apInterPTs[0]), MMPage2Phys(pVM, pVM->pgm.s.apInterPTs[1]),
         MMPage2Phys(pVM, pVM->pgm.s.apInterPaePTs[0]), MMPage2Phys(pVM, pVM->pgm.s.apInterPaePTs[1]),
-        MMPage2Phys(pVM, pVM->pgm.s.apInterPaePDs[0]), MMPage2Phys(pVM, pVM->pgm.s.apInterPaePDs[1]), MMPage2Phys(pVM, pVM->pgm.s.apInterPaePDs[2]), MMPage2Phys(pVM, pVM->pgm.s.apInterPaePDs[3]), 
+        MMPage2Phys(pVM, pVM->pgm.s.apInterPaePDs[0]), MMPage2Phys(pVM, pVM->pgm.s.apInterPaePDs[1]), MMPage2Phys(pVM, pVM->pgm.s.apInterPaePDs[2]), MMPage2Phys(pVM, pVM->pgm.s.apInterPaePDs[3]),
         MMPage2Phys(pVM, pVM->pgm.s.pInterPaePDPTR64)));
 #endif
@@ -1334,4 +1321,17 @@
 
 
+#ifdef VBOX_STRICT
+/**
+ * VM state change callback for clearing fNoMorePhysWrites after
+ * a snapshot has been created.
+ */
+static DECLCALLBACK(void) pgmR3ResetNoMorePhysWritesFlag(PVM pVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser)
+{
+    if (enmState == VMSTATE_RUNNING)
+        pVM->pgm.s.fNoMorePhysWrites = false;
+}
+#endif
+
+
 /**
  * Execute state save operation.
@@ -1345,8 +1345,6 @@
     PPGM pPGM = &pVM->pgm.s;
 
-#ifdef VBOX_STRICT
     /* No more writes to physical memory after this point! */
     pVM->pgm.s.fNoMorePhysWrites = true;
-#endif
 
     /*
Index: trunk/src/VBox/VMM/PGMInternal.h
===================================================================
--- trunk/src/VBox/VMM/PGMInternal.h	(revision 2663)
+++ trunk/src/VBox/VMM/PGMInternal.h	(revision 2679)
@@ -720,5 +720,5 @@
 #if HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64
     bool                Alignment[4];   /**< Align the structure size on a 64-bit boundrary. */
-#endif 
+#endif
 } PGMPOOLPAGE, *PPGMPOOLPAGE, **PPPGMPOOLPAGE;
 
@@ -1270,5 +1270,5 @@
 #if GC_ARCH_BITS == 32 && HC_ARCH_BITS == 64
     RTGCPTR                    alignment0; /**< structure size alignment. */
-#endif 
+#endif
 
     DECLR0CALLBACKMEMBER(int,  pfnR0ShwGetPage,(PVM pVM, RTGCUINTPTR GCPtr, uint64_t *pfFlags, PRTHCPHYS pHCPhys));
@@ -1343,5 +1343,5 @@
 #if GC_ARCH_BITS == 32 && HC_ARCH_BITS == 64
     RTGCPTR                         alignment2; /**< structure size alignment. */
-#endif 
+#endif
     /** @} */
 
@@ -1458,4 +1458,8 @@
     GCPTRTYPE(PPGMPOOL)             pPoolGC;
 
+    /** We're not in a state which permits writes to guest memory.
+     * (Only used in strict builds.) */
+    bool                            fNoMorePhysWrites;
+
     /** Flush the cache on the next access. */
     bool                            fPhysCacheFlushPending;
@@ -1465,10 +1469,4 @@
     /** PGMPhysWrite cache */
     PGMPHYSCACHE                    pgmphyswritecache;
-
-#ifdef VBOX_STRICT
-    /** Physical memory was already saved, no more writes which wouldn't be part of the
-     *  saved state! */
-    bool                            fNoMorePhysWrites;
-#endif
 
     /** @name Release Statistics
Index: trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
===================================================================
--- trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp	(revision 2663)
+++ trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp	(revision 2679)
@@ -942,17 +942,10 @@
 #endif
 
+    AssertMsg(!pVM->pgm.s.fNoMorePhysWrites, ("Calling PGMPhysWrite after pgmR3Save()!\n"));
     AssertMsg(cbWrite > 0, ("don't even think about writing zero bytes!\n"));
     if (cbWrite == 0)
         return;
 
-#ifdef VBOX_STRICT
-    /*
-     * pgmR3Save() was already called, any bytes we write now will not be part of the
-     * saved state!
-     */
-    AssertMsg(pVM->pgm.s.fNoMorePhysWrites == false, ("Calling PGMPhysWrite after pgmR3Save()!\n"));
-
     LogFlow(("PGMPhysWrite: %VGp %d\n", GCPhys, cbWrite));
-#endif
 
 #ifdef IN_RING3
