Index: trunk/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
===================================================================
--- trunk/src/VBox/Runtime/r0drv/os2/memobj-r0drv-os2.cpp	(revision 3236)
+++ trunk/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c	(revision 3977)
@@ -1,5 +1,5 @@
 /* $Id$ */
 /** @file
- * innotek Portable Runtime - Ring-0 Memory Objects, OS/2.
+ * innotek Portable Runtime - Ring-0 Memory Objects, FreeBSD.
  */
 
@@ -33,5 +33,5 @@
 *   Header Files                                                               *
 *******************************************************************************/
-#include "the-os2-kernel.h"
+#include "the-freebsd-kernel.h"
 
 #include <iprt/memobj.h>
@@ -49,10 +49,11 @@
 *******************************************************************************/
 /**
- * The OS/2 version of the memory object structure.
+ * The FreeBSD version of the memory object structure.
  */
-typedef struct RTR0MEMOBJDARWIN
+typedef struct RTR0MEMOBJFREEBSD
 {
     /** The core structure. */
     RTR0MEMOBJINTERNAL  Core;
+#if 0
     /** Lock for the ring-3 / ring-0 pinned objectes.
      * This member might not be allocated for some object types. */
@@ -61,5 +62,6 @@
      * This array can be 0 in length for some object types. */
     KernPageList_t      aPages[1];
-} RTR0MEMOBJOS2, *PRTR0MEMOBJOS2;
+#endif
+} RTR0MEMOBJFREEBSD, *PRTR0MEMOBJFREEBSD;
 
 
@@ -67,20 +69,19 @@
 *   Internal Functions                                                         *
 *******************************************************************************/
-static void rtR0MemObjFixPageList(KernPageList_t *paPages, ULONG cPages, ULONG cPagesRet);
 
 
 int rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
 {
-    PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)pMem;
-    int rc;
-
-    switch (pMemOs2->Core.enmType)
+    PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)pMem;
+//    int rc;
+
+    switch (pMemFreeBSD->Core.enmType)
     {
         case RTR0MEMOBJTYPE_PHYS:
-            if (!pMemOs2->Core.pv)
+            if (!pMemFreeBSD->Core.pv)
                 break;
 
         case RTR0MEMOBJTYPE_MAPPING:
-            if (pMemOs2->Core.u.Mapping.R0Process == NIL_RTR0PROCESS)
+            if (pMemFreeBSD->Core.u.Mapping.R0Process == NIL_RTR0PROCESS)
                 break; 
 
@@ -89,16 +90,16 @@
         case RTR0MEMOBJTYPE_LOW:
         case RTR0MEMOBJTYPE_CONT:
-            rc = KernVMFree(pMemOs2->Core.pv);
-            AssertMsg(!rc, ("rc=%d type=%d pv=%p cb=%#zx\n", rc, pMemOs2->Core.enmType, pMemOs2->Core.pv, pMemOs2->Core.cb));
+            //rc = KernVMFree(pMemFreeBSD->Core.pv);
+            //AssertMsg(!rc, ("rc=%d type=%d pv=%p cb=%#zx\n", rc, pMemFreeBSD->Core.enmType, pMemFreeBSD->Core.pv, pMemFreeBSD->Core.cb));
             break;
 
         case RTR0MEMOBJTYPE_LOCK:
-            rc = KernVMUnlock(&pMemOs2->Lock);
-            AssertMsg(!rc, ("rc=%d\n", rc));
+            //rc = KernVMUnlock(&pMemFreeBSD->Lock);
+            //AssertMsg(!rc, ("rc=%d\n", rc));
             break;
 
         case RTR0MEMOBJTYPE_RES_VIRT:
         default:
-            AssertMsgFailed(("enmType=%d\n", pMemOs2->Core.enmType));
+            AssertMsgFailed(("enmType=%d\n", pMemFreeBSD->Core.enmType));
             return VERR_INTERNAL_ERROR;
     }
@@ -112,26 +113,29 @@
     NOREF(fExecutable);
 
+#if 0
     /* create the object. */
     const ULONG cPages = cb >> PAGE_SHIFT;
-    PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_PAGE, NULL, cb);
-    if (!pMemOs2)
+    PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_PAGE, NULL, cb);
+    if (!pMemFreeBSD)
         return VERR_NO_MEMORY;
 
     /* do the allocation. */
-    int rc = KernVMAlloc(cb, VMDHA_FIXED, &pMemOs2->Core.pv, (PPVOID)-1, NULL);
+    int rc = KernVMAlloc(cb, VMDHA_FIXED, &pMemFreeBSD->Core.pv, (PPVOID)-1, NULL);
     if (!rc)
     {
         ULONG cPagesRet = cPages;
-        rc = KernLinToPageList(pMemOs2->Core.pv, cb, &pMemOs2->aPages[0], &cPagesRet);
+        rc = KernLinToPageList(pMemFreeBSD->Core.pv, cb, &pMemFreeBSD->aPages[0], &cPagesRet);
         if (!rc)
         {
-            rtR0MemObjFixPageList(&pMemOs2->aPages[0], cPages, cPagesRet);
-            *ppMem = &pMemOs2->Core;
+            rtR0MemObjFixPageList(&pMemFreeBSD->aPages[0], cPages, cPagesRet);
+            *ppMem = &pMemFreeBSD->Core;
             return VINF_SUCCESS;
         }
-        KernVMFree(pMemOs2->Core.pv);
-    }
-    rtR0MemObjDelete(&pMemOs2->Core);
-    return RTErrConvertFromOS2(rc);
+        KernVMFree(pMemFreeBSD->Core.pv);
+    }
+    rtR0MemObjDelete(&pMemFreeBSD->Core);
+    return RTErrConvertFromOS2(rc);
+#endif
+    return VERR_NOT_IMPLEMENTED;
 }
 
@@ -141,26 +145,29 @@
     NOREF(fExecutable);
 
-    /* create the object. */
+#if 0
+  /* create the object. */
     const ULONG cPages = cb >> PAGE_SHIFT;
-    PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_LOW, NULL, cb);
-    if (!pMemOs2)
+    PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_LOW, NULL, cb);
+    if (!pMemFreeBSD)
         return VERR_NO_MEMORY;
 
     /* do the allocation. */
-    int rc = KernVMAlloc(cb, VMDHA_FIXED, &pMemOs2->Core.pv, (PPVOID)-1, NULL);
+    int rc = KernVMAlloc(cb, VMDHA_FIXED, &pMemFreeBSD->Core.pv, (PPVOID)-1, NULL);
     if (!rc)
     {
         ULONG cPagesRet = cPages;
-        rc = KernLinToPageList(pMemOs2->Core.pv, cb, &pMemOs2->aPages[0], &cPagesRet);
+        rc = KernLinToPageList(pMemFreeBSD->Core.pv, cb, &pMemFreeBSD->aPages[0], &cPagesRet);
         if (!rc)
         {
-            rtR0MemObjFixPageList(&pMemOs2->aPages[0], cPages, cPagesRet);
-            *ppMem = &pMemOs2->Core;
+            rtR0MemObjFixPageList(&pMemFreeBSD->aPages[0], cPages, cPagesRet);
+            *ppMem = &pMemFreeBSD->Core;
             return VINF_SUCCESS;
         }
-        KernVMFree(pMemOs2->Core.pv);
-    }
-    rtR0MemObjDelete(&pMemOs2->Core);
-    return RTErrConvertFromOS2(rc);
+        KernVMFree(pMemFreeBSD->Core.pv);
+    }
+    rtR0MemObjDelete(&pMemFreeBSD->Core);
+    return RTErrConvertFromOS2(rc);
+#endif
+    return VERR_NOT_IMPLEMENTED;
 }
 
@@ -170,21 +177,24 @@
     NOREF(fExecutable);
 
-    /* create the object. */
-    PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_CONT, NULL, cb);
-    if (!pMemOs2)
+#if 0
+    /* create the object. */
+    PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_CONT, NULL, cb);
+    if (!pMemFreeBSD)
         return VERR_NO_MEMORY;
 
     /* do the allocation. */
     ULONG ulPhys = ~0UL;
-    int rc = KernVMAlloc(cb, VMDHA_FIXED | VMDHA_CONTIG, &pMemOs2->Core.pv, (PPVOID)&ulPhys, NULL);
+    int rc = KernVMAlloc(cb, VMDHA_FIXED | VMDHA_CONTIG, &pMemFreeBSD->Core.pv, (PPVOID)&ulPhys, NULL);
     if (!rc)
     {
         Assert(ulPhys != ~0UL);
-        pMemOs2->Core.u.Cont.Phys = ulPhys;
-        *ppMem = &pMemOs2->Core;
-        return VINF_SUCCESS;
-    }
-    rtR0MemObjDelete(&pMemOs2->Core);
-    return RTErrConvertFromOS2(rc);
+        pMemFreeBSD->Core.u.Cont.Phys = ulPhys;
+        *ppMem = &pMemFreeBSD->Core;
+        return VINF_SUCCESS;
+    }
+    rtR0MemObjDelete(&pMemFreeBSD->Core);
+    return RTErrConvertFromOS2(rc);
+#endif
+    return VERR_NOT_IMPLEMENTED;
 }
 
@@ -193,23 +203,26 @@
 {
     AssertMsgReturn(PhysHighest >= 16 *_1M, ("PhysHigest=%VHp\n", PhysHighest), VERR_NOT_IMPLEMENTED);
-
-    /* create the object. */
-    PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_PHYS, NULL, cb);
-    if (!pMemOs2)
+    
+#if 0
+    /* create the object. */
+    PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_PHYS, NULL, cb);
+    if (!pMemFreeBSD)
         return VERR_NO_MEMORY;
 
     /* do the allocation. */
     ULONG ulPhys = ~0UL;
-    int rc = KernVMAlloc(cb, VMDHA_FIXED | VMDHA_CONTIG | (PhysHighest < _4G ? VMDHA_16M : 0), &pMemOs2->Core.pv, (PPVOID)&ulPhys, NULL);
+    int rc = KernVMAlloc(cb, VMDHA_FIXED | VMDHA_CONTIG | (PhysHighest < _4G ? VMDHA_16M : 0), &pMemFreeBSD->Core.pv, (PPVOID)&ulPhys, NULL);
     if (!rc)
     {
         Assert(ulPhys != ~0UL);
-        pMemOs2->Core.u.Phys.fAllocated = true;
-        pMemOs2->Core.u.Phys.PhysBase = ulPhys;
-        *ppMem = &pMemOs2->Core;
-        return VINF_SUCCESS;
-    }
-    rtR0MemObjDelete(&pMemOs2->Core);
-    return RTErrConvertFromOS2(rc);
+        pMemFreeBSD->Core.u.Phys.fAllocated = true;
+        pMemFreeBSD->Core.u.Phys.PhysBase = ulPhys;
+        *ppMem = &pMemFreeBSD->Core;
+        return VINF_SUCCESS;
+    }
+    rtR0MemObjDelete(&pMemFreeBSD->Core);
+    return RTErrConvertFromOS2(rc);
+#endif
+    return VERR_NOT_IMPLEMENTED;
 }
 
@@ -217,14 +230,17 @@
 int rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb)
 {
-    /* create the object. */
-    PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_PHYS, NULL, cb);
-    if (!pMemOs2)
+#if 0	
+    /* create the object. */
+    PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_PHYS, NULL, cb);
+    if (!pMemFreeBSD)
         return VERR_NO_MEMORY;
 
     /* there is no allocation here, right? it needs to be mapped somewhere first. */
-    pMemOs2->Core.u.Phys.fAllocated = false;
-    pMemOs2->Core.u.Phys.PhysBase = Phys;
-    *ppMem = &pMemOs2->Core;
+    pMemFreeBSD->Core.u.Phys.fAllocated = false;
+    pMemFreeBSD->Core.u.Phys.PhysBase = Phys;
+    *ppMem = &pMemFreeBSD->Core;
     return VINF_SUCCESS;
+#endif
+    return VERR_NOT_IMPLEMENTED;    
 }
 
@@ -232,26 +248,29 @@
 int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, RTR0PROCESS R0Process)
 {
+#if 0
     AssertMsgReturn(R0Process == RTR0ProcHandleSelf(), ("%p != %p\n", R0Process, RTR0ProcHandleSelf()), VERR_NOT_SUPPORTED);
 
     /* create the object. */
     const ULONG cPages = cb >> PAGE_SHIFT;
-    PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_LOCK, pv, cb);
-    if (!pMemOs2)
+    PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_LOCK, pv, cb);
+    if (!pMemFreeBSD)
         return VERR_NO_MEMORY;
 
     /* lock it. */
     ULONG cPagesRet = cPages;
-    int rc = KernVMLock(VMDHL_LONG | VMDHL_WRITE, pv, cb, &pMemOs2->Lock, &pMemOs2->aPages[0], &cPagesRet);
-    if (!rc)
-    {
-        rtR0MemObjFixPageList(&pMemOs2->aPages[0], cPages, cPagesRet);
-        Assert(cb == pMemOs2->Core.cb);
-        Assert(pv == pMemOs2->Core.pv);
-        pMemOs2->Core.u.Lock.R0Process = R0Process;
-        *ppMem = &pMemOs2->Core;
-        return VINF_SUCCESS;
-    }
-    rtR0MemObjDelete(&pMemOs2->Core);
-    return RTErrConvertFromOS2(rc);
+    int rc = KernVMLock(VMDHL_LONG | VMDHL_WRITE, pv, cb, &pMemFreeBSD->Lock, &pMemFreeBSD->aPages[0], &cPagesRet);
+    if (!rc)
+    {
+        rtR0MemObjFixPageList(&pMemFreeBSD->aPages[0], cPages, cPagesRet);
+        Assert(cb == pMemFreeBSD->Core.cb);
+        Assert(pv == pMemFreeBSD->Core.pv);
+        pMemFreeBSD->Core.u.Lock.R0Process = R0Process;
+        *ppMem = &pMemFreeBSD->Core;
+        return VINF_SUCCESS;
+    }
+    rtR0MemObjDelete(&pMemFreeBSD->Core);
+    return RTErrConvertFromOS2(rc);
+#endif
+    return VERR_NOT_IMPLEMENTED;
 }
 
@@ -259,22 +278,25 @@
 int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb)
 {
+#if 0
     /* create the object. */
     const ULONG cPages = cb >> PAGE_SHIFT;
-    PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_LOCK, pv, cb);
-    if (!pMemOs2)
+    PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_LOCK, pv, cb);
+    if (!pMemFreeBSD)
         return VERR_NO_MEMORY;
 
     /* lock it. */
     ULONG cPagesRet = cPages;
-    int rc = KernVMLock(VMDHL_LONG | VMDHL_WRITE, pv, cb, &pMemOs2->Lock, &pMemOs2->aPages[0], &cPagesRet);
-    if (!rc)
-    {
-        rtR0MemObjFixPageList(&pMemOs2->aPages[0], cPages, cPagesRet);
-        pMemOs2->Core.u.Lock.R0Process = NIL_RTR0PROCESS;
-        *ppMem = &pMemOs2->Core;
-        return VINF_SUCCESS;
-    }
-    rtR0MemObjDelete(&pMemOs2->Core);
-    return RTErrConvertFromOS2(rc);
+    int rc = KernVMLock(VMDHL_LONG | VMDHL_WRITE, pv, cb, &pMemFreeBSD->Lock, &pMemFreeBSD->aPages[0], &cPagesRet);
+    if (!rc)
+    {
+        rtR0MemObjFixPageList(&pMemFreeBSD->aPages[0], cPages, cPagesRet);
+        pMemFreeBSD->Core.u.Lock.R0Process = NIL_RTR0PROCESS;
+        *ppMem = &pMemFreeBSD->Core;
+        return VINF_SUCCESS;
+    }
+    rtR0MemObjDelete(&pMemFreeBSD->Core);
+    return RTErrConvertFromOS2(rc);
+#endif
+    return VERR_NOT_IMPLEMENTED;
 }
 
@@ -296,9 +318,10 @@
     AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED);
 
+#if 0
 /** @todo finish the implementation. */
 
     int rc;
     void *pvR0 = NULL;
-    PRTR0MEMOBJOS2 pMemToMapOs2 = (PRTR0MEMOBJOS2)pMemToMap;
+    PRTR0MEMOBJFREEBSD pMemToMapOs2 = (PRTR0MEMOBJFREEBSD)pMemToMap;
     switch (pMemToMapOs2->Core.enmType)
     {
@@ -349,12 +372,14 @@
      * (reference counting).
      */
-    PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_MAPPING, pvR0, pMemToMapOs2->Core.cb);
-    if (pMemOs2)
-    {
-        pMemOs2->Core.u.Mapping.R0Process = NIL_RTR0PROCESS;
-        *ppMem = &pMemOs2->Core;
+    PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_MAPPING, pvR0, pMemToMapOs2->Core.cb);
+    if (pMemFreeBSD)
+    {
+        pMemFreeBSD->Core.u.Mapping.R0Process = NIL_RTR0PROCESS;
+        *ppMem = &pMemFreeBSD->Core;
         return VINF_SUCCESS;
     }
     return VERR_NO_MEMORY;
+#endif
+    return VERR_NOT_IMPLEMENTED;
 }
 
@@ -365,8 +390,9 @@
     AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED);
 
+#if 0
     int rc;
     void *pvR0;
     void *pvR3 = NULL;
-    PRTR0MEMOBJOS2 pMemToMapOs2 = (PRTR0MEMOBJOS2)pMemToMap;
+    PRTR0MEMOBJFREEBSD pMemToMapOs2 = (PRTR0MEMOBJFREEBSD)pMemToMap;
     switch (pMemToMapOs2->Core.enmType)
     {
@@ -431,14 +457,16 @@
      * Create a mapping object for it.
      */
-    PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_MAPPING, pvR3, pMemToMapOs2->Core.cb);
-    if (pMemOs2)
-    {
-        Assert(pMemOs2->Core.pv == pvR3);
-        pMemOs2->Core.u.Mapping.R0Process = R0Process;
-        *ppMem = &pMemOs2->Core;
+    PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_MAPPING, pvR3, pMemToMapOs2->Core.cb);
+    if (pMemFreeBSD)
+    {
+        Assert(pMemFreeBSD->Core.pv == pvR3);
+        pMemFreeBSD->Core.u.Mapping.R0Process = R0Process;
+        *ppMem = &pMemFreeBSD->Core;
         return VINF_SUCCESS;
     }
     KernVMFree(pvR3);
     return VERR_NO_MEMORY;
+#endif
+    return VERR_NOT_IMPLEMENTED;
 }
 
@@ -446,18 +474,19 @@
 RTHCPHYS rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, unsigned iPage)
 {
-    PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)pMem;
-
-    switch (pMemOs2->Core.enmType)
+    PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)pMem;
+
+    switch (pMemFreeBSD->Core.enmType)
     {
         case RTR0MEMOBJTYPE_PAGE:
         case RTR0MEMOBJTYPE_LOW:
         case RTR0MEMOBJTYPE_LOCK:
-            return pMemOs2->aPages[iPage].Addr;
+//            return pMemFreeBSD->aPages[iPage].Addr;
+return NIL_RTHCPHYS;
 
         case RTR0MEMOBJTYPE_CONT:
-            return pMemOs2->Core.u.Cont.Phys + (iPage << PAGE_SHIFT);
+            return pMemFreeBSD->Core.u.Cont.Phys + (iPage << PAGE_SHIFT);
 
         case RTR0MEMOBJTYPE_PHYS:
-            return pMemOs2->Core.u.Phys.PhysBase + (iPage << PAGE_SHIFT);
+            return pMemFreeBSD->Core.u.Phys.PhysBase + (iPage << PAGE_SHIFT);
 
         case RTR0MEMOBJTYPE_RES_VIRT:
@@ -467,46 +496,2 @@
     }
 }
-
-
-/**
- * Expands the page list so we can index pages directly.
- *
- * @param   paPages         The page list array to fix.
- * @param   cPages          The number of pages that's supposed to go into the list.
- * @param   cPagesRet       The actual number of pages in the list.
- */
-static void rtR0MemObjFixPageList(KernPageList_t *paPages, ULONG cPages, ULONG cPagesRet)
-{
-    Assert(cPages >= cPagesRet);
-    if (cPages != cPagesRet)
-    {
-        ULONG iIn = cPagesRet;
-        ULONG iOut = cPages;
-        do
-        {
-            iIn--;
-            iOut--;
-            Assert(iIn <= iOut);
-
-            KernPageList_t Page = paPages[iIn];
-            Assert(!(Page.Addr & PAGE_OFFSET_MASK));
-            Assert(Page.Size == RT_ALIGN_Z(Page.Size, PAGE_SIZE));
-
-            if (Page.Size > PAGE_SIZE)
-            {
-                do
-                {
-                    Page.Size -= PAGE_SIZE;
-                    paPages[iOut].Addr = Page.Addr + Page.Size;
-                    paPages[iOut].Size = PAGE_SIZE;
-                    iOut--;
-                } while (Page.Size > PAGE_SIZE);
-            }
-
-            paPages[iOut].Addr = Page.Addr;
-            paPages[iOut].Size = PAGE_SIZE;
-        } while (   iIn != iOut
-                 && iIn > 0);
-    }
-}
-
