Index: trunk/src/VBox/VMM/PGM.cpp
===================================================================
--- trunk/src/VBox/VMM/PGM.cpp	(revision 6828)
+++ trunk/src/VBox/VMM/PGM.cpp	(revision 6829)
@@ -1548,13 +1548,17 @@
      * Ram ranges.
      */
-    if (pVM->pgm.s.pRamRangesHC)
-    {
-        pVM->pgm.s.pRamRangesGC = MMHyperHC2GC(pVM, pVM->pgm.s.pRamRangesHC);
-        for (PPGMRAMRANGE pCur = pVM->pgm.s.pRamRangesHC; pCur->pNextHC; pCur = pCur->pNextHC)
+    if (pVM->pgm.s.pRamRangesR3)
+    {
+        pVM->pgm.s.pRamRangesGC = MMHyperHC2GC(pVM, pVM->pgm.s.pRamRangesR3);
+        for (PPGMRAMRANGE pCur = pVM->pgm.s.pRamRangesR3; pCur->pNextR3; pCur = pCur->pNextR3)
+#ifdef VBOX_WITH_NEW_PHYS_CODE
+            pCur->pNextGC = MMHyperR3ToGC(pVM, pCur->pNextR3);
+#else
         {
-            pCur->pNextGC = MMHyperHC2GC(pVM, pCur->pNextHC);
+            pCur->pNextGC = MMHyperR3ToGC(pVM, pCur->pNextR3);
             if (pCur->pavHCChunkGC)
                 pCur->pavHCChunkGC = MMHyperHC2GC(pVM, pCur->pavHCChunkHC);
         }
+#endif
     }
 
@@ -1686,5 +1690,5 @@
      * Zero memory.
      */
-    for (PPGMRAMRANGE pRam = pVM->pgm.s.pRamRangesHC; pRam; pRam = pRam->pNextHC)
+    for (PPGMRAMRANGE pRam = pVM->pgm.s.pRamRangesR3; pRam; pRam = pRam->pNextR3)
     {
         unsigned iPage = pRam->cb >> PAGE_SHIFT;
@@ -1791,5 +1795,5 @@
      */
     i = 0;
-    for (PPGMRAMRANGE pRam = pPGM->pRamRangesHC; pRam; pRam = pRam->pNextHC, i++)
+    for (PPGMRAMRANGE pRam = pPGM->pRamRangesR3; pRam; pRam = pRam->pNextR3, i++)
     {
         /** @todo MMIO ranges may move (PCI reconfig), we currently assume they don't. */
@@ -1958,5 +1962,5 @@
      */
     i = 0;
-    for (PPGMRAMRANGE pRam = pPGM->pRamRangesHC; pRam; pRam = pRam->pNextHC, i++)
+    for (PPGMRAMRANGE pRam = pPGM->pRamRangesR3; pRam; pRam = pRam->pNextR3, i++)
     {
         /** @todo MMIO ranges may move (PCI reconfig), we currently assume they don't. */
@@ -2157,10 +2161,11 @@
                     sizeof(RTHCPTR) * 2,      "pvHC            ");
 
-    for (PPGMRAMRANGE pCur = pVM->pgm.s.pRamRangesHC; pCur; pCur = pCur->pNextHC)
+    for (PPGMRAMRANGE pCur = pVM->pgm.s.pRamRangesR3; pCur; pCur = pCur->pNextR3)
         pHlp->pfnPrintf(pHlp,
-                        "%VGp-%VGp %VHv\n",
+                        "%RGp-%RGp %RHv %s\n",
                         pCur->GCPhys,
                         pCur->GCPhysLast,
-                        pCur->pvHC);
+                        pCur->pvHC,
+                        pCur->pszDesc);
 }
 
@@ -3543,5 +3548,5 @@
     int rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL, "From     - To (incl) pvHC\n");
     PPGMRAMRANGE pRam;
-    for (pRam = pVM->pgm.s.pRamRangesHC; pRam; pRam = pRam->pNextHC)
+    for (pRam = pVM->pgm.s.pRamRangesR3; pRam; pRam = pRam->pNextR3)
     {
         rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL,
Index: trunk/src/VBox/VMM/PGMDbg.cpp
===================================================================
--- trunk/src/VBox/VMM/PGMDbg.cpp	(revision 6828)
+++ trunk/src/VBox/VMM/PGMDbg.cpp	(revision 6829)
@@ -56,7 +56,7 @@
 
 #else
-    for (PPGMRAMRANGE pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
+    for (PPGMRAMRANGE pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
          pRam;
-         pRam = CTXSUFF(pRam->pNext))
+         pRam = CTXALLSUFF(pRam->pNext))
     {
         if (pRam->fFlags & MM_RAM_FLAGS_DYNAMIC_ALLOC)
@@ -109,7 +109,7 @@
 
 #else
-    for (PPGMRAMRANGE pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
+    for (PPGMRAMRANGE pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
          pRam;
-         pRam = CTXSUFF(pRam->pNext))
+         pRam = CTXALLSUFF(pRam->pNext))
     {
         if (pRam->fFlags & MM_RAM_FLAGS_DYNAMIC_ALLOC)
@@ -176,7 +176,7 @@
         return VERR_INVALID_POINTER;
 
-    for (PPGMRAMRANGE pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
+    for (PPGMRAMRANGE pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
          pRam;
-         pRam = CTXSUFF(pRam->pNext))
+         pRam = CTXALLSUFF(pRam->pNext))
     {
         uint32_t iPage = pRam->cb >> PAGE_SHIFT;
@@ -342,7 +342,7 @@
      * bother to match across ranges.
      */
-    for (PPGMRAMRANGE pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
+    for (PPGMRAMRANGE pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
          pRam;
-         pRam = CTXSUFF(pRam->pNext))
+         pRam = CTXALLSUFF(pRam->pNext))
     {
         /*
Index: trunk/src/VBox/VMM/PGMInternal.h
===================================================================
--- trunk/src/VBox/VMM/PGMInternal.h	(revision 6828)
+++ trunk/src/VBox/VMM/PGMInternal.h	(revision 6829)
@@ -647,6 +647,8 @@
 typedef struct PGMRAMRANGE
 {
-    /** Pointer to the next RAM range - for HC. */
-    R3R0PTRTYPE(struct PGMRAMRANGE *)   pNextHC;
+    /** Pointer to the next RAM range - for R3. */
+    R3PTRTYPE(struct PGMRAMRANGE *)     pNextR3;
+    /** Pointer to the next RAM range - for R0. */
+    R0PTRTYPE(struct PGMRAMRANGE *)     pNextR0;
     /** Pointer to the next RAM range - for GC. */
     GCPTRTYPE(struct PGMRAMRANGE *)     pNextGC;
@@ -659,10 +661,12 @@
     /** MM_RAM_* flags */
     uint32_t                            fFlags;
-
+#ifdef VBOX_WITH_NEW_PHYS_CODE
+    uint32_t                            u32Alignment; /**< alignment. */
+#else
     /** HC virtual lookup ranges for chunks. Currently only used with MM_RAM_FLAGS_DYNAMIC_ALLOC ranges. */
     GCPTRTYPE(PRTHCPTR)                 pavHCChunkGC;
     /** HC virtual lookup ranges for chunks. Currently only used with MM_RAM_FLAGS_DYNAMIC_ALLOC ranges. */
     R3R0PTRTYPE(PRTHCPTR)               pavHCChunkHC;
-
+#endif
     /** Start of the HC mapping of the range.
      * For pure MMIO and dynamically allocated ranges this is NULL, while for all ranges this is a valid pointer. */
@@ -671,6 +675,13 @@
     R3PTRTYPE(const char *)             pszDesc;
 
+#ifdef VBOX_WITH_NEW_PHYS_CODE
     /** Padding to make aPage aligned on sizeof(PGMPAGE). */
-    RTR3PTR                             apvReserved[HC_ARCH_BITS == 32 ? 2 : 1];
+    uint32_t                            au32Reserved[2];
+#else
+# if HC_ARCH_BITS == 32
+    /** Padding to make aPage aligned on sizeof(PGMPAGE). */
+    uint32_t                            u32Reserved;
+# endif
+#endif
 
     /** Array of physical guest page tracking structures. */
@@ -1702,13 +1713,12 @@
 
 
-    /** Pointer to the list of RAM ranges (Phys GC -> Phys HC conversion) - for HC.
+    /** Pointer to the list of RAM ranges (Phys GC -> Phys HC conversion) - for R3.
      * This is sorted by physical address and contains no overlaps.
      * The memory locks and other conversions are managed by MM at the moment.
      */
-    R3R0PTRTYPE(PPGMRAMRANGE)       pRamRangesHC;
-    /** Pointer to the list of RAM ranges (Phys GC -> Phys HC conversion) - for GC.
-     * This is sorted by physical address and contains no overlaps.
-     * The memory locks and other conversions are managed by MM at the moment.
-     */
+    R3PTRTYPE(PPGMRAMRANGE)         pRamRangesR3;
+    /** R0 pointer corresponding to PGM::pRamRangesR3. */
+    R0PTRTYPE(PPGMRAMRANGE)         pRamRangesR0;
+    /** GC pointer corresponding to PGM::pRamRangesR3. */
     GCPTRTYPE(PPGMRAMRANGE)         pRamRangesGC;
     /** The configured RAM size. */
@@ -2255,5 +2265,5 @@
      * Optimize for the first range.
      */
-    PPGMRAMRANGE pRam = CTXSUFF(pPGM->pRamRanges);
+    PPGMRAMRANGE pRam = CTXALLSUFF(pPGM->pRamRanges);
     RTGCPHYS off = GCPhys - pRam->GCPhys;
     if (RT_UNLIKELY(off >= pRam->cb))
@@ -2261,5 +2271,5 @@
         do
         {
-            pRam = CTXSUFF(pRam->pNext);
+            pRam = CTXALLSUFF(pRam->pNext);
             if (RT_UNLIKELY(!pRam))
                 return NULL;
@@ -2289,5 +2299,5 @@
      * Optimize for the first range.
      */
-    PPGMRAMRANGE pRam = CTXSUFF(pPGM->pRamRanges);
+    PPGMRAMRANGE pRam = CTXALLSUFF(pPGM->pRamRanges);
     RTGCPHYS off = GCPhys - pRam->GCPhys;
     if (RT_UNLIKELY(off >= pRam->cb))
@@ -2295,5 +2305,5 @@
         do
         {
-            pRam = CTXSUFF(pRam->pNext);
+            pRam = CTXALLSUFF(pRam->pNext);
             if (RT_UNLIKELY(!pRam))
             {
@@ -2354,5 +2364,5 @@
         ||  RT_UNLIKELY((off = GCPhys - pRam->GCPhys) >= pRam->cb))
     {
-        pRam = CTXSUFF(pPGM->pRamRanges);
+        pRam = CTXALLSUFF(pPGM->pRamRanges);
         off = GCPhys - pRam->GCPhys;
         if (RT_UNLIKELY(off >= pRam->cb))
@@ -2360,5 +2370,5 @@
             do
             {
-                pRam = CTXSUFF(pRam->pNext);
+                pRam = CTXALLSUFF(pRam->pNext);
                 if (RT_UNLIKELY(!pRam))
                 {
@@ -2412,5 +2422,5 @@
      * Optimize for the first range.
      */
-    PPGMRAMRANGE pRam = CTXSUFF(pPGM->pRamRanges);
+    PPGMRAMRANGE pRam = CTXALLSUFF(pPGM->pRamRanges);
     RTGCPHYS off = GCPhys - pRam->GCPhys;
     if (RT_UNLIKELY(off >= pRam->cb))
@@ -2418,5 +2428,5 @@
         do
         {
-            pRam = CTXSUFF(pRam->pNext);
+            pRam = CTXALLSUFF(pRam->pNext);
             if (RT_UNLIKELY(!pRam))
                 return NULL;
@@ -2447,5 +2457,5 @@
      * Optimize for the first range.
      */
-    PPGMRAMRANGE pRam = CTXSUFF(pPGM->pRamRanges);
+    PPGMRAMRANGE pRam = CTXALLSUFF(pPGM->pRamRanges);
     RTGCPHYS off = GCPhys - pRam->GCPhys;
     if (RT_UNLIKELY(off >= pRam->cb))
@@ -2453,5 +2463,5 @@
         do
         {
-            pRam = CTXSUFF(pRam->pNext);
+            pRam = CTXALLSUFF(pRam->pNext);
             if (RT_UNLIKELY(!pRam))
             {
Index: trunk/src/VBox/VMM/PGMPhys.cpp
===================================================================
--- trunk/src/VBox/VMM/PGMPhys.cpp	(revision 6828)
+++ trunk/src/VBox/VMM/PGMPhys.cpp	(revision 6829)
@@ -101,5 +101,5 @@
      */
     PPGMRAMRANGE    pPrev = NULL;
-    PPGMRAMRANGE    pCur = pVM->pgm.s.pRamRangesHC;
+    PPGMRAMRANGE    pCur = pVM->pgm.s.pRamRangesR3;
     while (pCur && GCPhysLast >= pCur->GCPhys)
     {
@@ -113,5 +113,5 @@
         /* next */
         pPrev = pCur;
-        pCur = pCur->pNextHC;
+        pCur = pCur->pNextR3;
     }
 
@@ -161,17 +161,17 @@
      */
     pgmLock(pVM);
-    pNew->pNextHC = pCur;
-    //pNew->pNextR0 = pCur ? MMHyperCCToR0(pVM, pCur) : NIL_RTR0PTR;
+    pNew->pNextR3 = pCur;
+    pNew->pNextR0 = pCur ? MMHyperCCToR0(pVM, pCur) : NIL_RTR0PTR;
     pNew->pNextGC = pCur ? MMHyperCCToGC(pVM, pCur) : NIL_RTGCPTR;
     if (pPrev)
     {
-        pPrev->pNextHC = pNew;
-        //pPrev->pNextR0 = MMHyperCCToR0(pVM, pNew);
+        pPrev->pNextR3 = pNew;
+        pPrev->pNextR0 = MMHyperCCToR0(pVM, pNew);
         pPrev->pNextGC = MMHyperCCToGC(pVM, pNew);
     }
     else
     {
-        pVM->pgm.s.pRamRangesHC = pNew;
-        //pVM->pgm.s.pRamRangesR0 = MMHyperCCToR0(pVM, pNew);
+        pVM->pgm.s.pRamRangesR3 = pNew;
+        pVM->pgm.s.pRamRangesR0 = MMHyperCCToR0(pVM, pNew);
         pVM->pgm.s.pRamRangesGC = MMHyperCCToGC(pVM, pNew);
     }
@@ -229,5 +229,5 @@
      */
     PPGMRAMRANGE    pPrev = NULL;
-    PPGMRAMRANGE    pCur = pVM->pgm.s.pRamRangesHC;
+    PPGMRAMRANGE    pCur = pVM->pgm.s.pRamRangesR3;
     while (pCur)
     {
@@ -242,5 +242,5 @@
         /* next */
         pPrev = pCur;
-        pCur = pCur->pNextHC;
+        pCur = pCur->pNextR3;
     }
 
@@ -349,14 +349,17 @@
          */
         pgmLock(pVM);
-        pNew->pNextHC = pCur;
-        pNew->pNextGC = pCur ? MMHyperHC2GC(pVM, pCur) : 0;
+        pNew->pNextR3 = pCur;
+        pNew->pNextR0 = pCur ? MMHyperCCToR0(pVM, pCur) : NIL_RTR0PTR;
+        pNew->pNextGC = pCur ? MMHyperCCToGC(pVM, pCur) : NIL_RTGCPTR;
         if (pPrev)
         {
-            pPrev->pNextHC = pNew;
+            pPrev->pNextR3 = pNew;
+            pPrev->pNextR0 = MMHyperCCToR0(pVM, pNew);
             pPrev->pNextGC = GCPtrNew;
         }
         else
         {
-            pVM->pgm.s.pRamRangesHC = pNew;
+            pVM->pgm.s.pRamRangesR3 = pNew;
+            pVM->pgm.s.pRamRangesR0 = MMHyperCCToR0(pVM, pNew);
             pVM->pgm.s.pRamRangesGC = GCPtrNew;
         }
@@ -415,5 +418,5 @@
      * Find existing range location.
      */
-    PPGMRAMRANGE pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
+    PPGMRAMRANGE pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
     while (pRam)
     {
@@ -423,5 +426,5 @@
             break;
 
-        pRam = CTXSUFF(pRam->pNext);
+        pRam = CTXALLSUFF(pRam->pNext);
     }
     AssertReturn(pRam, VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS);
@@ -458,5 +461,5 @@
     pgmLock(pVM);
 
-    PPGMRAMRANGE pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
+    PPGMRAMRANGE pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
     while (pRam)
     {
@@ -478,5 +481,5 @@
         }
 
-        pRam = CTXSUFF(pRam->pNext);
+        pRam = CTXALLSUFF(pRam->pNext);
     }
     pgmUnlock(pVM);
@@ -605,5 +608,5 @@
     pgmLock(pVM);
     PPGMRAMRANGE    pPrev = NULL;
-    PPGMRAMRANGE    pCur = pVM->pgm.s.pRamRangesHC;
+    PPGMRAMRANGE    pCur = pVM->pgm.s.pRamRangesR3;
     while (pCur)
     {
@@ -613,14 +616,16 @@
         /* next */
         pPrev = pCur;
-        pCur = pCur->pNextHC;
+        pCur = pCur->pNextR3;
     }
     if (pPrev)
     {
-        pPrev->pNextHC = pCur->pNextHC;
+        pPrev->pNextR3 = pCur->pNextR3;
+        pPrev->pNextR0 = pCur->pNextR0;
         pPrev->pNextGC = pCur->pNextGC;
     }
     else
     {
-        pVM->pgm.s.pRamRangesHC = pCur->pNextHC;
+        pVM->pgm.s.pRamRangesR3 = pCur->pNextR3;
+        pVM->pgm.s.pRamRangesR0 = pCur->pNextR0;
         pVM->pgm.s.pRamRangesGC = pCur->pNextGC;
     }
@@ -637,5 +642,5 @@
      */
     pPrev = NULL;
-    pCur = pVM->pgm.s.pRamRangesHC;
+    pCur = pVM->pgm.s.pRamRangesR3;
     while (pCur)
     {
@@ -651,5 +656,5 @@
         /* next */
         pPrev = pCur;
-        pCur = pCur->pNextHC;
+        pCur = pCur->pNextR3;
     }
 
@@ -657,15 +662,18 @@
      * Reinsert the RAM range.
      */
-    pNew->pNextHC = pCur;
-    pNew->pNextGC = pCur ? MMHyperHC2GC(pVM, pCur) : 0;
+    pNew->pNextR3 = pCur;
+    pNew->pNextR0 = pCur ? MMHyperCCToR0(pVM, pCur) : 0;
+    pNew->pNextGC = pCur ? MMHyperCCToGC(pVM, pCur) : 0;
     if (pPrev)
     {
-        pPrev->pNextHC = pNew;
-        pPrev->pNextGC = MMHyperHC2GC(pVM, pNew);
+        pPrev->pNextR3 = pNew;
+        pPrev->pNextR0 = MMHyperCCToR0(pVM, pNew);
+        pPrev->pNextGC = MMHyperCCToGC(pVM, pNew);
     }
     else
     {
-        pVM->pgm.s.pRamRangesHC = pNew;
-        pVM->pgm.s.pRamRangesGC = MMHyperHC2GC(pVM, pNew);
+        pVM->pgm.s.pRamRangesR3 = pNew;
+        pVM->pgm.s.pRamRangesR0 = MMHyperCCToR0(pVM, pNew);
+        pVM->pgm.s.pRamRangesGC = MMHyperCCToGC(pVM, pNew);
     }
 
@@ -703,7 +711,7 @@
      * Lookup the range.
      */
-    PPGMRAMRANGE    pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
+    PPGMRAMRANGE    pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
     while (pRam && GCPhys > pRam->GCPhysLast)
-        pRam = CTXSUFF(pRam->pNext);
+        pRam = CTXALLSUFF(pRam->pNext);
     if (    !pRam
         ||  GCPhys > pRam->GCPhysLast
Index: trunk/src/VBox/VMM/VMMAll/PGMAll.cpp
===================================================================
--- trunk/src/VBox/VMM/VMMAll/PGMAll.cpp	(revision 6828)
+++ trunk/src/VBox/VMM/VMMAll/PGMAll.cpp	(revision 6829)
@@ -1571,5 +1571,5 @@
      * Check the RAM flags against the handlers.
      */
-    for (PPGMRAMRANGE pRam = CTXSUFF(pPGM->pRamRanges); pRam; pRam = CTXSUFF(pRam->pNext))
+    for (PPGMRAMRANGE pRam = CTXALLSUFF(pPGM->pRamRanges); pRam; pRam = CTXALLSUFF(pRam->pNext))
     {
         const unsigned cPages = pRam->cb >> PAGE_SHIFT;
Index: trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
===================================================================
--- trunk/src/VBox/VMM/VMMAll/PGMAllBth.h	(revision 6828)
+++ trunk/src/VBox/VMM/VMMAll/PGMAllBth.h	(revision 6829)
@@ -1091,7 +1091,7 @@
      * Find the guest address.
      */
-    for (PPGMRAMRANGE pRam = pVM->pgm.s.CTXSUFF(pRamRanges);
+    for (PPGMRAMRANGE pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
          pRam;
-         pRam = pRam->CTXSUFF(pNext))
+         pRam = CTXALLSUFF(pRam->pNext))
     {
         unsigned iPage = pRam->cb >> PAGE_SHIFT;
@@ -2163,5 +2163,5 @@
                   GCPtrPage, PdeSrc.b.u1Present, PdeSrc.b.u1Write, PdeSrc.b.u1User, (uint64_t)PdeSrc.u, GCPtr,
                   GCPhys, PdeDst.u & PGM_PDFLAGS_TRACK_DIRTY ? " Track-Dirty" : ""));
-            PPGMRAMRANGE        pRam   = CTXSUFF(pVM->pgm.s.pRamRanges);
+            PPGMRAMRANGE        pRam   = CTXALLSUFF(pVM->pgm.s.pRamRanges);
             unsigned            iPTDst = 0;
             while (iPTDst < ELEMENTS(pPTDst->a))
@@ -2169,5 +2169,5 @@
                 /* Advance ram range list. */
                 while (pRam && GCPhys > pRam->GCPhysLast)
-                    pRam = CTXSUFF(pRam->pNext);
+                    pRam = CTXALLSUFF(pRam->pNext);
                 if (pRam && GCPhys >= pRam->GCPhys)
                 {
Index: trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp
===================================================================
--- trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp	(revision 6828)
+++ trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp	(revision 6829)
@@ -115,7 +115,7 @@
      * There is no apparent need to support ranges which cover more than one ram range.
      */
-    PPGMRAMRANGE    pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
+    PPGMRAMRANGE    pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
     while (pRam && GCPhys > pRam->GCPhysLast)
-        pRam = CTXSUFF(pRam->pNext);
+        pRam = CTXALLSUFF(pRam->pNext);
     if (    !pRam
         ||  GCPhysLast < pRam->GCPhys
@@ -138,7 +138,7 @@
 
             /* search again. */
-            pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
+            pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
             while (pRam && GCPhys > pRam->GCPhysLast)
-                pRam = CTXSUFF(pRam->pNext);
+                pRam = CTXALLSUFF(pRam->pNext);
         }
 
@@ -505,7 +505,7 @@
              * There is no apparent need to support ranges which cover more than one ram range.
              */
-            PPGMRAMRANGE    pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
+            PPGMRAMRANGE    pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
             while (pRam && GCPhys > pRam->GCPhysLast)
-                pRam = CTXSUFF(pRam->pNext);
+                pRam = CTXALLSUFF(pRam->pNext);
             if (    pRam
                 &&  GCPhys <= pRam->GCPhysLast
@@ -797,7 +797,7 @@
                  */
                 STAM_COUNTER_INC(&pVM->pgm.s.StatHandlePhysicalReset);
-                PPGMRAMRANGE    pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
+                PPGMRAMRANGE    pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
                 while (pRam && GCPhys > pRam->GCPhysLast)
-                    pRam = CTXSUFF(pRam->pNext);
+                    pRam = CTXALLSUFF(pRam->pNext);
                 int rc = pgmHandlerPhysicalSetRamFlagsAndFlushShadowPTs(pVM, pCur, pRam);
                 if (rc == VINF_PGM_GCPHYS_ALIASED)
Index: trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
===================================================================
--- trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp	(revision 6828)
+++ trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp	(revision 6829)
@@ -476,5 +476,5 @@
      * 99.8% of requests are expected to be in the first range.
      */
-    PPGMRAMRANGE pRam = CTXSUFF(pPGM->pRamRanges);
+    PPGMRAMRANGE pRam = CTXALLSUFF(pPGM->pRamRanges);
     RTGCPHYS off = GCPhys - pRam->GCPhys;
     if (RT_UNLIKELY(off >= pRam->cb))
@@ -482,5 +482,5 @@
         do
         {
-            pRam = CTXSUFF(pRam->pNext);
+            pRam = CTXALLSUFF(pRam->pNext);
             if (!pRam)
                 return VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS;
@@ -1028,21 +1028,21 @@
      * Copy loop on ram ranges.
      */
-    PPGMRAMRANGE    pCur = CTXSUFF(pVM->pgm.s.pRamRanges);
+    PPGMRAMRANGE pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
     for (;;)
     {
         /* Find range. */
-        while (pCur && GCPhys > pCur->GCPhysLast)
-            pCur = CTXSUFF(pCur->pNext);
+        while (pRam && GCPhys > pRam->GCPhysLast)
+            pRam = CTXALLSUFF(pRam->pNext);
         /* Inside range or not? */
-        if (pCur && GCPhys >= pCur->GCPhys)
+        if (pRam && GCPhys >= pRam->GCPhys)
         {
             /*
              * Must work our way thru this page by page.
              */
-            RTGCPHYS off = GCPhys - pCur->GCPhys;
-            while (off < pCur->cb)
+            RTGCPHYS off = GCPhys - pRam->GCPhys;
+            while (off < pRam->cb)
             {
                 unsigned iPage = off >> PAGE_SHIFT;
-                PPGMPAGE pPage = &pCur->aPages[iPage];
+                PPGMPAGE pPage = &pRam->aPages[iPage];
                 size_t   cb;
 
@@ -1079,5 +1079,5 @@
                             pvSrc = (char *)pvSrc + (off & PAGE_OFFSET_MASK);
 #else
-                            void *pvSrc = PGMRAMRANGE_GETHCPTR(pCur, off)
+                            void *pvSrc = PGMRAMRANGE_GETHCPTR(pRam, off)
 #endif
                             cb = PAGE_SIZE - (off & PAGE_OFFSET_MASK);
@@ -1128,5 +1128,5 @@
                                     cb = cbRead;
 
-                                void *pvSrc = PGMRAMRANGE_GETHCPTR(pCur, off)
+                                void *pvSrc = PGMRAMRANGE_GETHCPTR(pRam, off)
 
                                 /** @note Dangerous assumption that HC handlers don't do anything that really requires an EMT lock! */
@@ -1141,5 +1141,5 @@
                                 pvSrc = (char *)pvSrc + (off & PAGE_OFFSET_MASK);
 #else
-                                void *pvSrc = PGMRAMRANGE_GETHCPTR(pCur, off)
+                                void *pvSrc = PGMRAMRANGE_GETHCPTR(pRam, off)
 #endif
 
@@ -1175,5 +1175,5 @@
                                                   + (iPage << PAGE_SHIFT) + (off & PAGE_OFFSET_MASK);
 
-                                void *pvSrc = PGMRAMRANGE_GETHCPTR(pCur, off)
+                                void *pvSrc = PGMRAMRANGE_GETHCPTR(pRam, off)
 
                                 /** @note Dangerous assumption that HC handlers don't do anything that really requires an EMT lock! */
@@ -1188,5 +1188,5 @@
                                 pvSrc = (char *)pvSrc + (off & PAGE_OFFSET_MASK);
 #else
-                                void *pvSrc = PGMRAMRANGE_GETHCPTR(pCur, off)
+                                void *pvSrc = PGMRAMRANGE_GETHCPTR(pRam, off)
 #endif
                                 if (cb >= cbRead)
@@ -1225,5 +1225,5 @@
             }
 
-            GCPhys = pCur->GCPhysLast + 1;
+            GCPhys = pRam->GCPhysLast + 1;
         }
         else
@@ -1235,6 +1235,6 @@
              */
             size_t cb;
-            if (    !pCur
-                ||  (cb = pCur->GCPhys - GCPhys) >= cbRead)
+            if (    !pRam
+                ||  (cb = pRam->GCPhys - GCPhys) >= cbRead)
             {
                 memset(pvBuf, 0, cbRead);
@@ -1290,21 +1290,21 @@
      * Copy loop on ram ranges.
      */
-    PPGMRAMRANGE    pCur = CTXSUFF(pVM->pgm.s.pRamRanges);
+    PPGMRAMRANGE    pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
     for (;;)
     {
         /* Find range. */
-        while (pCur && GCPhys > pCur->GCPhysLast)
-            pCur = CTXSUFF(pCur->pNext);
+        while (pRam && GCPhys > pRam->GCPhysLast)
+            pRam = CTXALLSUFF(pRam->pNext);
         /* Inside range or not? */
-        if (pCur && GCPhys >= pCur->GCPhys)
+        if (pRam && GCPhys >= pRam->GCPhys)
         {
             /*
              * Must work our way thru this page by page.
              */
-            unsigned off = GCPhys - pCur->GCPhys;
-            while (off < pCur->cb)
+            unsigned off = GCPhys - pRam->GCPhys;
+            while (off < pRam->cb)
             {
                 unsigned iPage = off >> PAGE_SHIFT;
-                PPGMPAGE pPage = &pCur->aPages[iPage];
+                PPGMPAGE pPage = &pRam->aPages[iPage];
 
                 /* Physical chunk in dynamically allocated range not present? */
@@ -1318,5 +1318,5 @@
                         rc = pgmr3PhysGrowRange(pVM, GCPhys);
                         if (rc == VINF_SUCCESS)
-                            PGMPhysWrite(pVM, GCPhys, pvBuf, cbWrite); /* try again; can't assume pCur is still valid (paranoia) */
+                            PGMPhysWrite(pVM, GCPhys, pvBuf, cbWrite); /* try again; can't assume pRam is still valid (paranoia) */
                         return;
                     }
@@ -1345,5 +1345,5 @@
                         pvDst = (char *)pvDst + (off & PAGE_OFFSET_MASK);
 #else
-                        void *pvDst = PGMRAMRANGE_GETHCPTR(pCur, off)
+                        void *pvDst = PGMRAMRANGE_GETHCPTR(pRam, off)
 #endif
                         cb = PAGE_SIZE - (off & PAGE_OFFSET_MASK);
@@ -1392,5 +1392,5 @@
                                 cb = cbWrite;
 
-                            void *pvDst = PGMRAMRANGE_GETHCPTR(pCur, off)
+                            void *pvDst = PGMRAMRANGE_GETHCPTR(pRam, off)
 
                             /** @note Dangerous assumption that HC handlers don't do anything that really requires an EMT lock! */
@@ -1405,5 +1405,5 @@
                             pvDst = (char *)pvDst + (off & PAGE_OFFSET_MASK);
 #else
-                            void *pvDst = PGMRAMRANGE_GETHCPTR(pCur, off)
+                            void *pvDst = PGMRAMRANGE_GETHCPTR(pRam, off)
 #endif
                             if (cb >= cbWrite)
@@ -1440,5 +1440,5 @@
                                               + (iPage << PAGE_SHIFT) + (off & PAGE_OFFSET_MASK);
 
-                            void *pvDst = PGMRAMRANGE_GETHCPTR(pCur, off)
+                            void *pvDst = PGMRAMRANGE_GETHCPTR(pRam, off)
 
                             /** @note Dangerous assumption that HC handlers don't do anything that really requires an EMT lock! */
@@ -1453,5 +1453,5 @@
                             pvDst = (char *)pvDst + (off & PAGE_OFFSET_MASK);
 #else
-                            void *pvDst = PGMRAMRANGE_GETHCPTR(pCur, off)
+                            void *pvDst = PGMRAMRANGE_GETHCPTR(pRam, off)
 #endif
                             if (cb >= cbWrite)
@@ -1489,5 +1489,5 @@
                                 cb = cbWrite;
 
-                            void *pvDst = PGMRAMRANGE_GETHCPTR(pCur, off)
+                            void *pvDst = PGMRAMRANGE_GETHCPTR(pRam, off)
 
                             /** @note Dangerous assumption that HC handlers don't do anything that really requires an EMT lock! */
@@ -1509,5 +1509,5 @@
                                               + (iPage << PAGE_SHIFT) + (off & PAGE_OFFSET_MASK);
 
-                            void *pvDst = PGMRAMRANGE_GETHCPTR(pCur, off)
+                            void *pvDst = PGMRAMRANGE_GETHCPTR(pRam, off)
 
                             /** @note Dangerous assumption that HC handlers don't do anything that really requires an EMT lock! */
@@ -1527,5 +1527,5 @@
                             pvDst = (char *)pvDst + (off & PAGE_OFFSET_MASK);
 #else
-                            void *pvDst = PGMRAMRANGE_GETHCPTR(pCur, off)
+                            void *pvDst = PGMRAMRANGE_GETHCPTR(pRam, off)
 #endif
                             if (cb >= cbWrite)
@@ -1566,5 +1566,5 @@
             }
 
-            GCPhys = pCur->GCPhysLast + 1;
+            GCPhys = pRam->GCPhysLast + 1;
         }
         else
@@ -1574,6 +1574,6 @@
              */
             size_t cb;
-            if (    !pCur
-                ||  (cb = pCur->GCPhys - GCPhys) >= cbWrite)
+            if (    !pRam
+                ||  (cb = pRam->GCPhys - GCPhys) >= cbWrite)
                 goto end;
 
@@ -1614,7 +1614,7 @@
      * Loop ram ranges.
      */
-    for (PPGMRAMRANGE pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
+    for (PPGMRAMRANGE pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
          pRam;
-         pRam = pRam->CTXSUFF(pNext))
+         pRam = CTXALLSUFF(pRam->pNext))
     {
         RTGCPHYS off = GCPhysSrc - pRam->GCPhys;
@@ -1698,7 +1698,7 @@
      * Loop ram ranges.
      */
-    for (PPGMRAMRANGE pRam = CTXSUFF(pVM->pgm.s.pRamRanges);
+    for (PPGMRAMRANGE pRam = CTXALLSUFF(pVM->pgm.s.pRamRanges);
          pRam;
-         pRam = pRam->CTXSUFF(pNext))
+         pRam = CTXALLSUFF(pRam->pNext))
     {
         RTGCPHYS off = GCPhysDst - pRam->GCPhys;
Index: trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp
===================================================================
--- trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp	(revision 6828)
+++ trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp	(revision 6829)
@@ -754,6 +754,6 @@
      * Not worth it, so flush it.
      *
-     * If we considered it to be reused, don't to back to ring-3 
-     * to emulate failed instructions since we usually cannot 
+     * If we considered it to be reused, don't to back to ring-3
+     * to emulate failed instructions since we usually cannot
      * interpret then. This may be a bit risky, in which case
      * the reuse detection must be fixed.
@@ -1631,7 +1631,7 @@
      * Clear all the GCPhys links and rebuild the phys ext free list.
      */
-    for (PPGMRAMRANGE pRam = pPool->CTXSUFF(pVM)->pgm.s.CTXSUFF(pRamRanges);
+    for (PPGMRAMRANGE pRam = pPool->CTXSUFF(pVM)->pgm.s.CTXALLSUFF(pRamRanges);
          pRam;
-         pRam = pRam->CTXSUFF(pNext))
+         pRam = CTXALLSUFF(pRam->pNext))
     {
         unsigned iPage = pRam->cb >> PAGE_SHIFT;
@@ -2625,5 +2625,5 @@
      * Walk range list.
      */
-    PPGMRAMRANGE pRam = pPool->CTXSUFF(pVM)->pgm.s.CTXSUFF(pRamRanges);
+    PPGMRAMRANGE pRam = pPool->CTXSUFF(pVM)->pgm.s.CTXALLSUFF(pRamRanges);
     while (pRam)
     {
@@ -2641,5 +2641,5 @@
             break;
         }
-        pRam = CTXSUFF(pRam->pNext);
+        pRam = CTXALLSUFF(pRam->pNext);
     }
     AssertFatalMsgFailed(("HCPhys=%VHp GCPhys=%VGp\n", HCPhys, GCPhys));
@@ -2660,5 +2660,5 @@
      * Walk range list.
      */
-    PPGMRAMRANGE pRam = pPool->CTXSUFF(pVM)->pgm.s.CTXSUFF(pRamRanges);
+    PPGMRAMRANGE pRam = pPool->CTXSUFF(pVM)->pgm.s.CTXALLSUFF(pRamRanges);
     while (pRam)
     {
@@ -2676,5 +2676,5 @@
             break;
         }
-        pRam = CTXSUFF(pRam->pNext);
+        pRam = CTXALLSUFF(pRam->pNext);
     }
 
@@ -2683,5 +2683,5 @@
      */
     STAM_COUNTER_INC(&pPool->StatTrackLinearRamSearches);
-    pRam = pPool->CTXSUFF(pVM)->pgm.s.CTXSUFF(pRamRanges);
+    pRam = pPool->CTXSUFF(pVM)->pgm.s.CTXALLSUFF(pRamRanges);
     while (pRam)
     {
@@ -2697,5 +2697,5 @@
             }
         }
-        pRam = CTXSUFF(pRam->pNext);
+        pRam = CTXALLSUFF(pRam->pNext);
     }
 
@@ -3097,7 +3097,7 @@
      * Clear all the GCPhys links and rebuild the phys ext free list.
      */
-    for (PPGMRAMRANGE pRam = pPool->CTXSUFF(pVM)->pgm.s.CTXSUFF(pRamRanges);
+    for (PPGMRAMRANGE pRam = pPool->CTXSUFF(pVM)->pgm.s.CTXALLSUFF(pRamRanges);
          pRam;
-         pRam = pRam->CTXSUFF(pNext))
+         pRam = CTXALLSUFF(pRam->pNext))
     {
         unsigned iPage = pRam->cb >> PAGE_SHIFT;
Index: trunk/src/VBox/VMM/testcase/tstVMStructGC.cpp
===================================================================
--- trunk/src/VBox/VMM/testcase/tstVMStructGC.cpp	(revision 6828)
+++ trunk/src/VBox/VMM/testcase/tstVMStructGC.cpp	(revision 6829)
@@ -420,5 +420,6 @@
     GEN_CHECK_OFF(PGM, pfnGCBthVerifyAccessSyncPage);
     GEN_CHECK_OFF(PGM, pfnGCBthAssertCR3);
-    GEN_CHECK_OFF(PGM, pRamRangesHC);
+    GEN_CHECK_OFF(PGM, pRamRangesR3);
+    GEN_CHECK_OFF(PGM, pRamRangesR0);
     GEN_CHECK_OFF(PGM, pRamRangesGC);
     GEN_CHECK_OFF(PGM, cbRamSize);
@@ -531,5 +532,6 @@
     GEN_CHECK_OFF(PGMPAGE, HCPhys);
     GEN_CHECK_SIZE(PGMRAMRANGE);
-    GEN_CHECK_OFF(PGMRAMRANGE, pNextHC);
+    GEN_CHECK_OFF(PGMRAMRANGE, pNextR3);
+    GEN_CHECK_OFF(PGMRAMRANGE, pNextR0);
     GEN_CHECK_OFF(PGMRAMRANGE, pNextGC);
     GEN_CHECK_OFF(PGMRAMRANGE, GCPhys);
