Index: /trunk/include/VBox/vmm/ssm.h
===================================================================
--- /trunk/include/VBox/vmm/ssm.h	(revision 50574)
+++ /trunk/include/VBox/vmm/ssm.h	(revision 50575)
@@ -1171,4 +1171,5 @@
                       PFNSSMEXTSAVEPREP pfnSavePrep, PFNSSMEXTSAVEEXEC pfnSaveExec, PFNSSMEXTSAVEDONE pfnSaveDone,
                       PFNSSMEXTLOADPREP pfnLoadPrep, PFNSSMEXTLOADEXEC pfnLoadExec, PFNSSMEXTLOADDONE pfnLoadDone, void *pvUser);
+VMMR3DECL(int)          SSMR3RegisterStub(PVM pVM, const char *pszName, uint32_t uInstance);
 VMMR3_INT_DECL(int)     SSMR3DeregisterDevice(PVM pVM, PPDMDEVINS pDevIns, const char *pszName, uint32_t uInstance);
 VMMR3_INT_DECL(int)     SSMR3DeregisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName, uint32_t uInstance);
Index: /trunk/src/VBox/VMM/VMMR3/CSAM.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/CSAM.cpp	(revision 50574)
+++ /trunk/src/VBox/VMM/VMMR3/CSAM.cpp	(revision 50575)
@@ -72,5 +72,4 @@
 static DECLCALLBACK(int) csamr3Save(PVM pVM, PSSMHANDLE pSSM);
 static DECLCALLBACK(int) csamr3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
-static DECLCALLBACK(int) csamR3LoadDummy(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
 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);
@@ -232,8 +231,5 @@
     {
         pVM->fCSAMEnabled = false;
-        return SSMR3RegisterInternal(pVM, "CSAM", 0, CSAM_SSM_VERSION, 0,
-                                     NULL, NULL, NULL,
-                                     NULL, NULL, NULL,
-                                     NULL, csamR3LoadDummy, NULL);
+        return SSMR3RegisterStub(pVM, "CSAM", 0);
     }
 
@@ -566,13 +562,4 @@
     /** @note we don't restore aDangerousInstr; it will be recreated automatically. */
     return VINF_SUCCESS;
-}
-
-
-/**
- * @callback_method_impl{FNSSMINTLOADEXEC, Dummy load function for HM mode.}
- */
-DECLCALLBACK(int) csamR3LoadDummy(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
-{
-    return SSMR3SkipToEndOfUnit(pSSM);
 }
 
Index: /trunk/src/VBox/VMM/VMMR3/PATM.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/PATM.cpp	(revision 50574)
+++ /trunk/src/VBox/VMM/VMMR3/PATM.cpp	(revision 50575)
@@ -146,8 +146,5 @@
     {
         pVM->fPATMEnabled = false;
-        return SSMR3RegisterInternal(pVM, "PATM", 0, PATM_SSM_VERSION, 0,
-                                     NULL, NULL, NULL,
-                                     NULL, NULL, NULL,
-                                     NULL, patmR3LoadDummy, NULL);
+        return SSMR3RegisterStub(pVM, "PATM", 0);
     }
 
Index: /trunk/src/VBox/VMM/VMMR3/PATMSSM.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/PATMSSM.cpp	(revision 50574)
+++ /trunk/src/VBox/VMM/VMMR3/PATMSSM.cpp	(revision 50575)
@@ -804,13 +804,4 @@
 
 /**
- * @callback_method_impl{FNSSMINTLOADEXEC, Dummy load function for HM mode.}
- */
-DECLCALLBACK(int) patmR3LoadDummy(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
-{
-    return SSMR3SkipToEndOfUnit(pSSM);
-}
-
-
-/**
  * Execute state load operation.
  *
Index: /trunk/src/VBox/VMM/VMMR3/SSM.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/SSM.cpp	(revision 50574)
+++ /trunk/src/VBox/VMM/VMMR3/SSM.cpp	(revision 50575)
@@ -1468,4 +1468,35 @@
     }
     return rc;
+}
+
+
+/**
+ * @callback_method_impl{FNSSMINTLOADEXEC,
+ * Stub that skips the whole unit (see SSMR3RegisterStub).}
+ */
+static DECLCALLBACK(int) ssmR3LoadExecStub(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
+{
+    NOREF(pVM); NOREF(uVersion); NOREF(uPass);
+    return SSMR3SkipToEndOfUnit(pSSM);
+}
+
+
+/**
+ * Registers a stub state loader for working around legacy.
+ *
+ * This is used to deal with irelevant PATM and CSAM saved state units in HM
+ * mode and when built without raw-mode.
+ *
+ * @returns VBox status code.
+ * @param   pVM                 The VM handle.
+ * @param   pszName             Data unit name.
+ * @param   uInstance           Instance number.
+ */
+VMMR3DECL(int) SSMR3RegisterStub(PVM pVM, const char *pszName, uint32_t uInstance)
+{
+    return SSMR3RegisterInternal(pVM, pszName, uInstance, UINT32_MAX, 0,
+                                 NULL, NULL, NULL,
+                                 NULL, NULL, NULL,
+                                 NULL, ssmR3LoadExecStub, NULL);
 }
 
Index: /trunk/src/VBox/VMM/VMMR3/VM.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/VM.cpp	(revision 50574)
+++ /trunk/src/VBox/VMM/VMMR3/VM.cpp	(revision 50575)
@@ -1166,4 +1166,10 @@
     if (RT_SUCCESS(rc))
         rc = PGMR3InitCompleted(pVM, enmWhat);
+#ifndef VBOX_WITH_RAW_MODE
+    if (RT_SUCCESS(rc))
+        rc = SSMR3RegisterStub(pVM, "CSAM", 0);
+    if (RT_SUCCESS(rc))
+        rc = SSMR3RegisterStub(pVM, "PATM", 0);
+#endif
     return rc;
 }
Index: /trunk/src/VBox/VMM/include/PATMInternal.h
===================================================================
--- /trunk/src/VBox/VMM/include/PATMInternal.h	(revision 50574)
+++ /trunk/src/VBox/VMM/include/PATMInternal.h	(revision 50575)
@@ -567,5 +567,4 @@
 DECLCALLBACK(int) patmR3Save(PVM pVM, PSSMHANDLE pSSM);
 DECLCALLBACK(int) patmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
-DECLCALLBACK(int) patmR3LoadDummy(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
 
 #ifdef IN_RING3
