Index: /trunk/include/VBox/pgm.h
===================================================================
--- /trunk/include/VBox/pgm.h	(revision 17304)
+++ /trunk/include/VBox/pgm.h	(revision 17305)
@@ -284,5 +284,6 @@
       || (enmProt) == PGMROMPROT_READ_ROM_WRITE_RAM )
 
-
+VMMDECL(int)        PGMRegisterStringFormatTypes(void);
+VMMDECL(void)       PGMDeregisterStringFormatTypes(void);
 VMMDECL(RTHCPHYS)   PGMGetHyperCR3(PVM pVM);
 VMMDECL(RTHCPHYS)   PGMGetNestedCR3(PVM pVM, PGMMODE enmShadowMode);
Index: /trunk/src/VBox/VMM/PGM.cpp
===================================================================
--- /trunk/src/VBox/VMM/PGM.cpp	(revision 17304)
+++ /trunk/src/VBox/VMM/PGM.cpp	(revision 17305)
@@ -1199,4 +1199,5 @@
     VMR3AtStateRegister(pVM, pgmR3ResetNoMorePhysWritesFlag, NULL);
 #endif
+    PGMRegisterStringFormatTypes();
 
     /*
@@ -2254,4 +2255,5 @@
 VMMR3DECL(int) PGMR3Term(PVM pVM)
 {
+    PGMDeregisterStringFormatTypes();
     return PDMR3CritSectDelete(&pVM->pgm.s.CritSect);
 }
@@ -2282,4 +2284,7 @@
 static DECLCALLBACK(int) pgmR3Save(PVM pVM, PSSMHANDLE pSSM)
 {
+#ifdef VBOX_WITH_NEW_PHYS_CODE
+    AssertReleaseFailed(); /** @todo */
+#else
     PPGM pPGM = &pVM->pgm.s;
 
@@ -2361,4 +2366,5 @@
         }
     }
+#endif /* !VBOX_WITH_NEW_PHYS_CODE */
     return SSMR3PutU32(pSSM, ~0); /* terminator. */
 }
@@ -2375,4 +2381,7 @@
 static DECLCALLBACK(int) pgmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version)
 {
+#ifdef VBOX_WITH_NEW_PHYS_CODE
+    AssertReleaseFailed(); /** @todo */
+#else
     /*
      * Validate version.
@@ -2623,4 +2632,5 @@
 
     return rc;
+#endif /* !VBOX_WITH_NEW_PHYS_CODE */
 }
 
Index: /trunk/src/VBox/VMM/PGMInternal.h
===================================================================
--- /trunk/src/VBox/VMM/PGMInternal.h	(revision 17304)
+++ /trunk/src/VBox/VMM/PGMInternal.h	(revision 17305)
@@ -545,4 +545,7 @@
     /** MMIO2 page. (RWX) */
     PGMPAGETYPE_MMIO2,
+    /** MMIO2 page aliased over an MMIO page. (RWX)
+     * See PGMHandlerPhysicalPageAlias(). */
+    PGMPAGETYPE_MMIO2_ALIAS_MMIO,
     /** Shadowed ROM. (RWX) */
     PGMPAGETYPE_ROM_SHADOW,
@@ -554,5 +557,5 @@
     PGMPAGETYPE_END
 } PGMPAGETYPE;
-AssertCompile(PGMPAGETYPE_END < 7);
+AssertCompile(PGMPAGETYPE_END <= 7);
 
 /** @name Page type predicates.
@@ -578,6 +581,10 @@
 {
     /** The physical address and a whole lot of other stuff. All bits are used! */
+#ifdef VBOX_WITH_NEW_PHYS_CODE
+    RTHCPHYS    HCPhysX;
+#else
     RTHCPHYS    HCPhys;
 #define HCPhysX HCPhys /**< Temporary while in the process of eliminating direct access to PGMPAGE::HCPhys. */
+#endif
     /** The page state. */
     uint32_t    u2StateX : 2;
Index: /trunk/src/VBox/VMM/VMMAll/PGMAll.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/PGMAll.cpp	(revision 17304)
+++ /trunk/src/VBox/VMM/VMMAll/PGMAll.cpp	(revision 17305)
@@ -982,4 +982,5 @@
 }
 
+
 /**
  * Gets the pointer to the shadow page directory entry for an address, PAE.
@@ -1008,6 +1009,6 @@
     return VINF_SUCCESS;
 }
-#endif
-
+
+#endif /* VBOX_WITH_PGMPOOL_PAGING_ONLY */
 #ifndef IN_RC
 
@@ -1546,4 +1547,5 @@
     return pVM->pgm.s.HCPhysShwCR3;
 }
+
 
 /**
@@ -2196,6 +2198,6 @@
 }
 
-
 # ifdef IN_RC
+
 /**
  * Temporarily maps one host page specified by HC physical address.
@@ -2287,4 +2289,5 @@
 }
 
+
 /**
  * Temporarily lock a dynamic page to prevent it from being reused.
@@ -2305,4 +2308,5 @@
 }
 
+
 /**
  * Unlock a dynamic page
@@ -2323,5 +2327,6 @@
 }
 
-# ifdef VBOX_STRICT
+
+#  ifdef VBOX_STRICT
 /**
  * Check for lock leaks.
@@ -2334,8 +2339,139 @@
         Assert(!(pVM->pgm.s.paDynPageMap32BitPTEsGC[i].u & PGM_PTFLAGS_DYN_LOCKED));
 }
+#  endif /* VBOX_STRICT */
+
+# endif /* IN_RC */
+#endif /* IN_RC || VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 */
+
+#ifdef LOG_ENABLED
+
+/** Format handler for PGMPAGE.
+ * @copydoc FNRTSTRFORMATTYPE */
+static DECLCALLBACK(size_t) pgmFormatTypeHandlerPage(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
+                                                    const char *pszType, void const *pvValue,
+                                                    int cchWidth, int cchPrecision, unsigned fFlags,
+                                                    void *pvUser)
+{
+    size_t    cch;
+    PCPGMPAGE pPage = (PCPGMPAGE)pvValue;
+    if (VALID_PTR(pPage))
+    {
+        char szTmp[80];
+        switch (PGM_PAGE_GET_TYPE(pPage))
+        {
+            case PGMPAGETYPE_RAM:
+                cch = RTStrPrintf(szTmp, sizeof(szTmp), "%RHp-RAM", PGM_PAGE_GET_HCPHYS(pPage));
+                break;
+            case PGMPAGETYPE_MMIO2:
+                cch = RTStrPrintf(szTmp, sizeof(szTmp), "%RHp-MMIO2", PGM_PAGE_GET_HCPHYS(pPage));
+                break;
+            case PGMPAGETYPE_MMIO2_ALIAS_MMIO:
+                cch = RTStrPrintf(szTmp, sizeof(szTmp), "%RHp-M2ALI", PGM_PAGE_GET_HCPHYS(pPage));
+                break;
+            case PGMPAGETYPE_ROM_SHADOW:
+                cch = RTStrPrintf(szTmp, sizeof(szTmp), "%RHp-ROMSH", PGM_PAGE_GET_HCPHYS(pPage));
+                break;
+            case PGMPAGETYPE_ROM:
+                cch = RTStrPrintf(szTmp, sizeof(szTmp), "%RHp-ROM", PGM_PAGE_GET_HCPHYS(pPage));
+                break;
+            case PGMPAGETYPE_MMIO:
+                cch = RTStrPrintf(szTmp, sizeof(szTmp), "%RHp-MMIO", PGM_PAGE_GET_HCPHYS(pPage));
+                break;
+            default:
+                cch = RTStrPrintf(szTmp, sizeof(szTmp), "%RHp-%d", PGM_PAGE_GET_HCPHYS(pPage), PGM_PAGE_GET_TYPE(pPage));
+                break;
+        }
+        cch = pfnOutput(pvArgOutput, szTmp, cch);
+    }
+    else
+        cch = pfnOutput(pvArgOutput, "<bad-pgmpage-ptr>", sizeof("<bad-pgmpage-ptr>") - 1);
+    return cch;
+}
+
+
+/** Format handler for PGMRAMRANGE.
+ * @copydoc FNRTSTRFORMATTYPE */
+static DECLCALLBACK(size_t) pgmFormatTypeHandlerRamRange(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
+                                                         const char *pszType, void const *pvValue,
+                                                         int cchWidth, int cchPrecision, unsigned fFlags,
+                                                         void *pvUser)
+{
+    size_t              cch;
+    PGMRAMRANGE const  *pRam = (PGMRAMRANGE const *)pvValue;
+    if (VALID_PTR(pRam))
+    {
+        char szTmp[80];
+        cch = RTStrPrintf(szTmp, sizeof(szTmp), "%RGp-%RGp", pRam->GCPhys, pRam->GCPhysLast);
+        cch = pfnOutput(pvArgOutput, szTmp, cch);
+    }
+    else
+        cch = pfnOutput(pvArgOutput, "<bad-pgmramrange-ptr>", sizeof("<bad-pgmramrange-ptr>") - 1);
+    return cch;
+}
+
+/** Format type andlers to be registered/deregistered. */
+static const struct
+{
+    char                szType[24];
+    PFNRTSTRFORMATTYPE  pfnHandler;
+} g_aPgmFormatTypes[] =
+{
+    { "pgmpage",        pgmFormatTypeHandlerPage },
+    { "pgmramrange",    pgmFormatTypeHandlerRamRange }
+};
+
+#endif /* LOG_ENABLED */
+
+
+/**
+ * Registers the global string format types.
+ *
+ * This should be called at module load time or in some other manner that ensure
+ * that it's called exactly one time.
+ *
+ * @returns IPRT status code on RTStrFormatTypeRegister failure.
+ */
+VMMDECL(int) PGMRegisterStringFormatTypes(void)
+{
+#ifdef LOG_ENABLED
+    int         rc = VINF_SUCCESS;
+    unsigned    i;
+    for (i = 0; RT_SUCCESS(rc) && i < RT_ELEMENTS(g_aPgmFormatTypes); i++)
+    {
+        rc = RTStrFormatTypeRegister(g_aPgmFormatTypes[i].szType, g_aPgmFormatTypes[i].pfnHandler, NULL);
+# ifdef IN_RING0
+        if (rc == VERR_ALREADY_EXISTS)
+        {
+            /* in case of cleanup failure in ring-0 */
+            RTStrFormatTypeDeregister(g_aPgmFormatTypes[i].szType);
+            rc = RTStrFormatTypeRegister(g_aPgmFormatTypes[i].szType, g_aPgmFormatTypes[i].pfnHandler, NULL);
+        }
 # endif
-# endif /* IN_RC */
-
-#endif /* IN_RC || VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 */
+    }
+    if (RT_FAILURE(rc))
+        while (i-- > 0)
+            RTStrFormatTypeDeregister(g_aPgmFormatTypes[i].szType);
+
+    return rc;
+#else
+    return VINF_SUCCESS;
+#endif
+}
+
+
+/**
+ * Deregisters the global string format types.
+ *
+ * This should be called at module unload time or in some other manner that
+ * ensure that it's called exactly one time.
+ */
+VMMDECL(void) PGMDeregisterStringFormatTypes(void)
+{
+#ifdef LOG_ENABLED
+    for (unsigned i = 0; i < RT_ELEMENTS(g_aPgmFormatTypes); i++)
+        RTStrFormatTypeDeregister(g_aPgmFormatTypes[i].szType);
+#endif
+}
+
 #ifdef VBOX_STRICT
 
Index: /trunk/src/VBox/VMM/VMMGC/VMMGC.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMGC/VMMGC.cpp	(revision 17304)
+++ /trunk/src/VBox/VMM/VMMGC/VMMGC.cpp	(revision 17305)
@@ -27,4 +27,5 @@
 #include <VBox/vmm.h>
 #include <VBox/trpm.h>
+#include <VBox/pgm.h>
 #include "VMMInternal.h"
 #include <VBox/vm.h>
@@ -89,4 +90,7 @@
             int rc = RTRCInit(u64TS);
             Log(("VMMGCEntry: VMMGC_DO_VMMGC_INIT - uArg=%u (svn revision) u64TS=%RX64; rc=%Rrc\n", uArg, u64TS, rc));
+            AssertRCReturn(rc, rc);
+
+            rc = PGMRegisterStringFormatTypes();
             AssertRCReturn(rc, rc);
 
Index: /trunk/src/VBox/VMM/VMMR0/VMMR0.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR0/VMMR0.cpp	(revision 17304)
+++ /trunk/src/VBox/VMM/VMMR0/VMMR0.cpp	(revision 17305)
@@ -91,25 +91,30 @@
             if (RT_SUCCESS(rc))
             {
-#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
-                rc = PGMR0DynMapInit();
-#endif
+                rc = PGMRegisterStringFormatTypes();
                 if (RT_SUCCESS(rc))
                 {
-                    LogFlow(("ModuleInit: g_pIntNet=%p\n", g_pIntNet));
-                    g_pIntNet = NULL;
-                    LogFlow(("ModuleInit: g_pIntNet=%p should be NULL now...\n", g_pIntNet));
-                    rc = INTNETR0Create(&g_pIntNet);
+#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
+                    rc = PGMR0DynMapInit();
+#endif
                     if (RT_SUCCESS(rc))
                     {
-                        LogFlow(("ModuleInit: returns success. g_pIntNet=%p\n", g_pIntNet));
-                        return VINF_SUCCESS;
+                        LogFlow(("ModuleInit: g_pIntNet=%p\n", g_pIntNet));
+                        g_pIntNet = NULL;
+                        LogFlow(("ModuleInit: g_pIntNet=%p should be NULL now...\n", g_pIntNet));
+                        rc = INTNETR0Create(&g_pIntNet);
+                        if (RT_SUCCESS(rc))
+                        {
+                            LogFlow(("ModuleInit: returns success. g_pIntNet=%p\n", g_pIntNet));
+                            return VINF_SUCCESS;
+                        }
+
+                        /* bail out */
+                        g_pIntNet = NULL;
+                        LogFlow(("ModuleTerm: returns %Rrc\n", rc));
+#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
+                        PGMR0DynMapTerm();
+#endif
                     }
-
-                    /* bail out */
-                    g_pIntNet = NULL;
-                    LogFlow(("ModuleTerm: returns %Rrc\n", rc));
-#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
-                    PGMR0DynMapTerm();
-#endif
+                    PGMDeregisterStringFormatTypes();
                 }
                 HWACCMR0Term();
@@ -149,4 +154,5 @@
     PGMR0DynMapTerm();
 #endif
+    PGMDeregisterStringFormatTypes();
     HWACCMR0Term();
 
