Index: trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
===================================================================
--- trunk/src/VBox/Devices/Audio/DevIchAc97.cpp	(revision 22479)
+++ trunk/src/VBox/Devices/Audio/DevIchAc97.cpp	(revision 22480)
@@ -1458,19 +1458,17 @@
  * @param   pDevIns     The device instance.
  * @param   pSSMHandle  The handle to the saved state.
- * @param   u32Version  The data unit version number.
+ * @param   uVersion    The data unit version number.
+ * @param   uPhase      The data phase.
  */
 static DECLCALLBACK(int) ichac97LoadExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle,
-                                          uint32_t u32Version)
+                                          uint32_t uVersion, uint32_t uPhase)
 {
     PCIAC97LinkState *pThis = PDMINS_2_DATA(pDevIns, PCIAC97LinkState *);
+    AC97LinkState *s = &pThis->ac97;
+    uint8_t active[LAST_INDEX];
     size_t  i;
-    uint8_t active[LAST_INDEX];
-    AC97LinkState *s = &pThis->ac97;
-
-    if (u32Version != AC97_SSM_VERSION)
-    {
-        AssertFailed();
-        return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
-    }
+
+    AssertMsgReturn (uVersion == AC97_SSM_VERSION, ("%d\n", uVersion), VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION);
+    Assert (uPhase == SSM_PHASE_FINAL); NOREF (uPhase);
 
     SSMR3GetU32 (pSSMHandle, &s->glob_cnt);
@@ -1635,8 +1633,5 @@
         return rc;
 
-    rc = PDMDevHlpSSMRegister (pDevIns, pDevIns->pDevReg->szDeviceName,
-                               iInstance, AC97_SSM_VERSION, sizeof(*pThis),
-                               NULL, ichac97SaveExec, NULL,
-                               NULL, ichac97LoadExec, NULL);
+    rc = PDMDevHlpSSMRegister (pDevIns, AC97_SSM_VERSION, sizeof(*pThis), ichac97SaveExec, ichac97LoadExec);
     if (RT_FAILURE (rc))
         return rc;
Index: trunk/src/VBox/Devices/Audio/DevSB16.cpp
===================================================================
--- trunk/src/VBox/Devices/Audio/DevSB16.cpp	(revision 22479)
+++ trunk/src/VBox/Devices/Audio/DevSB16.cpp	(revision 22480)
@@ -1482,5 +1482,5 @@
     SB16State *s = opaque;
 #else
-static DECLCALLBACK(int) SaveExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle)
+static DECLCALLBACK(int) sb16SaveExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle)
 {
     SB16State *s = PDMINS_2_DATA (pDevIns, SB16State *);
@@ -1550,15 +1550,12 @@
     }
 #else  /* VBOX */
-static DECLCALLBACK(int) LoadExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle,
-                                   uint32_t u32Version)
+static DECLCALLBACK(int) sb16LoadExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle,
+                                       uint32_t uVersion, uint32_t uPhase)
 {
     SB16State *s = PDMINS_2_DATA (pDevIns, SB16State *);
     QEMUFile *f = pSSMHandle;
 
-    if (u32Version != SB16_SSM_VERSION)
-    {
-        AssertMsgFailed(("u32Version=%d\n", u32Version));
-        return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
-    }
+    AssertMsgReturn(uVersion == SB16_SSM_VERSION, ("%d\n", uVersion),  VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION);
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 #endif /* VBOX */
 
@@ -1818,6 +1815,5 @@
     s->can_write = 1;
 
-    rc = PDMDevHlpSSMRegister(pDevIns, pDevIns->pDevReg->szDeviceName, iInstance, SB16_SSM_VERSION,
-                              sizeof(*s), NULL, SaveExec, NULL, NULL, LoadExec, NULL);
+    rc = PDMDevHlpSSMRegister(pDevIns, SB16_SSM_VERSION, sizeof(*s), sb16SaveExec, sb16LoadExec);
     if (RT_FAILURE(rc))
         return rc;
Index: trunk/src/VBox/Devices/Bus/DevPCI.cpp
===================================================================
--- trunk/src/VBox/Devices/Bus/DevPCI.cpp	(revision 22479)
+++ trunk/src/VBox/Devices/Bus/DevPCI.cpp	(revision 22480)
@@ -1527,7 +1527,8 @@
  * @param   pDevIns     The device instance.
  * @param   pSSMHandle  The handle to the saved state.
- * @param   u32Version  The data unit version number.
- */
-static DECLCALLBACK(int) pciR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version)
+ * @param   uVersion    The data unit version number.
+ * @param   uPhase      The data phase.
+ */
+static DECLCALLBACK(int) pciR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t uVersion, uint32_t uPhase)
 {
     PPCIGLOBALS pThis = PDMINS_2_DATA(pDevIns, PPCIGLOBALS);
@@ -1540,9 +1541,7 @@
      * Check the version.
      */
-    if (u32Version > VBOX_PCI_SAVED_STATE_VERSION)
-    {
-        AssertFailed();
+    if (uVersion > VBOX_PCI_SAVED_STATE_VERSION)
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
-    }
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 
     /*
@@ -1550,9 +1549,9 @@
      */
     SSMR3GetU32(pSSMHandle, &pThis->uConfigReg);
-    if (u32Version > 1)
+    if (uVersion > 1)
         SSMR3GetBool(pSSMHandle, &pThis->fUseIoApic);
 
     /* Load IRQ states. */
-    if (u32Version > 2)
+    if (uVersion > 2)
     {
         for (uint8_t i = 0; i < PCI_IRQ_PINS; i++)
@@ -1608,5 +1607,5 @@
         DevTmp.Int.s.uIrqPinState = ~0; /* Invalid value in case we have an older saved state to force a state change in pciSetIrq. */
         SSMR3GetMem(pSSMHandle, DevTmp.config, sizeof(DevTmp.config));
-        if (u32Version < 3)
+        if (uVersion < 3)
         {
             int32_t i32Temp;
@@ -2050,5 +2049,5 @@
         return PDMDevHlpVMSetError(pDevIns, VERR_VERSION_MISMATCH, RT_SRC_POS,
                                    N_("PCI helper version mismatch; got %#x expected %#x"),
-                                  pBus->pPciHlpR3->u32Version != PDM_PCIHLPR3_VERSION);
+                                   pBus->pPciHlpR3->u32Version != PDM_PCIHLPR3_VERSION);
 
     pBus->pPciHlpRC = pBus->pPciHlpR3->pfnGetRCHelpers(pDevIns);
@@ -2112,6 +2111,8 @@
     }
 
-    rc = SSMR3RegisterDevice(PDMDevHlpGetVM(pDevIns), pDevIns, "pci", iInstance, VBOX_PCI_SAVED_STATE_VERSION, sizeof(*pBus) + 16*128, "pgm",
-                             NULL, pciR3SaveExec, NULL, pciR3LoadPrep, pciR3LoadExec, NULL);
+    rc = PDMDevHlpSSMRegisterEx(pDevIns, VBOX_PCI_SAVED_STATE_VERSION, sizeof(*pBus) + 16*128, "pgm",
+                                NULL, NULL, NULL,
+                                NULL, pciR3SaveExec, NULL,
+                                pciR3LoadPrep, pciR3LoadExec, NULL);
     if (RT_FAILURE(rc))
         return rc;
@@ -2330,7 +2331,8 @@
  * @param   pDevIns     The device instance.
  * @param   pSSMHandle  The handle to the saved state.
- * @param   u32Version  The data unit version number.
- */
-static DECLCALLBACK(int) pcibridgeR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version)
+ * @param   uVersion    The data unit version number.
+ * @param   uPhase      The data phase.
+ */
+static DECLCALLBACK(int) pcibridgeR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t uVersion, uint32_t uPhase)
 {
     PPCIBUS     pBus  = PDMINS_2_DATA(pDevIns, PPCIBUS);
@@ -2344,9 +2346,7 @@
      * Check the version.
      */
-    if (u32Version > VBOX_PCI_SAVED_STATE_VERSION)
-    {
-        AssertFailed();
+    if (uVersion > VBOX_PCI_SAVED_STATE_VERSION)
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
-    }
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 
     /*
@@ -2597,6 +2597,8 @@
      * to make changes easier.
      */
-    rc = SSMR3RegisterDevice(PDMDevHlpGetVM(pDevIns), pDevIns, "pcibridge", iInstance, VBOX_PCI_SAVED_STATE_VERSION, sizeof(*pBus) + 16*128, "pgm",
-                             NULL, pcibridgeR3SaveExec, NULL, pcibridgeR3LoadPrep, pcibridgeR3LoadExec, NULL);
+    rc = PDMDevHlpSSMRegisterEx(pDevIns, VBOX_PCI_SAVED_STATE_VERSION, sizeof(*pBus) + 16*128, "pgm",
+                                NULL, NULL, NULL,
+                                NULL, pcibridgeR3SaveExec, NULL,
+                                pcibridgeR3LoadPrep, pcibridgeR3LoadExec, NULL);
     if (RT_FAILURE(rc))
         return rc;
Index: trunk/src/VBox/Devices/Graphics/DevVGA.cpp
===================================================================
--- trunk/src/VBox/Devices/Graphics/DevVGA.cpp	(revision 22479)
+++ trunk/src/VBox/Devices/Graphics/DevVGA.cpp	(revision 22480)
@@ -2672,12 +2672,12 @@
 #ifdef CONFIG_BOCHS_VBE
     if (!is_vbe)
-#ifndef VBOX
+# ifndef VBOX
         return -EINVAL;
-#else /* VBOX */
+# else /* VBOX */
     {
         Log(("vga_load: !is_vbe !!\n"));
         return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
     }
-#endif /* VBOX */
+# endif /* VBOX */
     qemu_get_be16s(f, &s->vbe_index);
     for(i = 0; i < VBE_DISPI_INDEX_NB; i++)
@@ -2690,12 +2690,12 @@
 #else
     if (is_vbe)
-#ifndef VBOX
+# ifndef VBOX
         return -EINVAL;
-#else /* VBOX */
+# else /* VBOX */
     {
         Log(("vga_load: is_vbe !!\n"));
         return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
     }
-#endif /* VBOX */
+# endif /* VBOX */
 #endif
 
@@ -3882,9 +3882,9 @@
         rc = PGMShwModifyPage(PDMDevHlpGetVMCPU(pThis->CTX_SUFF(pDevIns)), GCPtr, 1, X86_PTE_RW, ~(uint64_t)X86_PTE_RW);
         PDMCritSectLeave(&pThis->lock);
-        AssertMsgReturn(    rc == VINF_SUCCESS 
+        AssertMsgReturn(    rc == VINF_SUCCESS
                         /* In the SMP case the page table might be removed while we wait for the PGM lock in the trap handler. */
-                        ||  rc == VERR_PAGE_TABLE_NOT_PRESENT 
-                        ||  rc == VERR_PAGE_NOT_PRESENT, 
-                        ("PGMShwModifyPage -> GCPtr=%RGv rc=%d\n", GCPtr, rc), 
+                        ||  rc == VERR_PAGE_TABLE_NOT_PRESENT
+                        ||  rc == VERR_PAGE_NOT_PRESENT,
+                        ("PGMShwModifyPage -> GCPtr=%RGv rc=%d\n", GCPtr, rc),
                         rc);
         return VINF_SUCCESS;
@@ -5372,12 +5372,15 @@
  * @param   pDevIns     The device instance.
  * @param   pSSMHandle  The handle to the saved state.
- * @param   u32Version  The data unit version number.
+ * @param   uVersion    The data unit version number.
+ * @param   uPhase      The data phase.
  */
-static DECLCALLBACK(int) vgaR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version)
-{
-    if (vga_load(pSSMHandle, PDMINS_2_DATA(pDevIns, PVGASTATE), u32Version))
-        return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
+static DECLCALLBACK(int) vgaR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t uVersion, uint32_t uPhase)
+{
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
+    int rc = vga_load(pSSMHandle, PDMINS_2_DATA(pDevIns, PVGASTATE), uVersion);
+    if (RT_FAILURE(rc))
+        return rc;
 #ifdef VBOX_WITH_HGSMI
-    return vboxVBVALoadStateExec(pDevIns, pSSMHandle, u32Version);
+    return vboxVBVALoadStateExec(pDevIns, pSSMHandle, uVersion);
 #else
     return VINF_SUCCESS;
@@ -6050,12 +6053,12 @@
 
     /* save */
-    rc = PDMDevHlpSSMRegister(pDevIns, pDevIns->pDevReg->szDeviceName, iInstance, VGA_SAVEDSTATE_VERSION,
-                              sizeof(*pThis),
+    rc = PDMDevHlpSSMRegisterEx(pDevIns, VGA_SAVEDSTATE_VERSION, sizeof(*pThis), NULL,
+                                NULL, NULL, NULL,
 #ifdef VBOX_WITH_VIDEOHWACCEL
-                              vgaR3SavePrep, vgaR3SaveExec, NULL,
+                                vgaR3SavePrep, vgaR3SaveExec, NULL,
 #else
-                              NULL, vgaR3SaveExec, NULL,
-#endif
-                              NULL, vgaR3LoadExec, NULL);
+                                NULL, vgaR3SaveExec, NULL,
+#endif
+                                NULL, vgaR3LoadExec, NULL);
     if (RT_FAILURE(rc))
         return rc;
Index: trunk/src/VBox/Devices/Input/DevPS2.cpp
===================================================================
--- trunk/src/VBox/Devices/Input/DevPS2.cpp	(revision 22479)
+++ trunk/src/VBox/Devices/Input/DevPS2.cpp	(revision 22480)
@@ -1428,9 +1428,11 @@
  * @param   pDevIns     The device instance.
  * @param   pSSMHandle  The handle to the saved state.
- * @param   u32Version  The data unit version number.
+ * @param   uVersion    The data unit version number.
+ * @param   uPhase      The data phase.
  */
-static DECLCALLBACK(int) kbdLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version)
-{
-    return kbd_load(pSSMHandle, PDMINS_2_DATA(pDevIns, KBDState *), u32Version);
+static DECLCALLBACK(int) kbdLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t uVersion, uint32_t uPhase)
+{
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
+    return kbd_load(pSSMHandle, PDMINS_2_DATA(pDevIns, KBDState *), uVersion);
 }
 
@@ -1670,4 +1672,5 @@
 }
 
+
 /**
  * @copydoc FNPDMDEVRELOCATE
@@ -1679,4 +1682,5 @@
 }
 
+
 /**
  * Destruct a device instance for a VM.
@@ -1692,4 +1696,5 @@
     return VINF_SUCCESS;
 }
+
 
 /**
@@ -1776,7 +1781,5 @@
             return rc;
     }
-    rc = PDMDevHlpSSMRegister(pDevIns, g_DevicePS2KeyboardMouse.szDeviceName, iInstance, PCKBD_SAVED_STATE_VERSION, sizeof(*pThis),
-                              NULL, kbdSaveExec, NULL,
-                              NULL, kbdLoadExec, NULL);
+    rc = PDMDevHlpSSMRegister(pDevIns, PCKBD_SAVED_STATE_VERSION, sizeof(*pThis), kbdSaveExec, kbdLoadExec);
     if (RT_FAILURE(rc))
         return rc;
Index: trunk/src/VBox/Devices/Network/DevE1000.cpp
===================================================================
--- trunk/src/VBox/Devices/Network/DevE1000.cpp	(revision 22479)
+++ trunk/src/VBox/Devices/Network/DevE1000.cpp	(revision 22480)
@@ -4475,15 +4475,17 @@
  * @param   pDevIns     The device instance.
  * @param   pSSMHandle  The handle to the saved state.
- * @param   u32Version  The data unit version number.
- */
-static DECLCALLBACK(int) e1kLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version)
-{
-    if (u32Version != E1K_SAVEDSTATE_VERSION)
+ * @param   uVersion    The data unit version number.
+ * @param   uPhase      The data phase.
+ */
+static DECLCALLBACK(int) e1kLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t uVersion, uint32_t uPhase)
+{
+    if (uVersion != E1K_SAVEDSTATE_VERSION)
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 
     E1KSTATE* pState = PDMINS_2_DATA(pDevIns, E1KSTATE*);
     SSMR3GetMem(pSSMHandle, &pState->auRegs, sizeof(pState->auRegs));
     SSMR3GetBool(pSSMHandle, &pState->fIntRaised);
-    /** @todo: PHY should be made a separate device with its own versioning */
+    /** @todo: PHY could be made a separate device with its own versioning */
     Phy::loadState(pSSMHandle, &pState->phy);
     SSMR3GetU32(pSSMHandle, &pState->uSelectedReg);
@@ -4760,8 +4762,8 @@
     Phy::setLinkStatus(&pState->phy, pState->fCableConnected);
 
-    rc = PDMDevHlpSSMRegister(pDevIns, pDevIns->pDevReg->szDeviceName, iInstance,
-                              E1K_SAVEDSTATE_VERSION, sizeof(E1KSTATE),
-                              e1kSavePrep, e1kSaveExec, NULL,
-                              e1kLoadPrep, e1kLoadExec, NULL);
+    rc = PDMDevHlpSSMRegisterEx(pDevIns, E1K_SAVEDSTATE_VERSION, sizeof(E1KSTATE), NULL,
+                                NULL, NULL, NULL,
+                                e1kSavePrep, e1kSaveExec, NULL,
+                                e1kLoadPrep, e1kLoadExec, NULL);
     if (RT_FAILURE(rc))
         return rc;
Index: trunk/src/VBox/Devices/Network/DevPCNet.cpp
===================================================================
--- trunk/src/VBox/Devices/Network/DevPCNet.cpp	(revision 22479)
+++ trunk/src/VBox/Devices/Network/DevPCNet.cpp	(revision 22480)
@@ -4330,13 +4330,15 @@
  * @param   pDevIns     The device instance.
  * @param   pSSMHandle  The handle to the saved state.
- * @param   u32Version  The data unit version number.
- */
-static DECLCALLBACK(int) pcnetLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version)
+ * @param   uVersion  The data unit version number.
+ * @param   uPhase      The data phase.
+ */
+static DECLCALLBACK(int) pcnetLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t uVersion, uint32_t uPhase)
 {
     PCNetState *pThis = PDMINS_2_DATA(pDevIns, PCNetState *);
     RTMAC       Mac;
-    if (   SSM_VERSION_MAJOR_CHANGED(u32Version, PCNET_SAVEDSTATE_VERSION)
-        || SSM_VERSION_MINOR(u32Version) < 7)
+    if (   SSM_VERSION_MAJOR_CHANGED(uVersion, PCNET_SAVEDSTATE_VERSION)
+        || SSM_VERSION_MINOR(uVersion) < 7)
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 
     /* restore data */
@@ -4345,6 +4347,6 @@
     SSMR3GetS32(pSSMHandle, &pThis->iISR);
     SSMR3GetU32(pSSMHandle, &pThis->u32Lnkst);
-    if (   SSM_VERSION_MAJOR(u32Version) >  0
-        || SSM_VERSION_MINOR(u32Version) >= 9)
+    if (   SSM_VERSION_MAJOR(uVersion) >  0
+        || SSM_VERSION_MINOR(uVersion) >= 9)
     {
         SSMR3GetBool(pSSMHandle, &pThis->fPrivIfEnabled);
@@ -4352,6 +4354,6 @@
             LogRel(("PCNet#%d: Enabling private interface\n", PCNET_INST_NR));
     }
-    if (   SSM_VERSION_MAJOR(u32Version) >  0
-        || SSM_VERSION_MINOR(u32Version) >= 10)
+    if (   SSM_VERSION_MAJOR(uVersion) >  0
+        || SSM_VERSION_MINOR(uVersion) >= 10)
     {
         SSMR3GetBool(pSSMHandle, &pThis->fSignalRxMiss);
@@ -4375,6 +4377,6 @@
     if (pThis->fAm79C973)
     {
-        if (   SSM_VERSION_MAJOR(u32Version) >  0
-            || SSM_VERSION_MINOR(u32Version) >= 8)
+        if (   SSM_VERSION_MAJOR(uVersion) >  0
+            || SSM_VERSION_MINOR(uVersion) >= 8)
             TMR3TimerLoad(pThis->CTX_SUFF(pTimerSoftInt), pSSMHandle);
     }
@@ -5087,8 +5089,8 @@
         return rc;
 
-    rc = PDMDevHlpSSMRegister(pDevIns, pDevIns->pDevReg->szDeviceName, iInstance,
-                              PCNET_SAVEDSTATE_VERSION, sizeof(*pThis),
-                              pcnetSavePrep, pcnetSaveExec, NULL,
-                              pcnetLoadPrep, pcnetLoadExec, NULL);
+    rc = PDMDevHlpSSMRegisterEx(pDevIns, PCNET_SAVEDSTATE_VERSION, sizeof(*pThis), NULL,
+                                NULL, NULL, NULL,
+                                pcnetSavePrep, pcnetSaveExec, NULL,
+                                pcnetLoadPrep, pcnetLoadExec, NULL);
     if (RT_FAILURE(rc))
         return rc;
Index: trunk/src/VBox/Devices/Network/DrvNAT.cpp
===================================================================
--- trunk/src/VBox/Devices/Network/DrvNAT.cpp	(revision 22479)
+++ trunk/src/VBox/Devices/Network/DrvNAT.cpp	(revision 22480)
@@ -994,7 +994,5 @@
              * engine after we loaded a guest state.
              */
-            rc2 = PDMDrvHlpSSMRegister(pDrvIns, pDrvIns->pDrvReg->szDriverName,
-                                       pDrvIns->iInstance, 0, 0,
-                                       NULL, NULL, NULL, NULL, NULL, drvNATLoadDone);
+            rc2 = PDMDrvHlpSSMRegisterLoadDone(pDrvIns, drvNATLoadDone);
             AssertRC(rc2);
             rc = RTReqCreateQueue(&pThis->pSlirpReqQueue);
Index: trunk/src/VBox/Devices/PC/DevACPI.cpp
===================================================================
--- trunk/src/VBox/Devices/PC/DevACPI.cpp	(revision 22479)
+++ trunk/src/VBox/Devices/PC/DevACPI.cpp	(revision 22480)
@@ -1774,8 +1774,9 @@
 
 static DECLCALLBACK(int) acpi_load_state(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle,
-                                         uint32_t u32Version)
+                                         uint32_t uVersion, uint32_t uPhase)
 {
     ACPIState *s = PDMINS_2_DATA(pDevIns, ACPIState *);
-    int rc;
+
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 
     /*
@@ -1783,9 +1784,9 @@
      * after state successfully loaded.
      */
-    rc = acpiUnregisterPmHandlers(s);
+    int rc = acpiUnregisterPmHandlers(s);
     if (RT_FAILURE(rc))
         return rc;
 
-    switch (u32Version)
+    switch (uVersion)
     {
         case 4:
@@ -2182,6 +2183,5 @@
                                    acpiPciConfigWrite, &s->pfnAcpiPciConfigWrite);
 
-    rc = PDMDevHlpSSMRegister(pDevIns, pDevIns->pDevReg->szDeviceName, iInstance, 5, sizeof(*s),
-                              NULL, acpi_save_state, NULL, NULL, acpi_load_state,  NULL);
+    rc = PDMDevHlpSSMRegister(pDevIns, 5, sizeof(*s), acpi_save_state, acpi_load_state);
     if (RT_FAILURE(rc))
         return rc;
Index: trunk/src/VBox/Devices/PC/DevAPIC.cpp
===================================================================
--- trunk/src/VBox/Devices/PC/DevAPIC.cpp	(revision 22479)
+++ trunk/src/VBox/Devices/PC/DevAPIC.cpp	(revision 22480)
@@ -2357,10 +2357,12 @@
  * @copydoc FNSSMDEVLOADEXEC
  */
-static DECLCALLBACK(int) apicLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version)
+static DECLCALLBACK(int) apicLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t uVersion, uint32_t uPhase)
 {
     APICDeviceInfo *dev = PDMINS_2_DATA(pDevIns, APICDeviceInfo *);
-    /* load all APICs data, @todo: is it correct? */
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
+
+    /* load all APICs data */ /** @todo: is it correct? */
     foreach_apic(dev, 0xffffffff,
-                 if (apic_load(pSSMHandle, apic, u32Version))
+                 if (apic_load(pSSMHandle, apic, uVersion))
                  {
                       AssertFailed();
@@ -2640,6 +2642,5 @@
      * Saved state.
      */
-    rc = PDMDevHlpSSMRegister(pDevIns, pDevIns->pDevReg->szDeviceName, iInstance, 2 /* version */,
-                              sizeof(*pThis), NULL, apicSaveExec, NULL, NULL, apicLoadExec, NULL);
+    rc = PDMDevHlpSSMRegister(pDevIns, 2 /* version */, sizeof(*pThis), apicSaveExec, apicLoadExec);
     if (RT_FAILURE(rc))
         return rc;
@@ -2807,12 +2808,13 @@
  * @copydoc FNSSMDEVLOADEXEC
  */
-static DECLCALLBACK(int) ioapicLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version)
+static DECLCALLBACK(int) ioapicLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t uVersion, uint32_t uPhase)
 {
     IOAPICState *s = PDMINS_2_DATA(pDevIns, IOAPICState *);
 
-    if (ioapic_load(pSSMHandle, s, u32Version)) {
+    if (ioapic_load(pSSMHandle, s, uVersion)) {
         AssertFailed();
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
     }
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 
     return VINF_SUCCESS;
@@ -2919,6 +2921,5 @@
     }
 
-    rc = PDMDevHlpSSMRegister(pDevIns, pDevIns->pDevReg->szDeviceName, iInstance, 1 /* version */,
-                              sizeof(*s), NULL, ioapicSaveExec, NULL, NULL, ioapicLoadExec, NULL);
+    rc = PDMDevHlpSSMRegister(pDevIns, 1 /* version */, sizeof(*s), ioapicSaveExec, ioapicLoadExec);
     if (RT_FAILURE(rc))
         return rc;
Index: trunk/src/VBox/Devices/PC/DevDMA.cpp
===================================================================
--- trunk/src/VBox/Devices/PC/DevDMA.cpp	(revision 22479)
+++ trunk/src/VBox/Devices/PC/DevDMA.cpp	(revision 22480)
@@ -846,5 +846,5 @@
 }
 
-static void DMAReset (PPDMDEVINS pDevIns)
+static void dmaReset (PPDMDEVINS pDevIns)
 {
     DMAState *s = PDMINS_2_DATA (pDevIns, DMAState *);
@@ -853,5 +853,5 @@
 }
 
-static DECLCALLBACK(int) SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle)
+static DECLCALLBACK(int) dmaSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle)
 {
     DMAState *s = PDMINS_2_DATA (pDevIns, DMAState *);
@@ -861,17 +861,16 @@
 }
 
-static DECLCALLBACK(int) LoadExec (PPDMDEVINS pDevIns,
-                                   PSSMHANDLE pSSMHandle,
-                                   uint32_t u32Version)
+static DECLCALLBACK(int) dmaLoadExec (PPDMDEVINS pDevIns,
+                                      PSSMHANDLE pSSMHandle,
+                                      uint32_t uVersion,
+                                      uint32_t uPhase)
 {
     DMAState *s = PDMINS_2_DATA (pDevIns, DMAState *);
 
-    if (u32Version != 1) {
-        AssertFailed ();
-        return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
-    }
-
-    dma_load (pSSMHandle, &s->dma_controllers[0], u32Version);
-    return dma_load (pSSMHandle, &s->dma_controllers[1], u32Version);
+    AssertMsgReturn (uVersion == 1, ("%d\n", uVersion), VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION);
+    Assert (uPhase == SSM_PHASE_FINAL);
+
+    dma_load (pSSMHandle, &s->dma_controllers[0], uVersion);
+    return dma_load (pSSMHandle, &s->dma_controllers[1], uVersion);
 }
 
@@ -889,5 +888,5 @@
  *                      iInstance it's expected to be used a bit in this function.
  */
-static DECLCALLBACK(int) DMAConstruct(PPDMDEVINS pDevIns,
+static DECLCALLBACK(int) dmaConstruct(PPDMDEVINS pDevIns,
                                       int iInstance,
                                       PCFGMNODE pCfgHandle)
@@ -932,6 +931,5 @@
     }
 
-    rc = PDMDevHlpSSMRegister (pDevIns, pDevIns->pDevReg->szDeviceName, iInstance, 1, sizeof (*s),
-                               NULL, SaveExec, NULL, NULL, LoadExec, NULL);
+    rc = PDMDevHlpSSMRegister (pDevIns, 1 /*uVersion*/, sizeof (*s), dmaSaveExec, dmaLoadExec);
     if (RT_FAILURE(rc))
         return rc;
@@ -964,5 +962,5 @@
     sizeof(DMAState),
     /* pfnConstruct */
-    DMAConstruct,
+    dmaConstruct,
     /* pfnDestruct */
     NULL,
@@ -974,5 +972,5 @@
     NULL,
     /* pfnReset */
-    DMAReset,
+    dmaReset,
     /* pfnSuspend */
     NULL,
Index: trunk/src/VBox/Devices/PC/DevPIC.cpp
===================================================================
--- trunk/src/VBox/Devices/PC/DevPIC.cpp	(revision 22479)
+++ trunk/src/VBox/Devices/PC/DevPIC.cpp	(revision 22480)
@@ -828,12 +828,14 @@
  * @param   pDevIns     The device instance.
  * @param   pSSMHandle  The handle to the saved state.
- * @param   u32Version  The data unit version number.
- */
-static DECLCALLBACK(int) picLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version)
+ * @param   uVersion    The data unit version number.
+ * @param   uPhase      The data phase.
+ */
+static DECLCALLBACK(int) picLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t uVersion, uint32_t uPhase)
 {
     PDEVPIC pThis = PDMINS_2_DATA(pDevIns, PDEVPIC);
 
-    if (u32Version != 1)
+    if (uVersion != 1)
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 
     for (unsigned i = 0; i < RT_ELEMENTS(pThis->aPics); i++)
@@ -1041,7 +1043,5 @@
     }
 
-    rc = PDMDevHlpSSMRegister(pDevIns, pDevIns->pDevReg->szDeviceName, iInstance, 1 /* version */, sizeof(*pThis),
-                              NULL, picSaveExec, NULL,
-                              NULL, picLoadExec, NULL);
+    rc = PDMDevHlpSSMRegister(pDevIns, 1 /* uVersion */, sizeof(*pThis), picSaveExec, picLoadExec);
     if (RT_FAILURE(rc))
         return rc;
Index: trunk/src/VBox/Devices/PC/DevPit-i8254.cpp
===================================================================
--- trunk/src/VBox/Devices/PC/DevPit-i8254.cpp	(revision 22479)
+++ trunk/src/VBox/Devices/PC/DevPit-i8254.cpp	(revision 22480)
@@ -759,15 +759,16 @@
  * @param   pDevIns     The device instance.
  * @param   pSSMHandle  The handle to the saved state.
- * @param   u32Version  The data unit version number.
- */
-static DECLCALLBACK(int) pitLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version)
+ * @param   uVersion    The data unit version number.
+ * @param   uPhase      The data phase.
+ */
+static DECLCALLBACK(int) pitLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t uVersion, uint32_t uPhase)
 {
     PITState *pThis = PDMINS_2_DATA(pDevIns, PITState *);
-    unsigned i;
-
-    if (u32Version != PIT_SAVED_STATE_VERSION)
+
+    if (uVersion != PIT_SAVED_STATE_VERSION)
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
-
-    for (i = 0; i < RT_ELEMENTS(pThis->channels); i++)
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
+
+    for (unsigned i = 0; i < RT_ELEMENTS(pThis->channels); i++)
     {
         PITChannelState *s = &pThis->channels[i];
@@ -1034,7 +1035,5 @@
     }
 
-    rc = PDMDevHlpSSMRegister(pDevIns, pDevIns->pDevReg->szDeviceName, iInstance, PIT_SAVED_STATE_VERSION, sizeof(*pThis),
-                                          NULL, pitSaveExec, NULL,
-                                          NULL, pitLoadExec, NULL);
+    rc = PDMDevHlpSSMRegister(pDevIns, PIT_SAVED_STATE_VERSION, sizeof(*pThis), pitSaveExec, pitLoadExec);
     if (RT_FAILURE(rc))
         return rc;
Index: trunk/src/VBox/Devices/PC/DevRTC.cpp
===================================================================
--- trunk/src/VBox/Devices/PC/DevRTC.cpp	(revision 22479)
+++ trunk/src/VBox/Devices/PC/DevRTC.cpp	(revision 22480)
@@ -628,12 +628,14 @@
  * @param   pDevIns     The device instance.
  * @param   pSSMHandle  The handle to the saved state.
- * @param   u32Version  The data unit version number.
- */
-static DECLCALLBACK(int) rtcLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version)
+ * @param   uVersion    The data unit version number.
+ * @param   uPhase      The data phase.
+ */
+static DECLCALLBACK(int) rtcLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t uVersion, uint32_t uPhase)
 {
     RTCState *pThis = PDMINS_2_DATA(pDevIns, RTCState *);
 
-    if (u32Version != 1)
+    if (uVersion != 1)
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 
     SSMR3GetMem(pSSMHandle, pThis->cmos_data, 128);
@@ -916,7 +918,5 @@
     }
 
-    rc = PDMDevHlpSSMRegister(pDevIns, pDevIns->pDevReg->szDeviceName, iInstance, 1 /* version */, sizeof(*pThis),
-                              NULL, rtcSaveExec, NULL,
-                              NULL, rtcLoadExec, NULL);
+    rc = PDMDevHlpSSMRegister(pDevIns, 1 /* version */, sizeof(*pThis), rtcSaveExec, rtcLoadExec);
     if (RT_FAILURE(rc))
         return rc;
Index: trunk/src/VBox/Devices/Parallel/DevParallel.cpp
===================================================================
--- trunk/src/VBox/Devices/Parallel/DevParallel.cpp	(revision 22479)
+++ trunk/src/VBox/Devices/Parallel/DevParallel.cpp	(revision 22480)
@@ -587,19 +587,16 @@
  * @param   pDevIns     The device instance.
  * @param   pSSMHandle  The handle to the saved state.
- * @param   u32Version  The data unit version number.
+ * @param   uVersion    The data unit version number.
+ * @param   uPhase      The data phase.
  */
 static DECLCALLBACK(int) parallelLoadExec(PPDMDEVINS pDevIns,
                                           PSSMHANDLE pSSMHandle,
-                                          uint32_t u32Version)
-{
-    int          rc;
-    uint32_t     u32;
+                                          uint32_t uVersion,
+                                          uint32_t uPhase)
+{
     ParallelState *pThis = PDMINS_2_DATA(pDevIns, ParallelState *);
 
-    if (u32Version != PARALLEL_SAVED_STATE_VERSION)
-    {
-        AssertLogRelMsgFailed(("u32Version=%d\n", u32Version));
-        return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
-    }
+    AssertMsgReturn(uVersion == PARALLEL_SAVED_STATE_VERSION, ("%d\n", uVersion), VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION);
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 
     SSMR3GetU8(pSSMHandle, &pThis->reg_data);
@@ -609,13 +606,9 @@
     SSMR3GetU32(pSSMHandle, &pThis->base);
 
-    rc = SSMR3GetU32(pSSMHandle, &u32);
+    uint32_t u32;
+    int rc = SSMR3GetU32(pSSMHandle, &u32);
     if (RT_FAILURE(rc))
         return rc;
-
-    if (u32 != ~0U)
-    {
-        AssertLogRelMsgFailed(("u32=%#x expected ~0\n", u32));
-        return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
-    }
+    AssertMsgReturn(u32 == ~0U, ("%#x\n", u32), VERR_SSM_DATA_UNIT_FORMAT_CHANGED);
 
     /* not necessary... but it doesn't harm. */
@@ -809,17 +802,5 @@
     }
 
-    rc = PDMDevHlpSSMRegister(
-        pDevIns,                        /* pDevIns */
-        pDevIns->pDevReg->szDeviceName, /* pszName */
-        iInstance,                      /* u32Instance */
-        PARALLEL_SAVED_STATE_VERSION,   /* u32Version */
-        sizeof (*pThis),                /* cbGuess */
-        NULL,                           /* pfnSavePrep */
-        parallelSaveExec,               /* pfnSaveExec */
-        NULL,                           /* pfnSaveDone */
-        NULL,                           /* pfnLoadPrep */
-        parallelLoadExec,               /* pfnLoadExec */
-        NULL                            /* pfnLoadDone */
-        );
+    rc = PDMDevHlpSSMRegister(pDevIns, PARALLEL_SAVED_STATE_VERSION, sizeof(*pThis), parallelSaveExec, parallelLoadExec);
     if (RT_FAILURE(rc))
         return rc;
Index: trunk/src/VBox/Devices/Serial/DevSerial.cpp
===================================================================
--- trunk/src/VBox/Devices/Serial/DevSerial.cpp	(revision 22479)
+++ trunk/src/VBox/Devices/Serial/DevSerial.cpp	(revision 22480)
@@ -598,19 +598,16 @@
  * @param   pDevIns     The device instance.
  * @param   pSSMHandle  The handle to the saved state.
- * @param   u32Version  The data unit version number.
+ * @param   uVersion    The data unit version number.
+ * @param   uPhase      The data phase.
  */
 static DECLCALLBACK(int) serialLoadExec(PPDMDEVINS pDevIns,
                                         PSSMHANDLE pSSMHandle,
-                                        uint32_t u32Version)
-{
-    int          rc;
-    uint32_t     u32;
+                                        uint32_t uVersion,
+                                        uint32_t uPhase)
+{
     SerialState *pThis = PDMINS_2_DATA(pDevIns, SerialState *);
 
-    if (u32Version != SERIAL_SAVED_STATE_VERSION)
-    {
-        AssertMsgFailed(("u32Version=%d\n", u32Version));
-        return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
-    }
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
+    AssertMsgReturn(uVersion == SERIAL_SAVED_STATE_VERSION, ("%d\n", uVersion), VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION);
 
     SSMR3GetU16(pSSMHandle, &pThis->divider);
@@ -628,15 +625,9 @@
     SSMR3GetBool(pSSMHandle, &pThis->msr_changed);
 
-    rc = SSMR3GetU32(pSSMHandle, &u32);
+    uint32_t u32;
+    int rc = SSMR3GetU32(pSSMHandle, &u32);
     if (RT_FAILURE(rc))
         return rc;
-
-    if (u32 != ~0U)
-    {
-        AssertLogRelMsgFailed(("u32=%#x expected ~0\n", u32));
-        return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
-    }
-    /* Be careful with pointers in the structure; they are not preserved
-     * in the saved state. */
+    AssertMsgReturn(u32 == ~0U, ("%#x\n", u32), VERR_SSM_DATA_UNIT_FORMAT_CHANGED);
 
     if (pThis->lsr & UART_LSR_DR)
@@ -893,17 +884,5 @@
      * Saved state.
      */
-    rc = PDMDevHlpSSMRegister(
-        pDevIns,                /* pDevIns */
-        pDevIns->pDevReg->szDeviceName, /* pszName */
-        iInstance,              /* u32Instance */
-        SERIAL_SAVED_STATE_VERSION, /* u32Version */
-        sizeof (*pThis),        /* cbGuess */
-        NULL,                   /* pfnSavePrep */
-        serialSaveExec,         /* pfnSaveExec */
-        NULL,                   /* pfnSaveDone */
-        NULL,                   /* pfnLoadPrep */
-        serialLoadExec,         /* pfnLoadExec */
-        NULL                    /* pfnLoadDone */
-        );
+    rc = PDMDevHlpSSMRegister(pDevIns, SERIAL_SAVED_STATE_VERSION, sizeof (*pThis), serialSaveExec, serialLoadExec);
     if (RT_FAILURE(rc))
         return rc;
Index: trunk/src/VBox/Devices/Storage/DevAHCI.cpp
===================================================================
--- trunk/src/VBox/Devices/Storage/DevAHCI.cpp	(revision 22479)
+++ trunk/src/VBox/Devices/Storage/DevAHCI.cpp	(revision 22480)
@@ -5854,15 +5854,16 @@
  * @param   pDevIns     The device instance.
  * @param   pSSMHandle  The handle to the saved state.
- * @param   u32Version  The data unit version number.
- */
-static DECLCALLBACK(int) ahciLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version)
+ * @param   uVersion  The data unit version number.
+ * @param   uPhase      The data phase.
+ */
+static DECLCALLBACK(int) ahciLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t uVersion, uint32_t uPhase)
 {
     PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI);
     uint32_t u32;
     uint32_t i;
-    int rc = VINF_SUCCESS;
-
-    if (u32Version != AHCI_SAVED_STATE_VERSION)
+
+    if (uVersion != AHCI_SAVED_STATE_VERSION)
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 
     /* Restore data. */
@@ -5928,20 +5929,13 @@
     for (i = 0; i < RT_ELEMENTS(pAhci->aCts); i++)
     {
-        int rc;
-
-        rc = ataControllerLoadExec(&pAhci->aCts[i], pSSMHandle);
+        int rc = ataControllerLoadExec(&pAhci->aCts[i], pSSMHandle);
         if (RT_FAILURE(rc))
             return rc;
     }
 
-    rc = SSMR3GetU32(pSSMHandle, &u32);
+    int rc = SSMR3GetU32(pSSMHandle, &u32);
     if (RT_FAILURE(rc))
         return rc;
-    if (u32 != ~0U)
-    {
-        AssertMsgFailed(("u32=%#x expected ~0\n", u32));
-        rc = VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
-        return rc;
-    }
+    AssertMsgReturn(u32 == ~0U, ("%#x\n", u32), VERR_SSM_DATA_UNIT_FORMAT_CHANGED);
 
     return VINF_SUCCESS;
@@ -6568,8 +6562,8 @@
     }
 
-    rc = PDMDevHlpSSMRegister(pDevIns, pDevIns->pDevReg->szDeviceName, iInstance,
-                              AHCI_SAVED_STATE_VERSION, sizeof(*pThis)+cbTotalBufferSize,
-                              ahciSavePrep, ahciSaveExec, NULL,
-                              ahciLoadPrep, ahciLoadExec, NULL);
+    rc = PDMDevHlpSSMRegisterEx(pDevIns, AHCI_SAVED_STATE_VERSION, sizeof(*pThis)+cbTotalBufferSize, NULL,
+                                NULL, NULL, NULL,
+                                ahciSavePrep, ahciSaveExec, NULL,
+                                ahciLoadPrep, ahciLoadExec, NULL);
     if (RT_FAILURE(rc))
         return rc;
Index: trunk/src/VBox/Devices/Storage/DevATA.cpp
===================================================================
--- trunk/src/VBox/Devices/Storage/DevATA.cpp	(revision 22479)
+++ trunk/src/VBox/Devices/Storage/DevATA.cpp	(revision 22480)
@@ -6105,7 +6105,8 @@
  * @param   pDevIns     The device instance.
  * @param   pSSMHandle  The handle to the saved state.
- * @param   u32Version  The data unit version number.
+ * @param   uVersion  The data unit version number.
+ * @param   uPhase      The data phase.
  */
-static DECLCALLBACK(int) ataLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version)
+static DECLCALLBACK(int) ataLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t uVersion, uint32_t uPhase)
 {
     PCIATAState    *pThis = PDMINS_2_DATA(pDevIns, PCIATAState *);
@@ -6113,12 +6114,13 @@
     uint32_t        u32;
 
-    if (   u32Version != ATA_SAVED_STATE_VERSION
-        && u32Version != ATA_SAVED_STATE_VERSION_WITHOUT_FULL_SENSE
-        && u32Version != ATA_SAVED_STATE_VERSION_WITHOUT_EVENT_STATUS
-        && u32Version != ATA_SAVED_STATE_VERSION_WITH_BOOL_TYPE)
-    {
-        AssertMsgFailed(("u32Version=%d\n", u32Version));
+    if (   uVersion != ATA_SAVED_STATE_VERSION
+        && uVersion != ATA_SAVED_STATE_VERSION_WITHOUT_FULL_SENSE
+        && uVersion != ATA_SAVED_STATE_VERSION_WITHOUT_EVENT_STATUS
+        && uVersion != ATA_SAVED_STATE_VERSION_WITH_BOOL_TYPE)
+    {
+        AssertMsgFailed(("uVersion=%d\n", uVersion));
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
     }
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 
     /*
@@ -6190,5 +6192,5 @@
             SSMR3GetU32(pSSMHandle, &pThis->aCts[i].aIfs[j].cbATAPISector);
             SSMR3GetMem(pSSMHandle, &pThis->aCts[i].aIfs[j].aATAPICmd, sizeof(pThis->aCts[i].aIfs[j].aATAPICmd));
-            if (u32Version > ATA_SAVED_STATE_VERSION_WITHOUT_FULL_SENSE)
+            if (uVersion > ATA_SAVED_STATE_VERSION_WITHOUT_FULL_SENSE)
             {
                 SSMR3GetMem(pSSMHandle, pThis->aCts[i].aIfs[j].abATAPISense, sizeof(pThis->aCts[i].aIfs[j].abATAPISense));
@@ -6207,5 +6209,5 @@
             /** @todo triple-check this hack after passthrough is working */
             SSMR3GetU8(pSSMHandle, &pThis->aCts[i].aIfs[j].cNotifiedMediaChange);
-            if (u32Version > ATA_SAVED_STATE_VERSION_WITHOUT_EVENT_STATUS)
+            if (uVersion > ATA_SAVED_STATE_VERSION_WITHOUT_EVENT_STATUS)
                 SSMR3GetU32(pSSMHandle, (uint32_t*)&pThis->aCts[i].aIfs[j].MediaEventStatus);
             else
@@ -6692,8 +6694,8 @@
     }
 
-    rc = PDMDevHlpSSMRegister(pDevIns, pDevIns->pDevReg->szDeviceName, iInstance,
-                              ATA_SAVED_STATE_VERSION, sizeof(*pThis) + cbTotalBuffer,
-                              ataSaveLoadPrep, ataSaveExec, NULL,
-                              ataSaveLoadPrep, ataLoadExec, NULL);
+    rc = PDMDevHlpSSMRegisterEx(pDevIns, ATA_SAVED_STATE_VERSION, sizeof(*pThis) + cbTotalBuffer, NULL,
+                                NULL, NULL, NULL,
+                                ataSaveLoadPrep, ataSaveExec, NULL,
+                                ataSaveLoadPrep, ataLoadExec, NULL);
     if (RT_FAILURE(rc))
         return PDMDEV_SET_ERROR(pDevIns, rc, N_("PIIX3 cannot register save state handlers"));
Index: trunk/src/VBox/Devices/Storage/DevBusLogic.cpp
===================================================================
--- trunk/src/VBox/Devices/Storage/DevBusLogic.cpp	(revision 22479)
+++ trunk/src/VBox/Devices/Storage/DevBusLogic.cpp	(revision 22480)
@@ -2365,12 +2365,12 @@
 }
 
-static DECLCALLBACK(int) buslogicLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version)
+static DECLCALLBACK(int) buslogicLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase)
 {
     PBUSLOGIC pBusLogic = PDMINS_2_DATA(pDevIns, PBUSLOGIC);
-    int rc = VINF_SUCCESS;
 
     /* We support saved states only from this and older versions. */
-    if (u32Version > BUSLOGIC_SAVED_STATE_MINOR_VERSION)
+    if (uVersion > BUSLOGIC_SAVED_STATE_MINOR_VERSION)
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 
     /* Every device first. */
@@ -2432,12 +2432,8 @@
 
     uint32_t u32;
-    SSMR3GetU32(pSSM, &u32);
+    int rc = SSMR3GetU32(pSSM, &u32);
     if (RT_FAILURE(rc))
         return rc;
-    if (u32 != ~0U)
-    {
-        AssertMsgFailed(("u32=%#x expected ~0\n", u32));
-        return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
-    }
+    AssertMsgReturn(u32 == ~0U, ("%#x\n", u32), VERR_SSM_DATA_UNIT_FORMAT_CHANGED);
 
     return VINF_SUCCESS;
@@ -2816,8 +2812,8 @@
     }
 
-    rc = PDMDevHlpSSMRegister(pDevIns, pDevIns->pDevReg->szDeviceName, iInstance,
-                              BUSLOGIC_SAVED_STATE_MINOR_VERSION, sizeof(*pThis),
-                              buslogicSaveLoadPrep, buslogicSaveExec, NULL,
-                              buslogicSaveLoadPrep, buslogicLoadExec, NULL);
+    rc = PDMDevHlpSSMRegisterEx(pDevIns, BUSLOGIC_SAVED_STATE_MINOR_VERSION, sizeof(*pThis), NULL,
+                                NULL, NULL, NULL,
+                                buslogicSaveLoadPrep, buslogicSaveExec, NULL,
+                                buslogicSaveLoadPrep, buslogicLoadExec, NULL);
     if (RT_FAILURE(rc))
         return PDMDEV_SET_ERROR(pDevIns, rc, N_("BusLogic cannot register save state handlers"));
Index: trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp
===================================================================
--- trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp	(revision 22479)
+++ trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp	(revision 22480)
@@ -4896,12 +4896,12 @@
 }
 
-static DECLCALLBACK(int) lsilogicLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version)
+static DECLCALLBACK(int) lsilogicLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase)
 {
     PLSILOGICSCSI pLsiLogic = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI);
-    int rc = VINF_SUCCESS;
 
     /* We support saved states only from this and older versions. */
-    if (u32Version > LSILOGIC_SAVED_STATE_MINOR_VERSION)
+    if (uVersion > LSILOGIC_SAVED_STATE_MINOR_VERSION)
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 
     /* Every device first. */
@@ -4970,12 +4970,8 @@
 
     uint32_t u32;
-    SSMR3GetU32(pSSM, &u32);
+    int rc = SSMR3GetU32(pSSM, &u32);
     if (RT_FAILURE(rc))
         return rc;
-    if (u32 != ~0U)
-    {
-        AssertMsgFailed(("u32=%#x expected ~0\n", u32));
-        return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
-    }
+    AssertMsgReturn(u32 == ~0U, ("%#x\n", u32), VERR_SSM_DATA_UNIT_FORMAT_CHANGED);
 
     return VINF_SUCCESS;
@@ -5420,8 +5416,8 @@
 
     /* Register save state handlers. */
-    rc = PDMDevHlpSSMRegister(pDevIns, pDevIns->pDevReg->szDeviceName, iInstance,
-                              LSILOGIC_SAVED_STATE_MINOR_VERSION, sizeof(*pThis),
-                              lsilogicSaveLoadPrep, lsilogicSaveExec, NULL,
-                              lsilogicSaveLoadPrep, lsilogicLoadExec, NULL);
+    rc = PDMDevHlpSSMRegisterEx(pDevIns, LSILOGIC_SAVED_STATE_MINOR_VERSION, sizeof(*pThis), NULL,
+                                NULL, NULL, NULL,
+                                lsilogicSaveLoadPrep, lsilogicSaveExec, NULL,
+                                lsilogicSaveLoadPrep, lsilogicLoadExec, NULL);
     if (RT_FAILURE(rc))
         return PDMDEV_SET_ERROR(pDevIns, rc, N_("LsiLogic cannot register save state handlers"));
Index: trunk/src/VBox/Devices/Storage/DrvHostBase.cpp
===================================================================
--- trunk/src/VBox/Devices/Storage/DrvHostBase.cpp	(revision 22479)
+++ trunk/src/VBox/Devices/Storage/DrvHostBase.cpp	(revision 22480)
@@ -2045,5 +2045,5 @@
      * Check that there are no drivers below us.
      */
-    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER, 
+    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
                     ("Configuration error: Not possible to attach anything to this driver!\n"),
                     VERR_PDM_DRVINS_NO_ATTACH);
@@ -2052,7 +2052,5 @@
      * Register saved state.
      */
-    int rc = pDrvIns->pDrvHlp->pfnSSMRegister(pDrvIns, pDrvIns->pDrvReg->szDriverName, pDrvIns->iInstance, 1, 0,
-                                              NULL, NULL, NULL,
-                                              NULL, NULL, drvHostBaseLoadDone);
+    int rc = PDMDrvHlpSSMRegisterLoadDone(pDrvIns, drvHostBaseLoadDone);
     if (RT_FAILURE(rc))
         return rc;
Index: trunk/src/VBox/Devices/Storage/fdc.c
===================================================================
--- trunk/src/VBox/Devices/Storage/fdc.c	(revision 22479)
+++ trunk/src/VBox/Devices/Storage/fdc.c	(revision 22480)
@@ -2380,5 +2380,5 @@
 }
 
-static DECLCALLBACK(int) SaveExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle)
+static DECLCALLBACK(int) fdcSaveExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle)
 {
     fdctrl_t *s = PDMINS_2_DATA (pDevIns, fdctrl_t *);
@@ -2429,7 +2429,8 @@
 }
 
-static DECLCALLBACK(int) LoadExec (PPDMDEVINS pDevIns,
-                                   PSSMHANDLE pSSMHandle,
-                                   uint32_t u32Version)
+static DECLCALLBACK(int) fdcLoadExec (PPDMDEVINS pDevIns,
+                                      PSSMHANDLE pSSMHandle,
+                                      uint32_t uVersion,
+                                      uint32_t uPhase)
 {
     fdctrl_t *s = PDMINS_2_DATA (pDevIns, fdctrl_t *);
@@ -2437,8 +2438,6 @@
     unsigned int i;
 
-    if (u32Version != 1) {
-        AssertMsgFailed(("u32Version=%d\n", u32Version));
-        return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
-    }
+    AssertMsgReturn(uVersion == 1, ("%d\n", uVersion), VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION);
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 
     qemu_get_8s (f, &s->version);
@@ -2896,6 +2895,5 @@
      * Register the saved state data unit.
      */
-    rc = PDMDevHlpSSMRegister (pDevIns, pDevIns->pDevReg->szDeviceName, iInstance, 1, sizeof(*fdctrl),
-                               NULL, SaveExec, NULL, NULL, LoadExec, NULL);
+    rc = PDMDevHlpSSMRegister (pDevIns, 1 /*uVersion*/, sizeof(*fdctrl), fdcSaveExec, fdcLoadExec);
     if (RT_FAILURE(rc))
         return rc;
Index: trunk/src/VBox/Devices/VMMDev/VMMDev.cpp
===================================================================
--- trunk/src/VBox/Devices/VMMDev/VMMDev.cpp	(revision 22479)
+++ trunk/src/VBox/Devices/VMMDev/VMMDev.cpp	(revision 22480)
@@ -2160,13 +2160,16 @@
  * @param   pDevIns     The device instance.
  * @param   pSSMHandle  The handle to the saved state.
- * @param   u32Version  The data unit version number.
+ * @param   uVersion    The data unit version number.
+ * @param   uPhase      The data phase.
  */
-static DECLCALLBACK(int) vmmdevLoadState(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version)
-{
-    /** @todo The code load code is assuming we're always loaded into a fresh VM. */
+static DECLCALLBACK(int) vmmdevLoadState(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t uVersion, uint32_t uPhase)
+{
+    /** @todo The code load code is assuming we're always loaded into a freshly
+     *        constructed VM. */
     VMMDevState *pThis = PDMINS_2_DATA(pDevIns, VMMDevState*);
-    if (   SSM_VERSION_MAJOR_CHANGED(u32Version, VMMDEV_SSM_VERSION)
-        || (SSM_VERSION_MINOR(u32Version) < 6))
+    if (   SSM_VERSION_MAJOR_CHANGED(uVersion, VMMDEV_SSM_VERSION)
+        || (SSM_VERSION_MINOR(uVersion) < 6))
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 
     SSMR3GetU32(pSSMHandle, &pThis->hypervisorSize);
@@ -2186,5 +2189,5 @@
     SSMR3GetU32(pSSMHandle, &pThis->fu32AdditionsOk);
     SSMR3GetU32(pSSMHandle, &pThis->u32VideoAccelEnabled);
-    if (u32Version > 10)
+    if (uVersion > 10)
         SSMR3GetBool(pSSMHandle, &pThis->fGuestSentChangeEventAck);
 
@@ -2192,6 +2195,6 @@
 
     /* Attributes which were temporarily introduced in r30072 */
-    if (   SSM_VERSION_MAJOR(u32Version) ==  0
-        && SSM_VERSION_MINOR(u32Version) == 7)
+    if (   SSM_VERSION_MAJOR(uVersion) ==  0
+        && SSM_VERSION_MINOR(uVersion) == 7)
     {
         uint32_t temp;
@@ -2201,9 +2204,9 @@
 
 #ifdef VBOX_WITH_HGCM
-    vmmdevHGCMLoadState (pThis, pSSMHandle, u32Version);
+    vmmdevHGCMLoadState (pThis, pSSMHandle, uVersion);
 #endif /* VBOX_WITH_HGCM */
 
-    if (   SSM_VERSION_MAJOR(u32Version) ==  0
-        && SSM_VERSION_MINOR(u32Version) >= 10)
+    if (   SSM_VERSION_MAJOR(uVersion) ==  0
+        && SSM_VERSION_MINOR(uVersion) >= 10)
         SSMR3GetU32(pSSMHandle, &pThis->fHostCursorRequested);
 
@@ -2216,6 +2219,6 @@
     {
         pThis->pDrv->pfnUpdateMouseCapabilities(pThis->pDrv, pThis->mouseCapabilities);
-        if (   SSM_VERSION_MAJOR(u32Version) ==  0
-            && SSM_VERSION_MINOR(u32Version) >= 10)
+        if (   SSM_VERSION_MAJOR(uVersion) ==  0
+            && SSM_VERSION_MINOR(uVersion) >= 10)
                 pThis->pDrv->pfnUpdatePointerShape(pThis->pDrv,
                                                    pThis->fHostCursorRequested,
@@ -2485,7 +2488,8 @@
      * Register saved state and init the HGCM CmdList critsect.
      */
-    rc = PDMDevHlpSSMRegister(pDevIns, "VMMDev", iInstance, VMMDEV_SSM_VERSION, sizeof(*pThis),
-                              NULL, vmmdevSaveState, NULL,
-                              NULL, vmmdevLoadState, vmmdevLoadStateDone);
+    rc = PDMDevHlpSSMRegisterEx(pDevIns, VMMDEV_SSM_VERSION, sizeof(*pThis), NULL,
+                                NULL, NULL, NULL,
+                                NULL, vmmdevSaveState, NULL,
+                                NULL, vmmdevLoadState, vmmdevLoadStateDone);
     AssertRCReturn(rc, rc);
 
Index: trunk/src/VBox/Frontends/VBoxBFE/VMMDevInterface.cpp
===================================================================
--- trunk/src/VBox/Frontends/VBoxBFE/VMMDevInterface.cpp	(revision 22479)
+++ trunk/src/VBox/Frontends/VBoxBFE/VMMDevInterface.cpp	(revision 22480)
@@ -317,12 +317,14 @@
  * @param   pDrvIns         Driver instance of the driver which registered the data unit.
  * @param   pSSM            SSM operation handle.
- * @param   u32Version      Data layout version.
- */
-static DECLCALLBACK(int) iface_hgcmLoad(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM, uint32_t u32Version)
+ * @param   uVersion        Data layout version.
+ * @param   uPhase          The data phase.
+ */
+static DECLCALLBACK(int) iface_hgcmLoad(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase)
 {
     LogFlowFunc(("Enter\n"));
 
-    if (u32Version != HGCM_SSM_VERSION)
+    if (uVersion != HGCM_SSM_VERSION)
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 
     return HGCMHostLoadState (pSSM);
@@ -399,5 +401,5 @@
     if (!CFGMR3AreValuesValid(pCfgHandle, "Object\0"))
         return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
-    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER, 
+    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
                     ("Configuration error: Not possible to attach anything to this driver!\n"),
                     VERR_PDM_DRVINS_NO_ATTACH);
@@ -474,5 +476,12 @@
             LogRel(("Failed to load Shared Folders service %Rrc\n", rc));
 
-        pDrvIns->pDrvHlp->pfnSSMRegister(pDrvIns, "HGCM", 0, HGCM_SSM_VERSION, 4096/* bad guess */, NULL, iface_hgcmSave, NULL, NULL, iface_hgcmLoad, NULL);
+
+        rc = PDMDrvHlpSSMRegisterEx(pDrvIns, HGCM_SSM_VERSION, 4096 /* bad guess */,
+                                    NULL, NULL, NULL,
+                                    NULL, iface_hgcmSave, NULL,
+                                    NULL, iface_hgcmLoad, NULL);
+        if (RT_FAILURE(rc))
+            return rc;
+
     }
 #endif /* VBOX_WITH_HGCM */
@@ -490,5 +499,5 @@
     PDM_DRVREG_VERSION,
     /* szDriverName */
-    "MainVMMDev",
+    "HGCM",
     /* pszDescription */
     "Main VMMDev driver (Main as in the API).",
@@ -518,7 +527,7 @@
     NULL,
     /* pfnDetach */
-    NULL, 
+    NULL,
     /* pfnPowerOff */
-    NULL, 
+    NULL,
     /* pfnSoftReset */
     NULL,
Index: trunk/src/VBox/Main/ConsoleImpl.cpp
===================================================================
--- trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 22479)
+++ trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 22480)
@@ -1055,6 +1055,7 @@
  *
  *  @param pvUser       pointer to Console
- *  @param u32Version   Console unit version.
+ *  @param uVersion     Console unit version.
  *                      Should match sSSMConsoleVer.
+ *  @param uPhase       The data phase.
  *
  *  @note Should locks the Console object for writing, if necessary.
@@ -1062,12 +1063,13 @@
 //static
 DECLCALLBACK(int)
-Console::loadStateFileExec (PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version)
+Console::loadStateFileExec(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPhase)
 {
     LogFlowFunc (("\n"));
 
-    if (SSM_VERSION_MAJOR_CHANGED(u32Version, sSSMConsoleVer))
+    if (SSM_VERSION_MAJOR_CHANGED(uVersion, sSSMConsoleVer))
         return VERR_VERSION_MISMATCH;
-
-    Console *that = static_cast <Console *> (pvUser);
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
+
+    Console *that = static_cast<Console *>(pvUser);
     AssertReturn(that, VERR_INVALID_PARAMETER);
 
@@ -6786,14 +6788,12 @@
             {
                 /*
-                 *  Register our load/save state file handlers
+                 * Register our load/save state file handlers
                  */
-                vrc = SSMR3RegisterExternal (pVM,
-                    sSSMConsoleUnit, 0 /* iInstance */, sSSMConsoleVer,
-                    0 /* cbGuess */,
-                    NULL, saveStateFileExec, NULL, NULL, loadStateFileExec, NULL,
-                    static_cast <Console *> (console));
-                AssertRC (vrc);
-                if (VBOX_FAILURE (vrc))
-                    break;
+                vrc = SSMR3RegisterExternal(pVM, sSSMConsoleUnit, 0 /*iInstance*/, sSSMConsoleVer, 0 /* cbGuess */,
+                                            NULL, NULL, NULL,
+                                            NULL, saveStateFileExec, NULL,
+                                            NULL, loadStateFileExec, NULL,
+                                            static_cast<Console *>(console));
+                AssertRCBreak(vrc);
 
                 vrc = static_cast <Console *>(console)->getDisplay()->registerSSM(pVM);
Index: trunk/src/VBox/Main/ConsoleImpl2.cpp
===================================================================
--- trunk/src/VBox/Main/ConsoleImpl2.cpp	(revision 22479)
+++ trunk/src/VBox/Main/ConsoleImpl2.cpp	(revision 22480)
@@ -1457,5 +1457,5 @@
     /* the VMM device's Main driver */
     rc = CFGMR3InsertNode(pInst,    "LUN#0", &pLunL0);                              RC_CHECK();
-    rc = CFGMR3InsertString(pLunL0, "Driver",               "MainVMMDev");          RC_CHECK();
+    rc = CFGMR3InsertString(pLunL0, "Driver",               "HGCM");                RC_CHECK();
     rc = CFGMR3InsertNode(pLunL0,   "Config", &pCfg);                               RC_CHECK();
     VMMDev *pVMMDev = pConsole->mVMMDev;
Index: trunk/src/VBox/Main/DisplayImpl.cpp
===================================================================
--- trunk/src/VBox/Main/DisplayImpl.cpp	(revision 22479)
+++ trunk/src/VBox/Main/DisplayImpl.cpp	(revision 22480)
@@ -116,47 +116,39 @@
  */
 DECLCALLBACK(void)
-Display::displaySSMSave (PSSMHANDLE pSSM, void *pvUser)
+Display::displaySSMSave(PSSMHANDLE pSSM, void *pvUser)
 {
     Display *that = static_cast<Display*>(pvUser);
 
-    int rc = SSMR3PutU32 (pSSM, that->mcMonitors);
-    AssertRC(rc);
-
+    SSMR3PutU32(pSSM, that->mcMonitors);
     for (unsigned i = 0; i < that->mcMonitors; i++)
     {
-        rc = SSMR3PutU32 (pSSM, that->maFramebuffers[i].u32Offset);
-        AssertRC(rc);
-        rc = SSMR3PutU32 (pSSM, that->maFramebuffers[i].u32MaxFramebufferSize);
-        AssertRC(rc);
-        rc = SSMR3PutU32 (pSSM, that->maFramebuffers[i].u32InformationSize);
-        AssertRC(rc);
+        SSMR3PutU32(pSSM, that->maFramebuffers[i].u32Offset);
+        SSMR3PutU32(pSSM, that->maFramebuffers[i].u32MaxFramebufferSize);
+        SSMR3PutU32(pSSM, that->maFramebuffers[i].u32InformationSize);
     }
 }
 
 DECLCALLBACK(int)
-Display::displaySSMLoad (PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version)
+Display::displaySSMLoad(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPhase)
 {
     Display *that = static_cast<Display*>(pvUser);
+
+    if (uVersion != sSSMDisplayVer)
+        return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
+
     uint32_t cMonitors;
-
-    if (u32Version != sSSMDisplayVer)
-        return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
-
-    int rc = SSMR3GetU32 (pSSM, &cMonitors);
+    int rc = SSMR3GetU32(pSSM, &cMonitors);
     if (cMonitors != that->mcMonitors)
     {
         LogRel(("Display: Number of monitors changed (%d->%d)!\n",
-                 cMonitors, that->mcMonitors));
+                cMonitors, that->mcMonitors));
         return VERR_SSM_LOAD_CONFIG_MISMATCH;
     }
 
-    for (unsigned i = 0; i < cMonitors; i++)
-    {
-        rc = SSMR3GetU32 (pSSM, &that->maFramebuffers[i].u32Offset);
-        AssertRC(rc);
-        rc = SSMR3GetU32 (pSSM, &that->maFramebuffers[i].u32MaxFramebufferSize);
-        AssertRC(rc);
-        rc = SSMR3GetU32 (pSSM, &that->maFramebuffers[i].u32InformationSize);
-        AssertRC(rc);
+    for (uint32_t i = 0; i < cMonitors; i++)
+    {
+        SSMR3GetU32(pSSM, &that->maFramebuffers[i].u32Offset);
+        SSMR3GetU32(pSSM, &that->maFramebuffers[i].u32MaxFramebufferSize);
+        SSMR3GetU32(pSSM, &that->maFramebuffers[i].u32InformationSize);
     }
 
@@ -262,8 +254,27 @@
 int Display::registerSSM(PVM pVM)
 {
-    return SSMR3RegisterExternal(pVM, "DisplayData", 3*sizeof(uint32_t*),
-                                 sSSMDisplayVer, 0,
-                                 NULL, displaySSMSave, NULL,
-                                 NULL, displaySSMLoad, NULL, this);
+    int rc = SSMR3RegisterExternal(pVM, "DisplayData", 0, sSSMDisplayVer,
+                                   mcMonitors * sizeof(uint32_t) * 3 + sizeof(uint32_t),
+                                   NULL, NULL, NULL,
+                                   NULL, displaySSMSave, NULL,
+                                   NULL, displaySSMLoad, NULL, this);
+
+    AssertRCReturn(rc, rc);
+
+    /*
+     * Register loaders for old saved states where iInstance was 3 * sizeof(uint32_t *).
+     */
+    rc = SSMR3RegisterExternal(pVM, "DisplayData", 12 /*uInstance*/, sSSMDisplayVer, 0 /*cbGuess*/,
+                               NULL, NULL, NULL,
+                               NULL, NULL, NULL,
+                               NULL, displaySSMLoad, NULL, this);
+    AssertRCReturn(rc, rc);
+
+    rc = SSMR3RegisterExternal(pVM, "DisplayData", 24 /*uInstance*/, sSSMDisplayVer, 0 /*cbGuess*/,
+                               NULL, NULL, NULL,
+                               NULL, NULL, NULL,
+                               NULL, displaySSMLoad, NULL, this);
+    AssertRCReturn(rc, rc);
+    return VINF_SUCCESS;
 }
 
@@ -2393,5 +2404,5 @@
 
     pThis->maFramebuffers[uScreenId].fVBVAEnabled = true;
-    
+
     return VINF_SUCCESS;
 }
@@ -2547,5 +2558,5 @@
     if (!CFGMR3AreValuesValid(pCfgHandle, "Object\0"))
         return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
-    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER, 
+    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
                     ("Configuration error: Not possible to attach anything to this driver!\n"),
                     VERR_PDM_DRVINS_NO_ATTACH);
@@ -2657,7 +2668,7 @@
     NULL,
     /* pfnDetach */
-    NULL, 
+    NULL,
     /* pfnPowerOff */
-    NULL, 
+    NULL,
     /* pfnSoftReset */
     NULL,
Index: trunk/src/VBox/Main/VMMDevInterface.cpp
===================================================================
--- trunk/src/VBox/Main/VMMDevInterface.cpp	(revision 22479)
+++ trunk/src/VBox/Main/VMMDevInterface.cpp	(revision 22480)
@@ -601,12 +601,14 @@
  * @param   pDrvIns         Driver instance of the driver which registered the data unit.
  * @param   pSSM            SSM operation handle.
- * @param   u32Version      Data layout version.
- */
-static DECLCALLBACK(int) iface_hgcmLoad(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM, uint32_t u32Version)
+ * @param   uVersion        Data layout version.
+ * @param   uPhase          The data phase.
+ */
+static DECLCALLBACK(int) iface_hgcmLoad(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase)
 {
     LogFlowFunc(("Enter\n"));
 
-    if (u32Version != HGCM_SSM_VERSION)
+    if (uVersion != HGCM_SSM_VERSION)
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 
     return HGCMHostLoadState (pSSM);
@@ -716,5 +718,5 @@
     if (!CFGMR3AreValuesValid(pCfgHandle, "Object\0"))
         return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
-    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER, 
+    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
                     ("Configuration error: Not possible to attach anything to this driver!\n"),
                     VERR_PDM_DRVINS_NO_ATTACH);
@@ -812,5 +814,11 @@
         LogRel(("Failed to load Shared Folders service %Rrc\n", rc));
 
-    pDrvIns->pDrvHlp->pfnSSMRegister(pDrvIns, "HGCM", 0, HGCM_SSM_VERSION, 4096/* bad guess */, NULL, iface_hgcmSave, NULL, NULL, iface_hgcmLoad, NULL);
+    rc = PDMDrvHlpSSMRegisterEx(pDrvIns, HGCM_SSM_VERSION, 4096 /* bad guess */,
+                                NULL, NULL, NULL,
+                                NULL, iface_hgcmSave, NULL,
+                                NULL, iface_hgcmLoad, NULL);
+    if (RT_FAILURE(rc))
+        return rc;
+
 #endif /* VBOX_WITH_HGCM */
 
@@ -827,5 +835,5 @@
     PDM_DRVREG_VERSION,
     /* szDriverName */
-    "MainVMMDev",
+    "HGCM",
     /* pszDescription */
     "Main VMMDev driver (Main as in the API).",
@@ -855,7 +863,7 @@
     NULL,
     /* pfnDetach */
-    NULL, 
+    NULL,
     /* pfnPowerOff */
-    NULL, 
+    NULL,
     /* pfnSoftReset */
     NULL,
Index: trunk/src/VBox/Main/include/ConsoleImpl.h
===================================================================
--- trunk/src/VBox/Main/include/ConsoleImpl.h	(revision 22479)
+++ trunk/src/VBox/Main/include/ConsoleImpl.h	(revision 22480)
@@ -500,5 +500,5 @@
 
     static DECLCALLBACK(void)   saveStateFileExec (PSSMHANDLE pSSM, void *pvUser);
-    static DECLCALLBACK(int)    loadStateFileExec (PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version);
+    static DECLCALLBACK(int)    loadStateFileExec (PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPhase);
 
 #ifdef VBOX_WITH_GUEST_PROPS
Index: trunk/src/VBox/Main/include/DisplayImpl.h
===================================================================
--- trunk/src/VBox/Main/include/DisplayImpl.h	(revision 22479)
+++ trunk/src/VBox/Main/include/DisplayImpl.h	(revision 22480)
@@ -291,6 +291,6 @@
 
 
-    static DECLCALLBACK(void)   displaySSMSave (PSSMHANDLE pSSM, void *pvUser);
-    static DECLCALLBACK(int)    displaySSMLoad (PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version);
+    static DECLCALLBACK(void)   displaySSMSave(PSSMHANDLE pSSM, void *pvUser);
+    static DECLCALLBACK(int)    displaySSMLoad(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPhase);
 
     const ComObjPtr<Console, ComWeakRef> mParent;
Index: trunk/src/VBox/VMM/CPUM.cpp
===================================================================
--- trunk/src/VBox/VMM/CPUM.cpp	(revision 22479)
+++ trunk/src/VBox/VMM/CPUM.cpp	(revision 22480)
@@ -100,5 +100,5 @@
 static int cpumR3CpuIdInit(PVM pVM);
 static DECLCALLBACK(int)  cpumR3Save(PVM pVM, PSSMHANDLE pSSM);
-static DECLCALLBACK(int)  cpumR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version);
+static DECLCALLBACK(int)  cpumR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase);
 static DECLCALLBACK(void) cpumR3InfoAll(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
 static DECLCALLBACK(void) cpumR3InfoGuest(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
@@ -199,4 +199,5 @@
      */
     int rc = SSMR3RegisterInternal(pVM, "cpum", 1, CPUM_SAVED_STATE_VERSION, sizeof(CPUM),
+                                   NULL, NULL, NULL,
                                    NULL, cpumR3Save, NULL,
                                    NULL, cpumR3Load, NULL);
@@ -990,24 +991,26 @@
  * @param   pVM             VM Handle.
  * @param   pSSM            SSM operation handle.
- * @param   u32Version      Data layout version.
- */
-static DECLCALLBACK(int) cpumR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version)
-{
+ * @param   uVersion        Data layout version.
+ */
+static DECLCALLBACK(int) cpumR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase)
+{
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
+
     /*
      * Validate version.
      */
-    if (    u32Version != CPUM_SAVED_STATE_VERSION
-        &&  u32Version != CPUM_SAVED_STATE_VERSION_VER2_1_NOMSR
-        &&  u32Version != CPUM_SAVED_STATE_VERSION_VER2_0
-        &&  u32Version != CPUM_SAVED_STATE_VERSION_VER1_6)
-    {
-        AssertMsgFailed(("cpuR3Load: Invalid version u32Version=%d!\n", u32Version));
+    if (    uVersion != CPUM_SAVED_STATE_VERSION
+        &&  uVersion != CPUM_SAVED_STATE_VERSION_VER2_1_NOMSR
+        &&  uVersion != CPUM_SAVED_STATE_VERSION_VER2_0
+        &&  uVersion != CPUM_SAVED_STATE_VERSION_VER1_6)
+    {
+        AssertMsgFailed(("cpuR3Load: Invalid version uVersion=%d!\n", uVersion));
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
     }
 
     /* Set the size of RTGCPTR for SSMR3GetGCPtr. */
-    if (u32Version == CPUM_SAVED_STATE_VERSION_VER1_6)
+    if (uVersion == CPUM_SAVED_STATE_VERSION_VER1_6)
         SSMR3SetGCPtrSize(pSSM, sizeof(RTGCPTR32));
-    else if (u32Version <= CPUM_SAVED_STATE_VERSION)
+    else if (uVersion <= CPUM_SAVED_STATE_VERSION)
         SSMR3SetGCPtrSize(pSSM, HC_ARCH_BITS == 32 ? sizeof(RTGCPTR32) : sizeof(RTGCPTR));
 
@@ -1015,5 +1018,5 @@
      * Restore.
      */
-    for (unsigned i=0;i<pVM->cCPUs;i++)
+    for (VMCPUID i = 0; i < pVM->cCPUs; i++)
     {
         PVMCPU   pVCpu = &pVM->aCpus[i];
@@ -1026,5 +1029,5 @@
     }
 
-    if (u32Version == CPUM_SAVED_STATE_VERSION_VER1_6)
+    if (uVersion == CPUM_SAVED_STATE_VERSION_VER1_6)
     {
         CPUMCTX_VER1_6 cpumctx16;
@@ -1040,5 +1043,5 @@
     else
     {
-        if (u32Version >= CPUM_SAVED_STATE_VERSION_VER2_1_NOMSR)
+        if (uVersion >= CPUM_SAVED_STATE_VERSION_VER2_1_NOMSR)
         {
             int rc = SSMR3GetU32(pSSM, &pVM->cCPUs);
@@ -1048,5 +1051,5 @@
         if (    !pVM->cCPUs
             ||  pVM->cCPUs > VMM_MAX_CPU_COUNT
-            ||  (   u32Version == CPUM_SAVED_STATE_VERSION_VER2_0
+            ||  (   uVersion == CPUM_SAVED_STATE_VERSION_VER2_0
                  && pVM->cCPUs != 1))
         {
@@ -1055,10 +1058,10 @@
         }
 
-        for (unsigned i=0;i<pVM->cCPUs;i++)
+        for (VMCPUID i = 0; i < pVM->cCPUs; i++)
         {
             SSMR3GetMem(pSSM, &pVM->aCpus[i].cpum.s.Guest, sizeof(pVM->aCpus[i].cpum.s.Guest));
             SSMR3GetU32(pSSM, &pVM->aCpus[i].cpum.s.fUseFlags);
             SSMR3GetU32(pSSM, &pVM->aCpus[i].cpum.s.fChanged);
-            if (u32Version == CPUM_SAVED_STATE_VERSION)
+            if (uVersion == CPUM_SAVED_STATE_VERSION)
                 SSMR3GetMem(pSSM, &pVM->aCpus[i].cpum.s.GuestMsr, sizeof(pVM->aCpus[i].cpum.s.GuestMsr));
         }
Index: trunk/src/VBox/VMM/EM.cpp
===================================================================
--- trunk/src/VBox/VMM/EM.cpp	(revision 22479)
+++ trunk/src/VBox/VMM/EM.cpp	(revision 22480)
@@ -84,5 +84,5 @@
 *******************************************************************************/
 static DECLCALLBACK(int) emR3Save(PVM pVM, PSSMHANDLE pSSM);
-static DECLCALLBACK(int) emR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version);
+static DECLCALLBACK(int) emR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase);
 static int emR3Debug(PVM pVM, PVMCPU pVCpu, int rc);
 static int emR3RemStep(PVM pVM, PVMCPU pVCpu);
@@ -131,4 +131,5 @@
      */
     rc = SSMR3RegisterInternal(pVM, "em", 0, EM_SAVED_STATE_VERSION, 16,
+                               NULL, NULL, NULL,
                                NULL, emR3Save, NULL,
                                NULL, emR3Load, NULL);
@@ -516,17 +517,16 @@
  * @param   pVM             VM Handle.
  * @param   pSSM            SSM operation handle.
- * @param   u32Version      Data layout version.
- */
-static DECLCALLBACK(int) emR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version)
+ * @param   uVersion        Data layout version.
+ * @param   uPhase          The data phase.
+ */
+static DECLCALLBACK(int) emR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase)
 {
-    int rc = VINF_SUCCESS;
-
     /*
      * Validate version.
      */
-    if (    u32Version != EM_SAVED_STATE_VERSION
-        &&  u32Version != EM_SAVED_STATE_VERSION_PRE_SMP)
-    {
-        AssertMsgFailed(("emR3Load: Invalid version u32Version=%d (current %d)!\n", u32Version, EM_SAVED_STATE_VERSION));
+    if (    uVersion != EM_SAVED_STATE_VERSION
+        &&  uVersion != EM_SAVED_STATE_VERSION_PRE_SMP)
+    {
+        AssertMsgFailed(("emR3Load: Invalid version uVersion=%d (current %d)!\n", uVersion, EM_SAVED_STATE_VERSION));
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
     }
@@ -539,9 +539,10 @@
         PVMCPU pVCpu = &pVM->aCpus[i];
 
-        rc = SSMR3GetBool(pSSM, &pVCpu->em.s.fForceRAW);
+        int rc = SSMR3GetBool(pSSM, &pVCpu->em.s.fForceRAW);
         if (RT_FAILURE(rc))
             pVCpu->em.s.fForceRAW = false;
-
-        if (u32Version > EM_SAVED_STATE_VERSION_PRE_SMP)
+        AssertRCReturn(rc, rc);
+
+        if (uVersion > EM_SAVED_STATE_VERSION_PRE_SMP)
         {
             AssertCompile(sizeof(pVCpu->em.s.enmPrevState) == sizeof(uint32_t));
@@ -554,5 +555,5 @@
         Assert(!pVCpu->em.s.pCliStatTree);
     }
-    return rc;
+    return VINF_SUCCESS;
 }
 
Index: trunk/src/VBox/VMM/HWACCM.cpp
===================================================================
--- trunk/src/VBox/VMM/HWACCM.cpp	(revision 22479)
+++ trunk/src/VBox/VMM/HWACCM.cpp	(revision 22480)
@@ -270,5 +270,5 @@
 *******************************************************************************/
 static DECLCALLBACK(int) hwaccmR3Save(PVM pVM, PSSMHANDLE pSSM);
-static DECLCALLBACK(int) hwaccmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version);
+static DECLCALLBACK(int) hwaccmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase);
 
 
@@ -308,4 +308,5 @@
      */
     int rc = SSMR3RegisterInternal(pVM, "HWACCM", 0, HWACCM_SSM_VERSION, sizeof(HWACCM),
+                                   NULL, NULL, NULL,
                                    NULL, hwaccmR3Save, NULL,
                                    NULL, hwaccmR3Load, NULL);
@@ -327,5 +328,5 @@
      * Check CFGM options.
      */
-    PCFGMNODE pRoot      = CFGMR3GetRoot(pVM); 
+    PCFGMNODE pRoot      = CFGMR3GetRoot(pVM);
     PCFGMNODE pHWVirtExt = CFGMR3GetChild(pRoot, "HWVirtExt/");
     /* Nested paging: disabled by default. */
@@ -409,5 +410,5 @@
     STAM_REG(pVM, &pVM->hwaccm.s.StatTPRReplaceSuccess, STAMTYPE_COUNTER, "/HWACCM/TPR/Replace/Success", STAMUNIT_OCCURENCES, "Number of times an instruction was successfully patched.");
     STAM_REG(pVM, &pVM->hwaccm.s.StatTPRReplaceFailure, STAMTYPE_COUNTER, "/HWACCM/TPR/Replace/Failed",  STAMUNIT_OCCURENCES, "Number of unsuccessful patch attempts.");
-    
+
     /*
      * Statistics.
@@ -512,5 +513,5 @@
         HWACCM_REG_COUNTER(&pVCpu->hwaccm.s.StatTSCIntercept,           "/HWACCM/CPU%d/TSC/Intercept");
         HWACCM_REG_COUNTER(&pVCpu->hwaccm.s.StatTSCInterceptOverFlow,   "/HWACCM/CPU%d/TSC/InterceptOverflow");
-        
+
         HWACCM_REG_COUNTER(&pVCpu->hwaccm.s.StatDRxArmed,               "/HWACCM/CPU%d/Debug/Armed");
         HWACCM_REG_COUNTER(&pVCpu->hwaccm.s.StatDRxContextSwitch,       "/HWACCM/CPU%d/Debug/ContextSwitch");
@@ -1419,5 +1420,5 @@
  * @returns VBox status code.
  * @param   pVM     The VM handle.
- * @param   pVCpu   The VMCPU for the EMT we're being called on. 
+ * @param   pVCpu   The VMCPU for the EMT we're being called on.
  * @param   pvUser  Unused
  *
@@ -1560,5 +1561,5 @@
  * @returns VBox status code.
  * @param   pVM     The VM handle.
- * @param   pVCpu   The VMCPU for the EMT we're being called on. 
+ * @param   pVCpu   The VMCPU for the EMT we're being called on.
  * @param   pvUser  User specified CPU context
  *
@@ -1717,5 +1718,5 @@
  * @returns VBox status code.
  * @param   pVM     The VM handle.
- * @param   pVCpu   The VMCPU for the EMT we're being called on. 
+ * @param   pVCpu   The VMCPU for the EMT we're being called on.
  * @param   pvUser  User specified CPU context
  *
@@ -2243,6 +2244,6 @@
         uint32_t u32Val  = 0;
 
-        rc = IOMIOPortRead(pVM, pVCpu->hwaccm.s.PendingIO.s.Port.uPort, 
-                           &u32Val, 
+        rc = IOMIOPortRead(pVM, pVCpu->hwaccm.s.PendingIO.s.Port.uPort,
+                           &u32Val,
                            pVCpu->hwaccm.s.PendingIO.s.Port.cbSize);
         if (IOM_SUCCESS(rc))
@@ -2256,6 +2257,6 @@
 
     case HWACCMPENDINGIO_PORT_WRITE:
-        rc = IOMIOPortWrite(pVM, pVCpu->hwaccm.s.PendingIO.s.Port.uPort, 
-                            pCtx->eax & pVCpu->hwaccm.s.PendingIO.s.Port.uAndVal, 
+        rc = IOMIOPortWrite(pVM, pVCpu->hwaccm.s.PendingIO.s.Port.uPort,
+                            pCtx->eax & pVCpu->hwaccm.s.PendingIO.s.Port.uAndVal,
                             pVCpu->hwaccm.s.PendingIO.s.Port.cbSize);
         if (IOM_SUCCESS(rc))
@@ -2417,23 +2418,25 @@
  * @param   pVM             VM Handle.
  * @param   pSSM            SSM operation handle.
- * @param   u32Version      Data layout version.
- */
-static DECLCALLBACK(int) hwaccmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version)
+ * @param   uVersion        Data layout version.
+ * @param   uPhase          The data phase.
+ */
+static DECLCALLBACK(int) hwaccmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase)
 {
     int rc;
 
     Log(("hwaccmR3Load:\n"));
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 
     /*
      * Validate version.
      */
-    if (   u32Version != HWACCM_SSM_VERSION
-        && u32Version != HWACCM_SSM_VERSION_NO_PATCHING
-        && u32Version != HWACCM_SSM_VERSION_2_0_X)
-    {
-        AssertMsgFailed(("hwaccmR3Load: Invalid version u32Version=%d!\n", u32Version));
+    if (   uVersion != HWACCM_SSM_VERSION
+        && uVersion != HWACCM_SSM_VERSION_NO_PATCHING
+        && uVersion != HWACCM_SSM_VERSION_2_0_X)
+    {
+        AssertMsgFailed(("hwaccmR3Load: Invalid version uVersion=%d!\n", uVersion));
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
     }
-    for (unsigned i=0;i<pVM->cCPUs;i++)
+    for (VMCPUID i = 0; i < pVM->cCPUs; i++)
     {
         rc = SSMR3GetU32(pSSM, &pVM->aCpus[i].hwaccm.s.Event.fPending);
@@ -2444,5 +2447,5 @@
         AssertRCReturn(rc, rc);
 
-        if (u32Version >= HWACCM_SSM_VERSION_NO_PATCHING)
+        if (uVersion >= HWACCM_SSM_VERSION_NO_PATCHING)
         {
             uint32_t val;
@@ -2462,5 +2465,5 @@
     }
 #ifdef VBOX_HWACCM_WITH_GUEST_PATCHING
-    if (u32Version > HWACCM_SSM_VERSION_NO_PATCHING)
+    if (uVersion > HWACCM_SSM_VERSION_NO_PATCHING)
     {
         rc = SSMR3GetGCPtr(pSSM, &pVM->hwaccm.s.pGuestPatchMem);
@@ -2508,5 +2511,5 @@
             rc = SSMR3GetU32(pSSM, &pPatch->pJumpTarget);
             AssertRCReturn(rc, rc);
-            
+
             rc = RTAvloU32Insert(&pVM->hwaccm.s.svm.PatchTree, &pPatch->Core);
             AssertRC(rc);
Index: trunk/src/VBox/VMM/MM.cpp
===================================================================
--- trunk/src/VBox/VMM/MM.cpp	(revision 22479)
+++ trunk/src/VBox/VMM/MM.cpp	(revision 22480)
@@ -177,5 +177,5 @@
 *******************************************************************************/
 static DECLCALLBACK(int) mmR3Save(PVM pVM, PSSMHANDLE pSSM);
-static DECLCALLBACK(int) mmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version);
+static DECLCALLBACK(int) mmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase);
 
 
@@ -266,4 +266,5 @@
              */
             rc = SSMR3RegisterInternal(pVM, "mm", 1, MM_SAVED_STATE_VERSION, sizeof(uint32_t) * 2,
+                                       NULL, NULL, NULL,
                                        NULL, mmR3Save, NULL,
                                        NULL, mmR3Load, NULL);
@@ -528,17 +529,19 @@
  * @param   pVM             VM Handle.
  * @param   pSSM            SSM operation handle.
- * @param   u32Version      Data layout version.
- */
-static DECLCALLBACK(int) mmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version)
+ * @param   uVersion       Data layout version.
+ * @param   uPhase          The data phase.
+ */
+static DECLCALLBACK(int) mmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase)
 {
     LogFlow(("mmR3Load:\n"));
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 
     /*
      * Validate version.
      */
-    if (    SSM_VERSION_MAJOR_CHANGED(u32Version, MM_SAVED_STATE_VERSION)
-        ||  !u32Version)
-    {
-        AssertMsgFailed(("mmR3Load: Invalid version u32Version=%d!\n", u32Version));
+    if (    SSM_VERSION_MAJOR_CHANGED(uVersion, MM_SAVED_STATE_VERSION)
+        ||  !uVersion)
+    {
+        AssertMsgFailed(("mmR3Load: Invalid version uVersion=%d!\n", uVersion));
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
     }
@@ -552,5 +555,5 @@
     /* cBasePages (ignored) */
     uint64_t cPages;
-    if (u32Version >= 2)
+    if (uVersion >= 2)
         rc = SSMR3GetU64(pSSM, &cPages);
     else
@@ -564,5 +567,5 @@
     /* cbRamBase */
     uint64_t cb;
-    if (u32Version != 1)
+    if (uVersion != 1)
         rc = SSMR3GetU64(pSSM, &cb);
     else
Index: trunk/src/VBox/VMM/PATM/CSAM.cpp
===================================================================
--- trunk/src/VBox/VMM/PATM/CSAM.cpp	(revision 22479)
+++ trunk/src/VBox/VMM/PATM/CSAM.cpp	(revision 22480)
@@ -70,5 +70,5 @@
 *******************************************************************************/
 static DECLCALLBACK(int) csamr3Save(PVM pVM, PSSMHANDLE pSSM);
-static DECLCALLBACK(int) csamr3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version);
+static DECLCALLBACK(int) csamr3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase);
 static DECLCALLBACK(int) CSAMCodePageWriteHandler(PVM pVM, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser);
 static DECLCALLBACK(int) CSAMCodePageInvalidate(PVM pVM, RTGCPTR GCPtr);
@@ -130,4 +130,5 @@
      */
     rc = SSMR3RegisterInternal(pVM, "CSAM", 0, CSAM_SSM_VERSION, sizeof(pVM->csam.s) + PAGE_SIZE*16,
+                               NULL, NULL, NULL,
                                NULL, csamr3Save, NULL,
                                NULL, csamr3Load, NULL);
@@ -440,14 +441,16 @@
  * @param   pVM             VM Handle.
  * @param   pSSM            SSM operation handle.
- * @param   u32Version      Data layout version.
- */
-static DECLCALLBACK(int) csamr3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version)
+ * @param   uVersion        Data layout version.
+ * @param   uPhase          The data phase.
+ */
+static DECLCALLBACK(int) csamr3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase)
 {
     int  rc;
     CSAM csamInfo;
 
-    if (u32Version != CSAM_SSM_VERSION)
-    {
-        AssertMsgFailed(("csamR3Load: Invalid version u32Version=%d!\n", u32Version));
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
+    if (uVersion != CSAM_SSM_VERSION)
+    {
+        AssertMsgFailed(("csamR3Load: Invalid version uVersion=%d!\n", uVersion));
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
     }
Index: trunk/src/VBox/VMM/PATM/PATM.cpp
===================================================================
--- trunk/src/VBox/VMM/PATM/PATM.cpp	(revision 22479)
+++ trunk/src/VBox/VMM/PATM/PATM.cpp	(revision 22480)
@@ -177,11 +177,8 @@
      */
     rc = SSMR3RegisterInternal(pVM, "PATM", 0, PATM_SSM_VERSION, sizeof(pVM->patm.s) + PATCH_MEMORY_SIZE  + PAGE_SIZE + PATM_STACK_TOTAL_SIZE + PAGE_SIZE,
-                               NULL, patmr3Save, NULL,
-                               NULL, patmr3Load, NULL);
-    if (RT_FAILURE(rc))
-    {
-        AssertRC(rc);
-        return rc;
-    }
+                               NULL, NULL, NULL,
+                               NULL, patmR3Save, NULL,
+                               NULL, patmR3Load, NULL);
+    AssertRCReturn(rc, rc);
 
 #ifdef VBOX_WITH_DEBUGGER
Index: trunk/src/VBox/VMM/PATM/PATMInternal.h
===================================================================
--- trunk/src/VBox/VMM/PATM/PATMInternal.h	(revision 22479)
+++ trunk/src/VBox/VMM/PATM/PATMInternal.h	(revision 22480)
@@ -524,24 +524,9 @@
 
 
-/**
- * Execute state save operation.
- *
- * @returns VBox status code.
- * @param   pVM             VM Handle.
- * @param   pSSM            SSM operation handle.
- */
-DECLCALLBACK(int) patmr3Save(PVM pVM, PSSMHANDLE pSSM);
 
 DECLCALLBACK(int) patmVirtPageHandler(PVM pVM, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser);
 
-/**
- * Execute state load operation.
- *
- * @returns VBox status code.
- * @param   pVM             VM Handle.
- * @param   pSSM            SSM operation handle.
- * @param   u32Version      Data layout version.
- */
-DECLCALLBACK(int) patmr3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version);
+DECLCALLBACK(int) patmR3Save(PVM pVM, PSSMHANDLE pSSM);
+DECLCALLBACK(int) patmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase);
 
 #ifdef IN_RING3
Index: trunk/src/VBox/VMM/PATM/PATMSSM.cpp
===================================================================
--- trunk/src/VBox/VMM/PATM/PATMSSM.cpp	(revision 22479)
+++ trunk/src/VBox/VMM/PATM/PATMSSM.cpp	(revision 22480)
@@ -153,14 +153,14 @@
         if (*pFixup == pVM->pVMRC + RT_OFFSETOF(VM, aCpus[0].fLocalForcedActions))
             rec.Core.Key = (AVLPVKEY)PATM_FIXUP_CPU_FF_ACTION;
-        else 
+        else
         if (*pFixup == CPUMR3GetGuestCpuIdDefRCPtr(pVM))
             rec.Core.Key = (AVLPVKEY)PATM_FIXUP_CPUID_DEFAULT;
-        else 
+        else
         if (*pFixup == CPUMR3GetGuestCpuIdStdRCPtr(pVM))
             rec.Core.Key = (AVLPVKEY)PATM_FIXUP_CPUID_STANDARD;
-        else 
+        else
         if (*pFixup == CPUMR3GetGuestCpuIdExtRCPtr(pVM))
             rec.Core.Key = (AVLPVKEY)PATM_FIXUP_CPUID_EXTENDED;
-        else 
+        else
         if (*pFixup == CPUMR3GetGuestCpuIdCentaurRCPtr(pVM))
             rec.Core.Key = (AVLPVKEY)PATM_FIXUP_CPUID_CENTAUR;
@@ -236,5 +236,5 @@
  * @param   pSSM            SSM operation handle.
  */
-DECLCALLBACK(int) patmr3Save(PVM pVM, PSSMHANDLE pSSM)
+DECLCALLBACK(int) patmR3Save(PVM pVM, PSSMHANDLE pSSM)
 {
     PATM patmInfo = pVM->patm.s;
@@ -299,21 +299,22 @@
  * @param   pVM             VM Handle.
  * @param   pSSM            SSM operation handle.
- * @param   u32Version      Data layout version.
+ * @param   uVersion        Data layout version.
+ * @param   uPhase          The data phase.
  */
-DECLCALLBACK(int) patmr3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version)
+DECLCALLBACK(int) patmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase)
 {
     PATM patmInfo;
     int  rc;
 
-    if (    u32Version != PATM_SSM_VERSION
-        &&  u32Version != PATM_SSM_VERSION_FIXUP_HACK
-        &&  u32Version != PATM_SSM_VERSION_VER16
+    if (    uVersion != PATM_SSM_VERSION
+        &&  uVersion != PATM_SSM_VERSION_FIXUP_HACK
+        &&  uVersion != PATM_SSM_VERSION_VER16
 #ifdef PATM_WITH_NEW_SSM
-        &&  u32Version != PATM_SSM_VERSION_GETPUTMEM)
+        &&  uVersion != PATM_SSM_VERSION_GETPUTMEM)
 #else
        )
 #endif
     {
-        AssertMsgFailed(("patmR3Load: Invalid version u32Version=%d!\n", u32Version));
+        AssertMsgFailed(("patmR3Load: Invalid version uVersion=%d!\n", uVersion));
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
     }
@@ -325,5 +326,5 @@
      */
 #ifdef PATM_WITH_NEW_SSM
-    if (u32Version == PATM_SSM_VERSION_GETPUTMEM)
+    if (uVersion == PATM_SSM_VERSION_GETPUTMEM)
     {
 #endif
@@ -478,5 +479,5 @@
      */
 #ifdef PATM_WITH_NEW_SSM
-    if (u32Version == PATM_SSM_VERSION_GETPUTMEM)
+    if (uVersion == PATM_SSM_VERSION_GETPUTMEM)
     {
 #endif
@@ -644,5 +645,5 @@
                 }
 
-                patmCorrectFixup(pVM, u32Version, patmInfo, &pPatchRec->patch, &rec, offset, pFixup);
+                patmCorrectFixup(pVM, uVersion, patmInfo, &pPatchRec->patch, &rec, offset, pFixup);
             }
 
@@ -719,5 +720,5 @@
 
         /* Correct fixups that refer to PATM structures in the hypervisor region (their addresses might have changed). */
-        patmCorrectFixup(pVM, u32Version, patmInfo, &pVM->patm.s.pGlobalPatchRec->patch, pRec, offset, pFixup);
+        patmCorrectFixup(pVM, uVersion, patmInfo, &pVM->patm.s.pGlobalPatchRec->patch, pRec, offset, pFixup);
     }
 
Index: trunk/src/VBox/VMM/PDM.cpp
===================================================================
--- trunk/src/VBox/VMM/PDM.cpp	(revision 22479)
+++ trunk/src/VBox/VMM/PDM.cpp	(revision 22480)
@@ -288,5 +288,5 @@
 *******************************************************************************/
 static DECLCALLBACK(int) pdmR3Save(PVM pVM, PSSMHANDLE pSSM);
-static DECLCALLBACK(int) pdmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version);
+static DECLCALLBACK(int) pdmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase);
 static DECLCALLBACK(int) pdmR3LoadPrep(PVM pVM, PSSMHANDLE pSSM);
 
@@ -357,4 +357,5 @@
          */
         rc = SSMR3RegisterInternal(pVM, "pdm", 1, PDM_SAVED_STATE_VERSION, 128,
+                                   NULL, NULL, NULL,
                                    NULL, pdmR3Save, NULL,
                                    pdmR3LoadPrep, pdmR3Load, NULL);
@@ -717,19 +718,21 @@
  * @param   pVM             VM Handle.
  * @param   pSSM            SSM operation handle.
- * @param   u32Version      Data layout version.
- */
-static DECLCALLBACK(int) pdmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version)
+ * @param   uVersion        Data layout version.
+ * @param   uPhase          The data phase.
+ */
+static DECLCALLBACK(int) pdmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase)
 {
     int rc;
 
     LogFlow(("pdmR3Load:\n"));
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 
     /*
      * Validate version.
      */
-    if (    u32Version != PDM_SAVED_STATE_VERSION
-        &&  u32Version != PDM_SAVED_STATE_VERSION_PRE_NMI_FF)
-    {
-        AssertMsgFailed(("pdmR3Load: Invalid version u32Version=%d!\n", u32Version));
+    if (    uVersion != PDM_SAVED_STATE_VERSION
+        &&  uVersion != PDM_SAVED_STATE_VERSION_PRE_NMI_FF)
+    {
+        AssertMsgFailed(("pdmR3Load: Invalid version uVersion=%d!\n", uVersion));
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
     }
@@ -738,5 +741,5 @@
      * Load the interrupt and DMA states.
      */
-    for (unsigned idCpu = 0; idCpu < pVM->cCPUs; idCpu++)
+    for (VMCPUID idCpu = 0; idCpu < pVM->cCPUs; idCpu++)
     {
         PVMCPU pVCpu = &pVM->aCpus[idCpu];
@@ -770,5 +773,5 @@
             VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_PIC);
 
-        if (u32Version > PDM_SAVED_STATE_VERSION_PRE_NMI_FF)
+        if (uVersion > PDM_SAVED_STATE_VERSION_PRE_NMI_FF)
         {
             /* NMI interrupt */
@@ -824,5 +827,5 @@
     uint32_t i = 0;
     PPDMDEVINS pDevIns = pVM->pdm.s.pDevInstances;
-    for (;;pDevIns = pDevIns->Internal.s.pNextR3, i++)
+    for (;; pDevIns = pDevIns->Internal.s.pNextR3, i++)
     {
         /* Get the separator / terminator. */
Index: trunk/src/VBox/VMM/PDMDevHlp.cpp
===================================================================
--- trunk/src/VBox/VMM/PDMDevHlp.cpp	(revision 22479)
+++ trunk/src/VBox/VMM/PDMDevHlp.cpp	(revision 22480)
@@ -399,5 +399,6 @@
 
 /** @copydoc PDMDEVHLPR3::pfnSSMRegister */
-static DECLCALLBACK(int) pdmR3DevHlp_SSMRegister(PPDMDEVINS pDevIns, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess,
+static DECLCALLBACK(int) pdmR3DevHlp_SSMRegister(PPDMDEVINS pDevIns, uint32_t uVersion, size_t cbGuess, const char *pszBefore,
+                                                 PFNSSMDEVLIVEPREP pfnLivePrep, PFNSSMDEVLIVEEXEC pfnLiveExec, PFNSSMDEVLIVEVOTE pfnLiveVote,
                                                  PFNSSMDEVSAVEPREP pfnSavePrep, PFNSSMDEVSAVEEXEC pfnSaveExec, PFNSSMDEVSAVEDONE pfnSaveDone,
                                                  PFNSSMDEVLOADPREP pfnLoadPrep, PFNSSMDEVLOADEXEC pfnLoadExec, PFNSSMDEVLOADDONE pfnLoadDone)
@@ -405,8 +406,14 @@
     PDMDEV_ASSERT_DEVINS(pDevIns);
     VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
-    LogFlow(("pdmR3DevHlp_SSMRegister: caller='%s'/%d: pszName=%p:{%s} u32Instance=%#x u32Version=#x cbGuess=%#x pfnSavePrep=%p pfnSaveExec=%p pfnSaveDone=%p pszLoadPrep=%p pfnLoadExec=%p pfnLoaddone=%p\n",
-             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pszName, pszName, u32Instance, u32Version, cbGuess, pfnSavePrep, pfnSaveExec, pfnSaveDone, pfnLoadPrep, pfnLoadExec, pfnLoadDone));
-
-    int rc = SSMR3RegisterDevice(pDevIns->Internal.s.pVMR3, pDevIns, pszName, u32Instance, u32Version, cbGuess, NULL,
+    LogFlow(("pdmR3DevHlp_SSMRegister: caller='%s'/%d: uVersion=#x cbGuess=%#x pszBefore=%p:{%s}\n"
+             "    pfnLivePrep=%p pfnLiveExec=%p pfnLiveVote=%p pfnSavePrep=%p pfnSaveExec=%p pfnSaveDone=%p pszLoadPrep=%p pfnLoadExec=%p pfnLoadDone=%p\n",
+             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, uVersion, cbGuess, pszBefore, pszBefore,
+             pfnLivePrep, pfnLiveExec, pfnLiveVote,
+             pfnSavePrep, pfnSaveExec, pfnSaveDone,
+             pfnLoadPrep, pfnLoadExec, pfnLoadDone));
+
+    int rc = SSMR3RegisterDevice(pDevIns->Internal.s.pVMR3, pDevIns, pDevIns->pDevReg->szDeviceName, pDevIns->iInstance,
+                                 uVersion, cbGuess, pszBefore,
+                                 pfnLivePrep, pfnLiveExec, pfnLiveVote,
                                  pfnSavePrep, pfnSaveExec, pfnSaveDone,
                                  pfnLoadPrep, pfnLoadExec, pfnLoadDone);
Index: trunk/src/VBox/VMM/PDMDriver.cpp
===================================================================
--- trunk/src/VBox/VMM/PDMDriver.cpp	(revision 22479)
+++ trunk/src/VBox/VMM/PDMDriver.cpp	(revision 22480)
@@ -278,9 +278,9 @@
     AssertMsgReturn(pDrvReg->u32Version == PDM_DRVREG_VERSION, ("%#x\n", pDrvReg->u32Version), VERR_PDM_UNKNOWN_DRVREG_VERSION);
     AssertReturn(pDrvReg->szDriverName[0], VERR_PDM_INVALID_DRIVER_REGISTRATION);
-    AssertMsgReturn(memchr(pDrvReg->szDriverName, '\0', sizeof(pDrvReg->szDriverName)), 
+    AssertMsgReturn(memchr(pDrvReg->szDriverName, '\0', sizeof(pDrvReg->szDriverName)),
                     (".*s\n", sizeof(pDrvReg->szDriverName), pDrvReg->szDriverName),
                     VERR_PDM_INVALID_DRIVER_REGISTRATION);
     AssertMsgReturn((pDrvReg->fFlags & PDM_DRVREG_FLAGS_HOST_BITS_MASK) == PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
-                    ("%s: fFlags=%#x\n", pDrvReg->szDriverName, pDrvReg->fFlags),  
+                    ("%s: fFlags=%#x\n", pDrvReg->szDriverName, pDrvReg->fFlags),
                     VERR_PDM_INVALID_DRIVER_HOST_BITS);
     AssertMsgReturn(pDrvReg->cMaxInstances > 0, ("%s: %#x\n", pDrvReg->szDriverName, pDrvReg->cMaxInstances),
@@ -290,7 +290,7 @@
     AssertMsgReturn(VALID_PTR(pDrvReg->pfnConstruct), ("%s: %p\n", pDrvReg->szDriverName, pDrvReg->pfnConstruct),
                     VERR_PDM_INVALID_DRIVER_REGISTRATION);
-    AssertMsgReturn(pDrvReg->pfnSoftReset == NULL, ("%s: %p\n", pDrvReg->szDriverName, pDrvReg->pfnSoftReset), 
+    AssertMsgReturn(pDrvReg->pfnSoftReset == NULL, ("%s: %p\n", pDrvReg->szDriverName, pDrvReg->pfnSoftReset),
                     VERR_PDM_INVALID_DRIVER_REGISTRATION);
-    AssertMsgReturn(pDrvReg->u32VersionEnd == PDM_DRVREG_VERSION, ("%s: #x\n", pDrvReg->szDriverName, pDrvReg->u32VersionEnd), 
+    AssertMsgReturn(pDrvReg->u32VersionEnd == PDM_DRVREG_VERSION, ("%s: #x\n", pDrvReg->szDriverName, pDrvReg->u32VersionEnd),
                     VERR_PDM_INVALID_DRIVER_REGISTRATION);
 
@@ -393,5 +393,5 @@
  *
  * @param   pDrvIns     Pointer to the driver instance to start with.
- * @param   fFlags      PDM_TACH_FLAGS_NOT_HOT_PLUG or 0. 
+ * @param   fFlags      PDM_TACH_FLAGS_NOT_HOT_PLUG or 0.
  */
 void pdmR3DrvDestroyChain(PPDMDRVINS pDrvIns, uint32_t fFlags)
@@ -855,5 +855,6 @@
 
 /** @copydoc PDMDRVHLP::pfnSSMRegister */
-static DECLCALLBACK(int) pdmR3DrvHlp_SSMRegister(PPDMDRVINS pDrvIns, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess,
+static DECLCALLBACK(int) pdmR3DrvHlp_SSMRegister(PPDMDRVINS pDrvIns, uint32_t uVersion, size_t cbGuess,
+                                                 PFNSSMDRVLIVEPREP pfnLivePrep, PFNSSMDRVLIVEEXEC pfnLiveExec, PFNSSMDRVLIVEVOTE pfnLiveVote,
                                                  PFNSSMDRVSAVEPREP pfnSavePrep, PFNSSMDRVSAVEEXEC pfnSaveExec, PFNSSMDRVSAVEDONE pfnSaveDone,
                                                  PFNSSMDRVLOADPREP pfnLoadPrep, PFNSSMDRVLOADEXEC pfnLoadExec, PFNSSMDRVLOADDONE pfnLoadDone)
@@ -861,8 +862,13 @@
     PDMDRV_ASSERT_DRVINS(pDrvIns);
     VM_ASSERT_EMT(pDrvIns->Internal.s.pVM);
-    LogFlow(("pdmR3DrvHlp_SSMRegister: caller='%s'/%d: pszName=%p:{%s} u32Instance=%#x u32Version=#x cbGuess=%#x pfnSavePrep=%p pfnSaveExec=%p pfnSaveDone=%p pszLoadPrep=%p pfnLoadExec=%p pfnLoaddone=%p\n",
-             pDrvIns->pDrvReg->szDriverName, pDrvIns->iInstance, pszName, pszName, u32Instance, u32Version, cbGuess, pfnSavePrep, pfnSaveExec, pfnSaveDone, pfnLoadPrep, pfnLoadExec, pfnLoadDone));
-
-    int rc = SSMR3RegisterDriver(pDrvIns->Internal.s.pVM, pDrvIns, pszName, u32Instance, u32Version, cbGuess,
+    LogFlow(("pdmR3DrvHlp_SSMRegister: caller='%s'/%d: uVersion=#x cbGuess=%#x \n"
+             "    pfnLivePrep=%p pfnLiveExec=%p pfnLiveVote=%p  pfnSavePrep=%p pfnSaveExec=%p pfnSaveDone=%p pszLoadPrep=%p pfnLoadExec=%p pfnLoaddone=%p\n",
+             pDrvIns->pDrvReg->szDriverName, pDrvIns->iInstance, uVersion, cbGuess,
+             pfnLivePrep, pfnLiveExec, pfnLiveVote,
+             pfnSavePrep, pfnSaveExec, pfnSaveDone, pfnLoadPrep, pfnLoadExec, pfnLoadDone));
+
+    int rc = SSMR3RegisterDriver(pDrvIns->Internal.s.pVM, pDrvIns, pDrvIns->pDrvReg->szDriverName, pDrvIns->iInstance,
+                                 uVersion, cbGuess,
+                                 pfnLivePrep, pfnLiveExec, pfnLiveVote,
                                  pfnSavePrep, pfnSaveExec, pfnSaveDone,
                                  pfnLoadPrep, pfnLoadExec, pfnLoadDone);
Index: trunk/src/VBox/VMM/PGM.cpp
===================================================================
--- trunk/src/VBox/VMM/PGM.cpp	(revision 22479)
+++ trunk/src/VBox/VMM/PGM.cpp	(revision 22480)
@@ -634,5 +634,5 @@
 #endif
 static DECLCALLBACK(int)  pgmR3Save(PVM pVM, PSSMHANDLE pSSM);
-static DECLCALLBACK(int)  pgmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version);
+static DECLCALLBACK(int)  pgmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase);
 static int                pgmR3ModeDataInit(PVM pVM, bool fResolveGCAndR0);
 static void               pgmR3ModeDataSwitch(PVM pVM, PVMCPU pVCpu, PGMMODE enmShw, PGMMODE enmGst);
@@ -1283,4 +1283,5 @@
 
     rc = SSMR3RegisterInternal(pVM, "pgm", 1, PGM_SAVED_STATE_VERSION, (size_t)cbRam + sizeof(PGM),
+                               NULL, NULL, NULL,
                                NULL, pgmR3Save, NULL,
                                NULL, pgmR3Load, NULL);
@@ -2675,7 +2676,7 @@
  * @param   pVM                 The VM handle.
  * @param   pSSM                The SSM handle.
- * @param   u32Version          The saved state version.
- */
-static int pgmR3LoadLocked(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version)
+ * @param   uVersion            The saved state version.
+ */
+static int pgmR3LoadLocked(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion)
 {
     PPGM        pPGM = &pVM->pgm.s;
@@ -2686,5 +2687,5 @@
      * Load basic data (required / unaffected by relocation).
      */
-    if (u32Version >= PGM_SAVED_STATE_VERSION)
+    if (uVersion >= PGM_SAVED_STATE_VERSION)
     {
         rc = SSMR3GetStruct(pSSM, pPGM, &s_aPGMFields[0]);
@@ -2697,5 +2698,5 @@
         }
     }
-    else if (u32Version >= PGM_SAVED_STATE_VERSION_RR_DESC)
+    else if (uVersion >= PGM_SAVED_STATE_VERSION_RR_DESC)
     {
         AssertRelease(pVM->cCPUs == 1);
@@ -2835,5 +2836,5 @@
         char    szDesc[256];
         szDesc[0] = '\0';
-        if (u32Version >= PGM_SAVED_STATE_VERSION_RR_DESC)
+        if (uVersion >= PGM_SAVED_STATE_VERSION_RR_DESC)
         {
             rc = SSMR3GetStrZ(pSSM, szDesc, sizeof(szDesc));
@@ -2842,5 +2843,5 @@
             /* Since we've modified the description strings in r45878, only compare
                them if the saved state is more recent. */
-            if (u32Version != PGM_SAVED_STATE_VERSION_RR_DESC)
+            if (uVersion != PGM_SAVED_STATE_VERSION_RR_DESC)
                 cchDesc = strlen(szDesc);
         }
@@ -2859,5 +2860,5 @@
                       && strcmp(szDesc, pRam->pszDesc)) )
                 /* Hack for PDMDevHlpPhysReserve(pDevIns, 0xfff80000, 0x80000, "High ROM Region"); */
-            &&  (   u32Version != PGM_SAVED_STATE_VERSION_OLD_PHYS_CODE
+            &&  (   uVersion != PGM_SAVED_STATE_VERSION_OLD_PHYS_CODE
                  || GCPhys     != UINT32_C(0xfff80000)
                  || GCPhysLast != UINT32_C(0xffffffff)
@@ -2884,5 +2885,5 @@
 
         uint32_t cPages = (GCPhysLast - GCPhys + 1) >> PAGE_SHIFT;
-        if (u32Version >= PGM_SAVED_STATE_VERSION_RR_DESC)
+        if (uVersion >= PGM_SAVED_STATE_VERSION_RR_DESC)
         {
             /*
@@ -3029,20 +3030,22 @@
  * @param   pVM             VM Handle.
  * @param   pSSM            SSM operation handle.
- * @param   u32Version      Data layout version.
- */
-static DECLCALLBACK(int) pgmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version)
+ * @param   uVersion        Data layout version.
+ * @param   uPhase          The data phase.
+ */
+static DECLCALLBACK(int) pgmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase)
 {
     int     rc;
     PPGM    pPGM = &pVM->pgm.s;
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 
     /*
      * Validate version.
      */
-    if (    u32Version != PGM_SAVED_STATE_VERSION
-        &&  u32Version != PGM_SAVED_STATE_VERSION_2_2_2
-        &&  u32Version != PGM_SAVED_STATE_VERSION_RR_DESC
-        &&  u32Version != PGM_SAVED_STATE_VERSION_OLD_PHYS_CODE)
-    {
-        AssertMsgFailed(("pgmR3Load: Invalid version u32Version=%d (current %d)!\n", u32Version, PGM_SAVED_STATE_VERSION));
+    if (    uVersion != PGM_SAVED_STATE_VERSION
+        &&  uVersion != PGM_SAVED_STATE_VERSION_2_2_2
+        &&  uVersion != PGM_SAVED_STATE_VERSION_RR_DESC
+        &&  uVersion != PGM_SAVED_STATE_VERSION_OLD_PHYS_CODE)
+    {
+        AssertMsgFailed(("pgmR3Load: Invalid version uVersion=%d (current %d)!\n", uVersion, PGM_SAVED_STATE_VERSION));
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
     }
@@ -3058,5 +3061,5 @@
      */
     pgmLock(pVM);
-    rc = pgmR3LoadLocked(pVM, pSSM, u32Version);
+    rc = pgmR3LoadLocked(pVM, pSSM, uVersion);
     pgmUnlock(pVM);
     if (RT_SUCCESS(rc))
@@ -3065,5 +3068,5 @@
          * We require a full resync now.
          */
-        for (unsigned i=0;i<pVM->cCPUs;i++)
+        for (VMCPUID i = 0; i < pVM->cCPUs; i++)
         {
             PVMCPU pVCpu = &pVM->aCpus[i];
@@ -3076,5 +3079,5 @@
         pgmR3HandlerPhysicalUpdateAll(pVM);
 
-        for (unsigned i=0;i<pVM->cCPUs;i++)
+        for (VMCPUID i = 0; i < pVM->cCPUs; i++)
         {
             PVMCPU pVCpu = &pVM->aCpus[i];
Index: trunk/src/VBox/VMM/SELM.cpp
===================================================================
--- trunk/src/VBox/VMM/SELM.cpp	(revision 22479)
+++ trunk/src/VBox/VMM/SELM.cpp	(revision 22480)
@@ -112,5 +112,5 @@
 *******************************************************************************/
 static DECLCALLBACK(int)  selmR3Save(PVM pVM, PSSMHANDLE pSSM);
-static DECLCALLBACK(int)  selmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version);
+static DECLCALLBACK(int)  selmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase);
 static DECLCALLBACK(int)  selmR3LoadDone(PVM pVM, PSSMHANDLE pSSM);
 static DECLCALLBACK(int)  selmR3GuestGDTWriteHandler(PVM pVM, RTGCPTR GCPtr, void *pvPhys, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser);
@@ -199,4 +199,5 @@
      */
     rc = SSMR3RegisterInternal(pVM, "selm", 1, SELM_SAVED_STATE_VERSION, sizeof(SELM),
+                               NULL, NULL, NULL,
                                NULL, selmR3Save, NULL,
                                NULL, selmR3Load, selmR3LoadDone);
@@ -695,16 +696,18 @@
  * @param   pVM             VM Handle.
  * @param   pSSM            SSM operation handle.
- * @param   u32Version      Data layout version.
- */
-static DECLCALLBACK(int) selmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version)
+ * @param   uVersion        Data layout version.
+ * @param   uPhase          The data phase.
+ */
+static DECLCALLBACK(int) selmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase)
 {
     LogFlow(("selmR3Load:\n"));
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 
     /*
      * Validate version.
      */
-    if (u32Version != SELM_SAVED_STATE_VERSION)
-    {
-        AssertMsgFailed(("selmR3Load: Invalid version u32Version=%d!\n", u32Version));
+    if (uVersion != SELM_SAVED_STATE_VERSION)
+    {
+        AssertMsgFailed(("selmR3Load: Invalid version uVersion=%d!\n", uVersion));
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
     }
Index: trunk/src/VBox/VMM/SSM.cpp
===================================================================
--- trunk/src/VBox/VMM/SSM.cpp	(revision 22479)
+++ trunk/src/VBox/VMM/SSM.cpp	(revision 22480)
@@ -163,7 +163,4 @@
 *   Defined Constants And Macros                                               *
 *******************************************************************************/
-/** The special value for the final phase.  */
-#define SSM_PHASE_FINAL                         UINT32_MAX
-
 /** The max length of a unit name. */
 #define SSM_MAX_NAME_SIZE                       48
@@ -754,12 +751,13 @@
 *******************************************************************************/
 static int                  ssmR3LazyInit(PVM pVM);
+static DECLCALLBACK(int)    ssmR3SelfLiveExec(PVM pVM, PSSMHANDLE pSSM, uint32_t uPhase);
 static DECLCALLBACK(int)    ssmR3SelfSaveExec(PVM pVM, PSSMHANDLE pSSM);
-static DECLCALLBACK(int)    ssmR3SelfLoadExec(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version);
-static int                  ssmR3Register(PVM pVM, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess, const char *pszBefore, PSSMUNIT *ppUnit);
+static DECLCALLBACK(int)    ssmR3SelfLoadExec(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase);
+static int                  ssmR3Register(PVM pVM, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess, const char *pszBefore, PSSMUNIT *ppUnit);
 static int                  ssmR3StrmWriteBuffers(PSSMSTRM pStrm);
 static int                  ssmR3StrmReadMore(PSSMSTRM pStrm);
 static int                  ssmR3CalcChecksum(RTFILE File, uint64_t cbFile, uint32_t *pu32CRC);
 static void                 ssmR3Progress(PSSMHANDLE pSSM, uint64_t cbAdvance);
-static PSSMUNIT             ssmR3Find(PVM pVM, const char *pszName, uint32_t u32Instance);
+static PSSMUNIT             ssmR3Find(PVM pVM, const char *pszName, uint32_t uInstance);
 static int                  ssmR3DataWriteFinish(PSSMHANDLE pSSM);
 static void                 ssmR3DataWriteBegin(PSSMHANDLE pSSM);
@@ -787,5 +785,6 @@
      */
     pVM->ssm.s.fInitialized = true;
-    int rc = SSMR3RegisterInternal(pVM, "SSM", 0 /*u32Instance*/, 1/*u32Version*/, 64 /*cbGuess*/,
+    int rc = SSMR3RegisterInternal(pVM, "SSM", 0 /*uInstance*/, 1 /*uVersion*/, 64 /*cbGuess*/,
+                                   NULL /*pfnLivePrep*/, ssmR3SelfLiveExec, NULL /*pfnLiveVote*/,
                                    NULL /*pfnSavePrep*/, ssmR3SelfSaveExec, NULL /*pfnSaveDone*/,
                                    NULL /*pfnSavePrep*/, ssmR3SelfLoadExec, NULL /*pfnSaveDone*/);
@@ -796,4 +795,20 @@
 
 /**
+ * Do ssmR3SelfSaveExec in phase 0.
+ *
+ * @returns VBox status code.
+ * @param   pVM             Pointer to the shared VM structure.
+ * @param   pSSM            The SSM handle.
+ * @param   uPhase          The data phase number.
+ */
+static DECLCALLBACK(int) ssmR3SelfLiveExec(PVM pVM, PSSMHANDLE pSSM, uint32_t uPhase)
+{
+    if (uPhase == 0)
+        return ssmR3SelfSaveExec(pVM, pSSM);
+    return VINF_SUCCESS;
+}
+
+
+/**
  * For saving usful things without having to go thru the tedious process of
  * adding it to the header.
@@ -826,9 +841,10 @@
  * @param   pVM             Pointer to the shared VM structure.
  * @param   pSSM            The SSM handle.
- * @param   u32Version      The version (1).
- */
-static DECLCALLBACK(int) ssmR3SelfLoadExec(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version)
-{
-    AssertLogRelMsgReturn(u32Version == 1, ("%d", u32Version), VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION);
+ * @param   uVersion        The version (1).
+ * @param   uPhase          The phase.
+ */
+static DECLCALLBACK(int) ssmR3SelfLoadExec(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase)
+{
+    AssertLogRelMsgReturn(uVersion == 1, ("%d", uVersion), VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION);
 
     /*
@@ -860,6 +876,6 @@
  * @param   pVM             The VM handle.
  * @param   pszName         Data unit name.
- * @param   u32Instance     The instance id.
- * @param   u32Version      The data unit version.
+ * @param   uInstance       The instance id.
+ * @param   uVersion        The data unit version.
  * @param   cbGuess         The guessed data unit size.
  * @param   pszBefore       Name of data unit to be placed in front of.
@@ -868,6 +884,6 @@
  *                          Caller must fill in the missing details.
  */
-static int ssmR3Register(PVM pVM, const char *pszName, uint32_t u32Instance,
-                         uint32_t u32Version, size_t cbGuess, const char *pszBefore, PSSMUNIT *ppUnit)
+static int ssmR3Register(PVM pVM, const char *pszName, uint32_t uInstance,
+                         uint32_t uVersion, size_t cbGuess, const char *pszBefore, PSSMUNIT *ppUnit)
 {
     /*
@@ -901,5 +917,5 @@
     while (pUnit)
     {
-        if (    pUnit->u32Instance == u32Instance
+        if (    pUnit->u32Instance == uInstance
             &&  pUnit->cchName == cchName
             &&  !memcmp(pUnit->szName, pszName, cchName))
@@ -931,6 +947,6 @@
      * Fill in (some) data. (Stuff is zero'ed.)
      */
-    pUnit->u32Version   = u32Version;
-    pUnit->u32Instance  = u32Instance;
+    pUnit->u32Version   = uVersion;
+    pUnit->u32Instance  = uInstance;
     pUnit->cbGuess      = cbGuess;
     pUnit->cchName      = cchName;
@@ -967,27 +983,37 @@
  * @param   pDevIns         Device instance.
  * @param   pszName         Data unit name.
- * @param   u32Instance     The instance identifier of the data unit.
+ * @param   uInstance       The instance identifier of the data unit.
  *                          This must together with the name be unique.
- * @param   u32Version      Data layout version number.
+ * @param   uVersion        Data layout version number.
  * @param   cbGuess         The approximate amount of data in the unit.
  *                          Only for progress indicators.
  * @param   pszBefore       Name of data unit which we should be put in front
  *                          of. Optional (NULL).
+ *
+ * @param   pfnLivePrep     Prepare live save callback, optional.
+ * @param   pfnLiveExec     Execute live save callback, optional.
+ * @param   pfnLiveVote     Vote live save callback, optional.
+ *
  * @param   pfnSavePrep     Prepare save callback, optional.
  * @param   pfnSaveExec     Execute save callback, optional.
  * @param   pfnSaveDone     Done save callback, optional.
+ *
  * @param   pfnLoadPrep     Prepare load callback, optional.
  * @param   pfnLoadExec     Execute load callback, optional.
  * @param   pfnLoadDone     Done load callback, optional.
  */
-VMMR3DECL(int) SSMR3RegisterDevice(PVM pVM, PPDMDEVINS pDevIns, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess, const char *pszBefore,
+VMMR3DECL(int) SSMR3RegisterDevice(PVM pVM, PPDMDEVINS pDevIns, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess, const char *pszBefore,
+    PFNSSMDEVLIVEPREP pfnLivePrep, PFNSSMDEVLIVEEXEC pfnLiveExec, PFNSSMDEVLIVEVOTE pfnLiveVote,
     PFNSSMDEVSAVEPREP pfnSavePrep, PFNSSMDEVSAVEEXEC pfnSaveExec, PFNSSMDEVSAVEDONE pfnSaveDone,
     PFNSSMDEVLOADPREP pfnLoadPrep, PFNSSMDEVLOADEXEC pfnLoadExec, PFNSSMDEVLOADDONE pfnLoadDone)
 {
     PSSMUNIT pUnit;
-    int rc = ssmR3Register(pVM, pszName, u32Instance, u32Version, cbGuess, pszBefore, &pUnit);
+    int rc = ssmR3Register(pVM, pszName, uInstance, uVersion, cbGuess, pszBefore, &pUnit);
     if (RT_SUCCESS(rc))
     {
         pUnit->enmType = SSMUNITTYPE_DEV;
+        pUnit->u.Dev.pfnLivePrep = pfnLivePrep;
+        pUnit->u.Dev.pfnLiveExec = pfnLiveExec;
+        pUnit->u.Dev.pfnLiveVote = pfnLiveVote;
         pUnit->u.Dev.pfnSavePrep = pfnSavePrep;
         pUnit->u.Dev.pfnSaveExec = pfnSaveExec;
@@ -1010,22 +1036,29 @@
  * @param   pDrvIns         Driver instance.
  * @param   pszName         Data unit name.
- * @param   u32Instance     The instance identifier of the data unit.
+ * @param   uInstance       The instance identifier of the data unit.
  *                          This must together with the name be unique.
- * @param   u32Version      Data layout version number.
+ * @param   uVersion        Data layout version number.
  * @param   cbGuess         The approximate amount of data in the unit.
  *                          Only for progress indicators.
+ *
+ * @param   pfnLivePrep     Prepare live save callback, optional.
+ * @param   pfnLiveExec     Execute live save callback, optional.
+ * @param   pfnLiveVote     Vote live save callback, optional.
+ *
  * @param   pfnSavePrep     Prepare save callback, optional.
  * @param   pfnSaveExec     Execute save callback, optional.
  * @param   pfnSaveDone     Done save callback, optional.
+ *
  * @param   pfnLoadPrep     Prepare load callback, optional.
  * @param   pfnLoadExec     Execute load callback, optional.
  * @param   pfnLoadDone     Done load callback, optional.
  */
-VMMR3DECL(int) SSMR3RegisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess,
+VMMR3DECL(int) SSMR3RegisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess,
+    PFNSSMDRVLIVEPREP pfnLivePrep, PFNSSMDRVLIVEEXEC pfnLiveExec, PFNSSMDRVLIVEVOTE pfnLiveVote,
     PFNSSMDRVSAVEPREP pfnSavePrep, PFNSSMDRVSAVEEXEC pfnSaveExec, PFNSSMDRVSAVEDONE pfnSaveDone,
     PFNSSMDRVLOADPREP pfnLoadPrep, PFNSSMDRVLOADEXEC pfnLoadExec, PFNSSMDRVLOADDONE pfnLoadDone)
 {
     PSSMUNIT pUnit;
-    int rc = ssmR3Register(pVM, pszName, u32Instance, u32Version, cbGuess, NULL, &pUnit);
+    int rc = ssmR3Register(pVM, pszName, uInstance, uVersion, cbGuess, NULL, &pUnit);
     if (RT_SUCCESS(rc))
     {
@@ -1050,25 +1083,35 @@
  * @param   pVM             The VM handle.
  * @param   pszName         Data unit name.
- * @param   u32Instance     The instance identifier of the data unit.
+ * @param   uInstance       The instance identifier of the data unit.
  *                          This must together with the name be unique.
- * @param   u32Version      Data layout version number.
+ * @param   uVersion        Data layout version number.
  * @param   cbGuess         The approximate amount of data in the unit.
  *                          Only for progress indicators.
+ *
+ * @param   pfnLivePrep     Prepare live save callback, optional.
+ * @param   pfnLiveExec     Execute live save callback, optional.
+ * @param   pfnLiveVote     Vote live save callback, optional.
+ *
  * @param   pfnSavePrep     Prepare save callback, optional.
  * @param   pfnSaveExec     Execute save callback, optional.
  * @param   pfnSaveDone     Done save callback, optional.
+ *
  * @param   pfnLoadPrep     Prepare load callback, optional.
  * @param   pfnLoadExec     Execute load callback, optional.
  * @param   pfnLoadDone     Done load callback, optional.
  */
-VMMR3DECL(int) SSMR3RegisterInternal(PVM pVM, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess,
+VMMR3DECL(int) SSMR3RegisterInternal(PVM pVM, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess,
+    PFNSSMINTLIVEPREP pfnLivePrep, PFNSSMINTLIVEEXEC pfnLiveExec, PFNSSMINTLIVEVOTE pfnLiveVote,
     PFNSSMINTSAVEPREP pfnSavePrep, PFNSSMINTSAVEEXEC pfnSaveExec, PFNSSMINTSAVEDONE pfnSaveDone,
     PFNSSMINTLOADPREP pfnLoadPrep, PFNSSMINTLOADEXEC pfnLoadExec, PFNSSMINTLOADDONE pfnLoadDone)
 {
     PSSMUNIT pUnit;
-    int rc = ssmR3Register(pVM, pszName, u32Instance, u32Version, cbGuess, NULL, &pUnit);
+    int rc = ssmR3Register(pVM, pszName, uInstance, uVersion, cbGuess, NULL, &pUnit);
     if (RT_SUCCESS(rc))
     {
         pUnit->enmType = SSMUNITTYPE_INTERNAL;
+        pUnit->u.Internal.pfnLivePrep = pfnLivePrep;
+        pUnit->u.Internal.pfnLiveExec = pfnLiveExec;
+        pUnit->u.Internal.pfnLiveVote = pfnLiveVote;
         pUnit->u.Internal.pfnSavePrep = pfnSavePrep;
         pUnit->u.Internal.pfnSaveExec = pfnSaveExec;
@@ -1089,12 +1132,18 @@
  * @param   pVM             The VM handle.
  * @param   pszName         Data unit name.
- * @param   u32Instance     The instance identifier of the data unit.
+ * @param   uInstance       The instance identifier of the data unit.
  *                          This must together with the name be unique.
- * @param   u32Version      Data layout version number.
+ * @param   uVersion        Data layout version number.
  * @param   cbGuess         The approximate amount of data in the unit.
  *                          Only for progress indicators.
+ *
+ * @param   pfnLivePrep     Prepare live save callback, optional.
+ * @param   pfnLiveExec     Execute live save callback, optional.
+ * @param   pfnLiveVote     Vote live save callback, optional.
+ *
  * @param   pfnSavePrep     Prepare save callback, optional.
  * @param   pfnSaveExec     Execute save callback, optional.
  * @param   pfnSaveDone     Done save callback, optional.
+ *
  * @param   pfnLoadPrep     Prepare load callback, optional.
  * @param   pfnLoadExec     Execute load callback, optional.
@@ -1102,13 +1151,17 @@
  * @param   pvUser          User argument.
  */
-VMMR3DECL(int) SSMR3RegisterExternal(PVM pVM, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess,
+VMMR3DECL(int) SSMR3RegisterExternal(PVM pVM, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess,
+    PFNSSMEXTLIVEPREP pfnLivePrep, PFNSSMEXTLIVEEXEC pfnLiveExec, PFNSSMEXTLIVEVOTE pfnLiveVote,
     PFNSSMEXTSAVEPREP pfnSavePrep, PFNSSMEXTSAVEEXEC pfnSaveExec, PFNSSMEXTSAVEDONE pfnSaveDone,
     PFNSSMEXTLOADPREP pfnLoadPrep, PFNSSMEXTLOADEXEC pfnLoadExec, PFNSSMEXTLOADDONE pfnLoadDone, void *pvUser)
 {
     PSSMUNIT pUnit;
-    int rc = ssmR3Register(pVM, pszName, u32Instance, u32Version, cbGuess, NULL, &pUnit);
+    int rc = ssmR3Register(pVM, pszName, uInstance, uVersion, cbGuess, NULL, &pUnit);
     if (RT_SUCCESS(rc))
     {
         pUnit->enmType = SSMUNITTYPE_EXTERNAL;
+        pUnit->u.External.pfnLivePrep = pfnLivePrep;
+        pUnit->u.External.pfnLiveExec = pfnLiveExec;
+        pUnit->u.External.pfnLiveVote = pfnLiveVote;
         pUnit->u.External.pfnSavePrep = pfnSavePrep;
         pUnit->u.External.pfnSaveExec = pfnSaveExec;
@@ -1132,9 +1185,9 @@
  * @param   pszName         Data unit name.
  *                          Use NULL to deregister all data units for that device instance.
- * @param   u32Instance     The instance identifier of the data unit.
+ * @param   uInstance       The instance identifier of the data unit.
  *                          This must together with the name be unique.
  * @remark  Only for dynmaic data units and dynamic unloaded modules.
  */
-VMMR3DECL(int) SSMR3DeregisterDevice(PVM pVM, PPDMDEVINS pDevIns, const char *pszName, uint32_t u32Instance)
+VMMR3DECL(int) SSMR3DeregisterDevice(PVM pVM, PPDMDEVINS pDevIns, const char *pszName, uint32_t uInstance)
 {
     /*
@@ -1160,5 +1213,5 @@
                  || (   pUnit->cchName == cchName
                      && !memcmp(pUnit->szName, pszName, cchName)))
-            &&  pUnit->u32Instance == u32Instance
+            &&  pUnit->u32Instance == uInstance
             )
         {
@@ -1208,9 +1261,9 @@
  * @param   pszName         Data unit name.
  *                          Use NULL to deregister all data units for that driver instance.
- * @param   u32Instance     The instance identifier of the data unit.
+ * @param   uInstance       The instance identifier of the data unit.
  *                          This must together with the name be unique. Ignored if pszName is NULL.
  * @remark  Only for dynmaic data units and dynamic unloaded modules.
  */
-VMMR3DECL(int) SSMR3DeregisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName, uint32_t u32Instance)
+VMMR3DECL(int) SSMR3DeregisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName, uint32_t uInstance)
 {
     /*
@@ -1236,5 +1289,5 @@
                  || (   pUnit->cchName == cchName
                      && !memcmp(pUnit->szName, pszName, cchName)
-                     && pUnit->u32Instance == u32Instance))
+                     && pUnit->u32Instance == uInstance))
             )
         {
@@ -3398,12 +3451,12 @@
  * @param   pVM             VM handle.
  * @param   pszName         Data unit name.
- * @param   u32Instance     The data unit instance id.
- */
-static PSSMUNIT ssmR3Find(PVM pVM, const char *pszName, uint32_t u32Instance)
+ * @param   uInstance       The data unit instance id.
+ */
+static PSSMUNIT ssmR3Find(PVM pVM, const char *pszName, uint32_t uInstance)
 {
     size_t   cchName = strlen(pszName);
     PSSMUNIT pUnit = pVM->ssm.s.pHead;
     while (     pUnit
-           &&   (   pUnit->u32Instance != u32Instance
+           &&   (   pUnit->u32Instance != uInstance
                  || pUnit->cchName != cchName
                  || memcmp(pUnit->szName, pszName, cchName)))
@@ -3498,14 +3551,14 @@
                         {
                             case SSMUNITTYPE_DEV:
-                                rc = pUnit->u.Dev.pfnLoadExec(pUnit->u.Dev.pDevIns, pSSM, UnitHdr.u32Version);
+                                rc = pUnit->u.Dev.pfnLoadExec(pUnit->u.Dev.pDevIns, pSSM, UnitHdr.u32Version, SSM_PHASE_FINAL);
                                 break;
                             case SSMUNITTYPE_DRV:
-                                rc = pUnit->u.Drv.pfnLoadExec(pUnit->u.Drv.pDrvIns, pSSM, UnitHdr.u32Version);
+                                rc = pUnit->u.Drv.pfnLoadExec(pUnit->u.Drv.pDrvIns, pSSM, UnitHdr.u32Version, SSM_PHASE_FINAL);
                                 break;
                             case SSMUNITTYPE_INTERNAL:
-                                rc = pUnit->u.Internal.pfnLoadExec(pVM, pSSM, UnitHdr.u32Version);
+                                rc = pUnit->u.Internal.pfnLoadExec(pVM, pSSM, UnitHdr.u32Version, SSM_PHASE_FINAL);
                                 break;
                             case SSMUNITTYPE_EXTERNAL:
-                                rc = pUnit->u.External.pfnLoadExec(pSSM, pUnit->u.External.pvUser, UnitHdr.u32Version);
+                                rc = pUnit->u.External.pfnLoadExec(pSSM, pUnit->u.External.pvUser, UnitHdr.u32Version, SSM_PHASE_FINAL);
                                 break;
                         }
@@ -3677,14 +3730,14 @@
             {
                 case SSMUNITTYPE_DEV:
-                    rc = pUnit->u.Dev.pfnLoadExec(pUnit->u.Dev.pDevIns, pSSM, UnitHdr.u32Version);
+                    rc = pUnit->u.Dev.pfnLoadExec(pUnit->u.Dev.pDevIns, pSSM, UnitHdr.u32Version, UnitHdr.u32Phase);
                     break;
                 case SSMUNITTYPE_DRV:
-                    rc = pUnit->u.Drv.pfnLoadExec(pUnit->u.Drv.pDrvIns, pSSM, UnitHdr.u32Version);
+                    rc = pUnit->u.Drv.pfnLoadExec(pUnit->u.Drv.pDrvIns, pSSM, UnitHdr.u32Version, UnitHdr.u32Phase);
                     break;
                 case SSMUNITTYPE_INTERNAL:
-                    rc = pUnit->u.Internal.pfnLoadExec(pVM, pSSM, UnitHdr.u32Version);
+                    rc = pUnit->u.Internal.pfnLoadExec(pVM, pSSM, UnitHdr.u32Version, UnitHdr.u32Phase);
                     break;
                 case SSMUNITTYPE_EXTERNAL:
-                    rc = pUnit->u.External.pfnLoadExec(pSSM, pUnit->u.External.pvUser, UnitHdr.u32Version);
+                    rc = pUnit->u.External.pfnLoadExec(pSSM, pUnit->u.External.pvUser, UnitHdr.u32Version, UnitHdr.u32Phase);
                     break;
             }
Index: trunk/src/VBox/VMM/SSMInternal.h
===================================================================
--- trunk/src/VBox/VMM/SSMInternal.h	(revision 22479)
+++ trunk/src/VBox/VMM/SSMInternal.h	(revision 22480)
@@ -74,4 +74,10 @@
         struct
         {
+            /** Prepare live save. */
+            PFNSSMDEVLIVEPREP   pfnLivePrep;
+            /** Execute live save. */
+            PFNSSMDEVLIVEEXEC   pfnLiveExec;
+            /** Vote live save complete. */
+            PFNSSMDEVLIVEVOTE   pfnLiveVote;
             /** Prepare save. */
             PFNSSMDEVSAVEPREP   pfnSavePrep;
@@ -93,4 +99,10 @@
         struct
         {
+            /** Prepare live save. */
+            PFNSSMDRVLIVEPREP   pfnLivePrep;
+            /** Execute live save. */
+            PFNSSMDRVLIVEEXEC   pfnLiveExec;
+            /** Vote live save complete. */
+            PFNSSMDRVLIVEVOTE   pfnLiveVote;
             /** Prepare save. */
             PFNSSMDRVSAVEPREP   pfnSavePrep;
@@ -112,4 +124,10 @@
         struct
         {
+            /** Prepare live save. */
+            PFNSSMINTLIVEPREP   pfnLivePrep;
+            /** Execute live save. */
+            PFNSSMINTLIVEEXEC   pfnLiveExec;
+            /** Vote live save complete. */
+            PFNSSMINTLIVEVOTE   pfnLiveVote;
             /** Prepare save. */
             PFNSSMINTSAVEPREP   pfnSavePrep;
@@ -129,4 +147,10 @@
         struct
         {
+            /** Prepare live save. */
+            PFNSSMEXTLIVEPREP   pfnLivePrep;
+            /** Execute live save. */
+            PFNSSMEXTLIVEEXEC   pfnLiveExec;
+            /** Vote live save complete. */
+            PFNSSMEXTLIVEVOTE   pfnLiveVote;
             /** Prepare save. */
             PFNSSMEXTSAVEPREP   pfnSavePrep;
@@ -147,4 +171,10 @@
         struct
         {
+            /** Prepare live save. */
+            PFNRT               pfnLivePrep;
+            /** Execute live save. */
+            PFNRT               pfnLiveExec;
+            /** Vote live save complete. */
+            PFNRT               pfnLiveVote;
             /** Prepare save. */
             PFNRT               pfnSavePrep;
@@ -178,4 +208,7 @@
 } SSMUNIT;
 
+AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLivePrep, u.Dev.pfnLivePrep);
+AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLiveExec, u.Dev.pfnLiveExec);
+AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLiveVote, u.Dev.pfnLiveVote);
 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSavePrep, u.Dev.pfnSavePrep);
 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSaveExec, u.Dev.pfnSaveExec);
@@ -186,4 +219,7 @@
 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pvKey,       u.Dev.pDevIns);
 
+AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLivePrep, u.Drv.pfnLivePrep);
+AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLiveExec, u.Drv.pfnLiveExec);
+AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLiveVote, u.Drv.pfnLiveVote);
 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSavePrep, u.Drv.pfnSavePrep);
 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSaveExec, u.Drv.pfnSaveExec);
@@ -194,4 +230,7 @@
 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pvKey,       u.Drv.pDrvIns);
 
+AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLivePrep, u.Internal.pfnLivePrep);
+AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLiveExec, u.Internal.pfnLiveExec);
+AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLiveVote, u.Internal.pfnLiveVote);
 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSavePrep, u.Internal.pfnSavePrep);
 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSaveExec, u.Internal.pfnSaveExec);
@@ -201,4 +240,7 @@
 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLoadDone, u.Internal.pfnLoadDone);
 
+AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLivePrep, u.External.pfnLivePrep);
+AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLiveExec, u.External.pfnLiveExec);
+AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLiveVote, u.External.pfnLiveVote);
 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSavePrep, u.External.pfnSavePrep);
 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSaveExec, u.External.pfnSaveExec);
Index: trunk/src/VBox/VMM/TM.cpp
===================================================================
--- trunk/src/VBox/VMM/TM.cpp	(revision 22479)
+++ trunk/src/VBox/VMM/TM.cpp	(revision 22480)
@@ -162,5 +162,5 @@
 static uint64_t             tmR3CalibrateTSC(PVM pVM);
 static DECLCALLBACK(int)    tmR3Save(PVM pVM, PSSMHANDLE pSSM);
-static DECLCALLBACK(int)    tmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version);
+static DECLCALLBACK(int)    tmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase);
 static DECLCALLBACK(void)   tmR3TimerCallback(PRTTIMER pTimer, void *pvUser, uint64_t iTick);
 static void                 tmR3TimerQueueRun(PVM pVM, PTMTIMERQUEUE pQueue);
@@ -526,4 +526,5 @@
      */
     rc = SSMR3RegisterInternal(pVM, "tm", 1, TM_SAVED_STATE_VERSION, sizeof(uint64_t) * 8,
+                               NULL, NULL, NULL,
                                NULL, tmR3Save, NULL,
                                NULL, tmR3Load, NULL);
@@ -1088,10 +1089,12 @@
  * @param   pVM             VM Handle.
  * @param   pSSM            SSM operation handle.
- * @param   u32Version      Data layout version.
- */
-static DECLCALLBACK(int) tmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version)
+ * @param   uVersion        Data layout version.
+ * @param   uPhase          The data phase.
+ */
+static DECLCALLBACK(int) tmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase)
 {
     LogFlow(("tmR3Load:\n"));
 
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 #ifdef VBOX_STRICT
     for (VMCPUID i = 0; i < pVM->cCPUs; i++)
@@ -1107,7 +1110,7 @@
      * Validate version.
      */
-    if (u32Version != TM_SAVED_STATE_VERSION)
-    {
-        AssertMsgFailed(("tmR3Load: Invalid version u32Version=%d!\n", u32Version));
+    if (uVersion != TM_SAVED_STATE_VERSION)
+    {
+        AssertMsgFailed(("tmR3Load: Invalid version uVersion=%d!\n", uVersion));
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
     }
Index: trunk/src/VBox/VMM/TRPM.cpp
===================================================================
--- trunk/src/VBox/VMM/TRPM.cpp	(revision 22479)
+++ trunk/src/VBox/VMM/TRPM.cpp	(revision 22480)
@@ -439,5 +439,5 @@
 *******************************************************************************/
 static DECLCALLBACK(int) trpmR3Save(PVM pVM, PSSMHANDLE pSSM);
-static DECLCALLBACK(int) trpmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version);
+static DECLCALLBACK(int) trpmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase);
 static DECLCALLBACK(int) trpmR3GuestIDTWriteHandler(PVM pVM, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser);
 
@@ -508,4 +508,5 @@
      */
     int rc = SSMR3RegisterInternal(pVM, "trpm", 1, TRPM_SAVED_STATE_VERSION, sizeof(TRPM),
+                                   NULL, NULL, NULL,
                                    NULL, trpmR3Save, NULL,
                                    NULL, trpmR3Load, NULL);
@@ -818,17 +819,19 @@
  * @param   pVM             VM Handle.
  * @param   pSSM            SSM operation handle.
- * @param   u32Version      Data layout version.
- */
-static DECLCALLBACK(int) trpmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version)
+ * @param   uVersion        Data layout version.
+ * @param   uPhase          The data phase.
+ */
+static DECLCALLBACK(int) trpmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase)
 {
     LogFlow(("trpmR3Load:\n"));
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 
     /*
      * Validate version.
      */
-    if (    u32Version != TRPM_SAVED_STATE_VERSION
-        &&  u32Version != TRPM_SAVED_STATE_VERSION_UNI)
-    {
-        AssertMsgFailed(("trpmR3Load: Invalid version u32Version=%d!\n", u32Version));
+    if (    uVersion != TRPM_SAVED_STATE_VERSION
+        &&  uVersion != TRPM_SAVED_STATE_VERSION_UNI)
+    {
+        AssertMsgFailed(("trpmR3Load: Invalid version uVersion=%d!\n", uVersion));
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
     }
@@ -844,7 +847,7 @@
     PTRPM pTrpm = &pVM->trpm.s;
 
-    if (u32Version == TRPM_SAVED_STATE_VERSION)
-    {
-        for (unsigned i=0;i<pVM->cCPUs;i++)
+    if (uVersion == TRPM_SAVED_STATE_VERSION)
+    {
+        for (VMCPUID i = 0; i < pVM->cCPUs; i++)
         {
             PTRPMCPU pTrpmCpu = &pVM->aCpus[i].trpm.s;
Index: trunk/src/VBox/VMM/VMM.cpp
===================================================================
--- trunk/src/VBox/VMM/VMM.cpp	(revision 22479)
+++ trunk/src/VBox/VMM/VMM.cpp	(revision 22480)
@@ -110,5 +110,5 @@
 static void                 vmmR3InitRegisterStats(PVM pVM);
 static DECLCALLBACK(int)    vmmR3Save(PVM pVM, PSSMHANDLE pSSM);
-static DECLCALLBACK(int)    vmmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version);
+static DECLCALLBACK(int)    vmmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase);
 static DECLCALLBACK(void)   vmmR3YieldEMT(PVM pVM, PTMTIMER pTimer, void *pvUser);
 static int                  vmmR3ServiceCallRing3Request(PVM pVM, PVMCPU pVCpu);
@@ -169,4 +169,5 @@
      */
     rc = SSMR3RegisterInternal(pVM, "vmm", 1, VMM_SAVED_STATE_VERSION, VMM_STACK_SIZE + sizeof(RTGCPTR),
+                               NULL, NULL, NULL,
                                NULL, vmmR3Save, NULL,
                                NULL, vmmR3Load, NULL);
@@ -252,7 +253,7 @@
 
 #ifdef VBOX_STRICT_VMM_STACK
-        rc = MMR3HyperAllocOnceNoRelEx(pVM, PAGE_SIZE + VMM_STACK_SIZE + PAGE_SIZE, 
+        rc = MMR3HyperAllocOnceNoRelEx(pVM, PAGE_SIZE + VMM_STACK_SIZE + PAGE_SIZE,
 #else
-        rc = MMR3HyperAllocOnceNoRelEx(pVM, VMM_STACK_SIZE, 
+        rc = MMR3HyperAllocOnceNoRelEx(pVM, VMM_STACK_SIZE,
 #endif
                                        PAGE_SIZE, MM_TAG_VMM, fFlags, (void **)&pVCpu->vmm.s.pbEMTStackR3);
@@ -934,16 +935,18 @@
  * @param   pVM             VM Handle.
  * @param   pSSM            SSM operation handle.
- * @param   u32Version      Data layout version.
- */
-static DECLCALLBACK(int) vmmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version)
+ * @param   uVersion        Data layout version.
+ * @param   uPhase          The data phase.
+ */
+static DECLCALLBACK(int) vmmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase)
 {
     LogFlow(("vmmR3Load:\n"));
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 
     /*
      * Validate version.
      */
-    if (u32Version != VMM_SAVED_STATE_VERSION)
-    {
-        AssertMsgFailed(("vmmR3Load: Invalid version u32Version=%d!\n", u32Version));
+    if (uVersion != VMM_SAVED_STATE_VERSION)
+    {
+        AssertMsgFailed(("vmmR3Load: Invalid version uVersion=%d!\n", uVersion));
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
     }
Index: trunk/src/VBox/VMM/testcase/tstSSM.cpp
===================================================================
--- trunk/src/VBox/VMM/testcase/tstSSM.cpp	(revision 22479)
+++ trunk/src/VBox/VMM/testcase/tstSSM.cpp	(revision 22480)
@@ -186,10 +186,12 @@
  * @param   pDevIns         Device instance of the device which registered the data unit.
  * @param   pSSM            SSM operation handle.
- */
-DECLCALLBACK(int) Item01Load(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version)
-{
-    if (u32Version != 0)
-    {
-        RTPrintf("Item01: u32Version=%#x, expected 0\n", u32Version);
+ * @param   uVersion        The data layout version.
+ * @param   uPhase          The data phase.
+ */
+DECLCALLBACK(int) Item01Load(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase)
+{
+    if (uVersion != 0)
+    {
+        RTPrintf("Item01: uVersion=%#x, expected 0\n", uVersion);
         return VERR_GENERAL_FAILURE;
     }
@@ -340,10 +342,12 @@
  * @param   pDevIns         Device instance of the device which registered the data unit.
  * @param   pSSM            SSM operation handle.
- */
-DECLCALLBACK(int) Item02Load(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version)
-{
-    if (u32Version != 0)
-    {
-        RTPrintf("Item02: u32Version=%#x, expected 0\n", u32Version);
+ * @param   uVersion        The data layout version.
+ * @param   uPhase          The data phase.
+ */
+DECLCALLBACK(int) Item02Load(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase)
+{
+    if (uVersion != 0)
+    {
+        RTPrintf("Item02: uVersion=%#x, expected 0\n", uVersion);
         return VERR_GENERAL_FAILURE;
     }
@@ -452,10 +456,12 @@
  * @param   pDevIns         Device instance of the device which registered the data unit.
  * @param   pSSM            SSM operation handle.
- */
-DECLCALLBACK(int) Item03Load(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version)
-{
-    if (u32Version != 123)
-    {
-        RTPrintf("Item03: u32Version=%#x, expected 123\n", u32Version);
+ * @param   uVersion        The data layout version.
+ * @param   uPhase          The data phase.
+ */
+DECLCALLBACK(int) Item03Load(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase)
+{
+    if (uVersion != 123)
+    {
+        RTPrintf("Item03: uVersion=%#x, expected 123\n", uVersion);
         return VERR_GENERAL_FAILURE;
     }
@@ -556,10 +562,12 @@
  * @param   pDevIns         Device instance of the device which registered the data unit.
  * @param   pSSM            SSM operation handle.
- */
-DECLCALLBACK(int) Item04Load(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version)
-{
-    if (u32Version != 42)
-    {
-        RTPrintf("Item04: u32Version=%#x, expected 42\n", u32Version);
+ * @param   uVersion        The data layout version.
+ * @param   uPhase          The data phase.
+ */
+DECLCALLBACK(int) Item04Load(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase)
+{
+    if (uVersion != 42)
+    {
+        RTPrintf("Item04: uVersion=%#x, expected 42\n", uVersion);
         return VERR_GENERAL_FAILURE;
     }
@@ -698,6 +706,7 @@
      */
     rc = SSMR3RegisterDevice(pVM, NULL, "SSM Testcase Data Item no.1 (all types)", 1, 0, 256, NULL,
-        NULL, Item01Save, NULL,
-        NULL, Item01Load, NULL);
+                             NULL, NULL, NULL,
+                             NULL, Item01Save, NULL,
+                             NULL, Item01Load, NULL);
     if (RT_FAILURE(rc))
     {
@@ -707,6 +716,7 @@
 
     rc = SSMR3RegisterDevice(pVM, NULL, "SSM Testcase Data Item no.2 (rand mem)", 2, 0, _1M * 8, NULL,
-        NULL, Item02Save, NULL,
-        NULL, Item02Load, NULL);
+                             NULL, NULL, NULL,
+                             NULL, Item02Save, NULL,
+                             NULL, Item02Load, NULL);
     if (RT_FAILURE(rc))
     {
@@ -716,6 +726,7 @@
 
     rc = SSMR3RegisterDevice(pVM, NULL, "SSM Testcase Data Item no.3 (big mem)", 0, 123, 512*_1M, NULL,
-        NULL, Item03Save, NULL,
-        NULL, Item03Load, NULL);
+                             NULL, NULL, NULL,
+                             NULL, Item03Save, NULL,
+                             NULL, Item03Load, NULL);
     if (RT_FAILURE(rc))
     {
@@ -725,6 +736,7 @@
 
     rc = SSMR3RegisterDevice(pVM, NULL, "SSM Testcase Data Item no.4 (big zero mem)", 0, 42, 512*_1M, NULL,
-        NULL, Item04Save, NULL,
-        NULL, Item04Load, NULL);
+                             NULL, NULL, NULL,
+                             NULL, Item04Save, NULL,
+                             NULL, Item04Load, NULL);
     if (RT_FAILURE(rc))
     {
@@ -831,6 +843,6 @@
         return 1;
     }
-    uint32_t u32Version = 0xbadc0ded;
-    rc = SSMR3Seek(pSSM, "SSM Testcase Data Item no.2 (rand mem)", 2, &u32Version);
+    uint32_t uVersion = 0xbadc0ded;
+    rc = SSMR3Seek(pSSM, "SSM Testcase Data Item no.2 (rand mem)", 2, &uVersion);
     if (RT_FAILURE(rc))
     {
@@ -839,5 +851,5 @@
     }
     u64Start = RTTimeNanoTS();
-    rc = Item02Load(NULL, pSSM, u32Version);
+    rc = Item02Load(NULL, pSSM, uVersion, SSM_PHASE_FINAL);
     if (RT_FAILURE(rc))
     {
@@ -849,6 +861,6 @@
 
     /* 1st unit */
-    u32Version = 0xbadc0ded;
-    rc = SSMR3Seek(pSSM, "SSM Testcase Data Item no.1 (all types)", 1, &u32Version);
+    uVersion = 0xbadc0ded;
+    rc = SSMR3Seek(pSSM, "SSM Testcase Data Item no.1 (all types)", 1, &uVersion);
     if (RT_FAILURE(rc))
     {
@@ -857,5 +869,5 @@
     }
     u64Start = RTTimeNanoTS();
-    rc = Item01Load(NULL, pSSM, u32Version);
+    rc = Item01Load(NULL, pSSM, uVersion, SSM_PHASE_FINAL);
     if (RT_FAILURE(rc))
     {
@@ -867,6 +879,6 @@
 
     /* 3st unit */
-    u32Version = 0xbadc0ded;
-    rc = SSMR3Seek(pSSM, "SSM Testcase Data Item no.3 (big mem)", 0, &u32Version);
+    uVersion = 0xbadc0ded;
+    rc = SSMR3Seek(pSSM, "SSM Testcase Data Item no.3 (big mem)", 0, &uVersion);
     if (RT_FAILURE(rc))
     {
@@ -875,5 +887,5 @@
     }
     u64Start = RTTimeNanoTS();
-    rc = Item03Load(NULL, pSSM, u32Version);
+    rc = Item03Load(NULL, pSSM, uVersion, SSM_PHASE_FINAL);
     if (RT_FAILURE(rc))
     {
Index: trunk/src/recompiler/VBoxREMWrapper.cpp
===================================================================
--- trunk/src/recompiler/VBoxREMWrapper.cpp	(revision 22479)
+++ trunk/src/recompiler/VBoxREMWrapper.cpp	(revision 22480)
@@ -877,18 +877,40 @@
 };
 
-static const REMPARMDESC g_aArgsSSMIntCallback[] =
-{
-    { REMPARMDESC_FLAGS_INT,        sizeof(PVM), NULL },
-    { REMPARMDESC_FLAGS_INT,        sizeof(PSSMHANDLE), NULL },
-};
-static REMFNDESC g_SSMIntCallback =
-{
-    "SSMIntCallback", NULL, &g_aArgsSSMIntCallback[0], RT_ELEMENTS(g_aArgsSSMIntCallback), REMFNDESC_FLAGS_RET_INT, sizeof(int),  NULL
-};
-
-static const REMPARMDESC g_aArgsSSMIntLoadExecCallback[] =
+static const REMPARMDESC g_aArgsSSMIntLiveExecCallback[] =
 {
     { REMPARMDESC_FLAGS_INT,        sizeof(PVM),                NULL },
     { REMPARMDESC_FLAGS_INT,        sizeof(PSSMHANDLE),         NULL },
+    { REMPARMDESC_FLAGS_INT,        sizeof(uint32_t),           NULL },
+};
+static REMFNDESC g_SSMIntLiveExecCallback =
+{
+    "SSMIntLiveExecCallback", NULL, &g_aArgsSSMIntLiveExecCallback[0], RT_ELEMENTS(g_aArgsSSMIntLiveExecCallback), REMFNDESC_FLAGS_RET_INT, sizeof(int),  NULL
+};
+
+static const REMPARMDESC g_aArgsSSMIntLiveVoteCallback[] =
+{
+    { REMPARMDESC_FLAGS_INT,        sizeof(PVM),                NULL },
+    { REMPARMDESC_FLAGS_INT,        sizeof(PSSMHANDLE),         NULL },
+};
+static REMFNDESC g_SSMIntLiveVoteCallback =
+{
+    "SSMIntLiveVoteCallback", NULL, &g_aArgsSSMIntLiveVoteCallback[0], RT_ELEMENTS(g_aArgsSSMIntLiveVotecCallback), REMFNDESC_FLAGS_RET_INT, sizeof(bool),  NULL
+};
+
+static const REMPARMDESC g_aArgsSSMIntCallback[] =
+{
+    { REMPARMDESC_FLAGS_INT,        sizeof(PVM), NULL },
+    { REMPARMDESC_FLAGS_INT,        sizeof(PSSMHANDLE), NULL },
+};
+static REMFNDESC g_SSMIntCallback =
+{
+    "SSMIntCallback", NULL, &g_aArgsSSMIntCallback[0], RT_ELEMENTS(g_aArgsSSMIntCallback), REMFNDESC_FLAGS_RET_INT, sizeof(int),  NULL
+};
+
+static const REMPARMDESC g_aArgsSSMIntLoadExecCallback[] =
+{
+    { REMPARMDESC_FLAGS_INT,        sizeof(PVM),                NULL },
+    { REMPARMDESC_FLAGS_INT,        sizeof(PSSMHANDLE),         NULL },
+    { REMPARMDESC_FLAGS_INT,        sizeof(uint32_t),           NULL },
     { REMPARMDESC_FLAGS_INT,        sizeof(uint32_t),           NULL },
 };
@@ -904,4 +926,7 @@
     { REMPARMDESC_FLAGS_INT,        sizeof(uint32_t),           NULL },
     { REMPARMDESC_FLAGS_INT,        sizeof(size_t),             NULL },
+    { REMPARMDESC_FLAGS_PFN,        sizeof(PFNSSMINTLIVEPREP),  &g_SSMIntCallback },
+    { REMPARMDESC_FLAGS_PFN,        sizeof(PFNSSMINTLIVEEXEC),  &g_SSMIntLiveExecCallback },
+    { REMPARMDESC_FLAGS_PFN,        sizeof(PFNSSMINTLIVEVOTE),  &g_SSMIntLiveVoteCallback },
     { REMPARMDESC_FLAGS_PFN,        sizeof(PFNSSMINTSAVEPREP),  &g_SSMIntCallback },
     { REMPARMDESC_FLAGS_PFN,        sizeof(PFNSSMINTSAVEEXEC),  &g_SSMIntCallback },
Index: trunk/src/recompiler/VBoxRecompiler.c
===================================================================
--- trunk/src/recompiler/VBoxRecompiler.c	(revision 22479)
+++ trunk/src/recompiler/VBoxRecompiler.c	(revision 22480)
@@ -88,5 +88,5 @@
 *******************************************************************************/
 static DECLCALLBACK(int) remR3Save(PVM pVM, PSSMHANDLE pSSM);
-static DECLCALLBACK(int) remR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version);
+static DECLCALLBACK(int) remR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase);
 static void     remR3StateUpdate(PVM pVM, PVMCPU pVCpu);
 static int      remR3InitPhysRamSizeAndDirtyMap(PVM pVM, bool fGuarded);
@@ -339,4 +339,5 @@
      */
     rc = SSMR3RegisterInternal(pVM, "rem", 1, REM_SAVED_STATE_VERSION, sizeof(uint32_t) * 10,
+                               NULL, NULL, NULL,
                                NULL, remR3Save, NULL,
                                NULL, remR3Load, NULL);
@@ -659,7 +660,8 @@
  * @param   pVM             VM Handle.
  * @param   pSSM            SSM operation handle.
- * @param   u32Version      Data layout version.
- */
-static DECLCALLBACK(int) remR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version)
+ * @param   uVersion        Data layout version.
+ * @param   uPhase          The data phase.
+ */
+static DECLCALLBACK(int) remR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase)
 {
     uint32_t u32Dummy;
@@ -669,13 +671,15 @@
     int rc;
     PREM pRem;
+
     LogFlow(("remR3Load:\n"));
+    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
 
     /*
      * Validate version.
      */
-    if (    u32Version != REM_SAVED_STATE_VERSION
-        &&  u32Version != REM_SAVED_STATE_VERSION_VER1_6)
-    {
-        AssertMsgFailed(("remR3Load: Invalid version u32Version=%d!\n", u32Version));
+    if (    uVersion != REM_SAVED_STATE_VERSION
+        &&  uVersion != REM_SAVED_STATE_VERSION_VER1_6)
+    {
+        AssertMsgFailed(("remR3Load: Invalid version uVersion=%d!\n", uVersion));
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
     }
@@ -699,5 +703,5 @@
     Assert(!pRem->fInREM);
     SSMR3GetU32(pSSM,   &pRem->Env.hflags);
-    if (u32Version == REM_SAVED_STATE_VERSION_VER1_6)
+    if (uVersion == REM_SAVED_STATE_VERSION_VER1_6)
     {
         /* Redundant REM CPU state has to be loaded, but can be ignored. */
@@ -720,5 +724,5 @@
         pRem->Env.state |= CPU_RAW_RING0;
 
-    if (u32Version == REM_SAVED_STATE_VERSION_VER1_6)
+    if (uVersion == REM_SAVED_STATE_VERSION_VER1_6)
     {
         /*
