Index: trunk/include/iprt/mangling.h
===================================================================
--- trunk/include/iprt/mangling.h	(revision 92245)
+++ trunk/include/iprt/mangling.h	(revision 92246)
@@ -1864,4 +1864,5 @@
 # define RTR0MemObjReserveUserTag                       RT_MANGLER(RTR0MemObjReserveUserTag)   /* r0drv */
 # define RTR0MemObjSize                                 RT_MANGLER(RTR0MemObjSize)             /* r0drv */
+# define RTR0MemObjWasZeroInitialized                   RT_MANGLER(RTR0MemObjWasZeroInitialized)/* r0drv */
 # define RTR0MemUserCopyFrom                            RT_MANGLER(RTR0MemUserCopyFrom)        /* r0drv */
 # define RTR0MemUserCopyTo                              RT_MANGLER(RTR0MemUserCopyTo)          /* r0drv */
Index: trunk/include/iprt/memobj.h
===================================================================
--- trunk/include/iprt/memobj.h	(revision 92245)
+++ trunk/include/iprt/memobj.h	(revision 92246)
@@ -109,4 +109,21 @@
  */
 RTR0DECL(RTHCPHYS) RTR0MemObjGetPagePhysAddr(RTR0MEMOBJ MemObj, size_t iPage);
+
+/**
+ * Checks whether the allocation was zero initialized or not.
+ *
+ * This only works on allocations.  It is not meaningful for mappings, reserved
+ * memory and entered physical address, and will return false for these.
+ *
+ * @returns true if the allocation was initialized to zero at allocation time,
+ *          false if not or query not meaningful to the object type.
+ * @param   hMemObj             The ring-0 memory object to be freed.
+ *
+ * @remarks It can be expected that memory allocated in the same fashion will
+ *          have the same initialization state.  So, if this returns true for
+ *          one allocation it will return true for all other similarly made
+ *          allocations.
+ */
+RTR0DECL(bool) RTR0MemObjWasZeroInitialized(PRTR0MEMOBJ hMemObj);
 
 /**
Index: trunk/src/VBox/Runtime/include/internal/memobj.h
===================================================================
--- trunk/src/VBox/Runtime/include/internal/memobj.h	(revision 92245)
+++ trunk/src/VBox/Runtime/include/internal/memobj.h	(revision 92246)
@@ -92,5 +92,9 @@
  * @{ */
 /** Page level protection was changed. */
-#define RTR0MEMOBJ_FLAGS_PROT_CHANGED       RT_BIT_32(0)
+#define RTR0MEMOBJ_FLAGS_PROT_CHANGED               RT_BIT_32(0)
+/** Zero initialized at allocation. */
+#define RTR0MEMOBJ_FLAGS_ZERO_AT_ALLOC              RT_BIT_32(1)
+/** Uninitialized at allocation. */
+#define RTR0MEMOBJ_FLAGS_UNINITIALIZED_AT_ALLOC     RT_BIT_32(2)
 /** @} */
 
Index: trunk/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp
===================================================================
--- trunk/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp	(revision 92245)
+++ trunk/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp	(revision 92246)
@@ -744,4 +744,8 @@
                 if (pMemDarwin)
                 {
+                    if (fOptions & kIOMemoryKernelUserShared)
+                        pMemDarwin->Core.fFlags |= RTR0MEMOBJ_FLAGS_ZERO_AT_ALLOC;
+                    else
+                        pMemDarwin->Core.fFlags |= RTR0MEMOBJ_FLAGS_UNINITIALIZED_AT_ALLOC;
                     if (fContiguous)
                     {
Index: trunk/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
===================================================================
--- trunk/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c	(revision 92245)
+++ trunk/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c	(revision 92246)
@@ -230,6 +230,5 @@
     {
         VM_OBJECT_WLOCK(pObject);
-        pPages = vm_page_alloc_contig(pObject, iPIndex, fFlags, cPages, 0,
-                                      VmPhysAddrHigh, uAlignment, 0, VM_MEMATTR_DEFAULT);
+        pPages = vm_page_alloc_contig(pObject, iPIndex, fFlags, cPages, 0, VmPhysAddrHigh, uAlignment, 0, VM_MEMATTR_DEFAULT);
         VM_OBJECT_WUNLOCK(pObject);
         if (pPages)
@@ -280,6 +279,5 @@
     if (fContiguous)
     {
-        if (rtR0MemObjFreeBSDContigPhysAllocHelper(pObject, 0, cPages, VmPhysAddrHigh,
-                                                   uAlignment, fWire) != NULL)
+        if (rtR0MemObjFreeBSDContigPhysAllocHelper(pObject, 0, cPages, VmPhysAddrHigh, uAlignment, fWire) != NULL)
             return VINF_SUCCESS;
         return rcNoMem;
@@ -288,7 +286,8 @@
     for (vm_pindex_t iPage = 0; iPage < cPages; iPage++)
     {
-        vm_page_t pPage = rtR0MemObjFreeBSDContigPhysAllocHelper(pObject, iPage, 1, VmPhysAddrHigh,
-                                                                 uAlignment, fWire);
-        if (!pPage)
+        vm_page_t pPage = rtR0MemObjFreeBSDContigPhysAllocHelper(pObject, iPage, 1, VmPhysAddrHigh, uAlignment, fWire);
+        if (pPage)
+        { /* likely */ }
+        else
         {
             /* Free all allocated pages */
@@ -336,14 +335,13 @@
     if (rc == KERN_SUCCESS)
     {
-        rc = rtR0MemObjFreeBSDPhysAllocHelper(pMemFreeBSD->pObject, cPages,
-                                              VmPhysAddrHigh, PAGE_SIZE, fContiguous,
-                                              false, rcNoMem);
+        rc = rtR0MemObjFreeBSDPhysAllocHelper(pMemFreeBSD->pObject, cPages, VmPhysAddrHigh, PAGE_SIZE,
+                                              fContiguous, false /*fWire*/, rcNoMem);
         if (RT_SUCCESS(rc))
         {
-            vm_map_wire(kernel_map, MapAddress, MapAddress + pMemFreeBSD->Core.cb,
-                        VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES);
+            vm_map_wire(kernel_map, MapAddress, MapAddress + pMemFreeBSD->Core.cb, VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES);
 
             /* Store start address */
-            pMemFreeBSD->Core.pv = (void *)MapAddress;
+            pMemFreeBSD->Core.pv      = (void *)MapAddress;
+            pMemFreeBSD->Core.fFlags |= RTR0MEMOBJ_FLAGS_UNINITIALIZED_AT_ALLOC;
             return VINF_SUCCESS;
         }
@@ -366,16 +364,14 @@
     PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_PAGE,
                                                                        NULL, cb, pszTag);
-    if (!pMemFreeBSD)
-        return VERR_NO_MEMORY;
-
-    int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, ~(vm_paddr_t)0, false, VERR_NO_MEMORY);
-    if (RT_FAILURE(rc))
-    {
-        rtR0MemObjDelete(&pMemFreeBSD->Core);
+    if (pMemFreeBSD)
+    {
+        int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, ~(vm_paddr_t)0, false /*fContiguous*/, VERR_NO_MEMORY);
+        if (RT_SUCCESS(rc))
+            *ppMem = &pMemFreeBSD->Core;
+        else
+            rtR0MemObjDelete(&pMemFreeBSD->Core);
         return rc;
     }
-
-    *ppMem = &pMemFreeBSD->Core;
-    return rc;
+    return VERR_NO_MEMORY;
 }
 
@@ -391,16 +387,14 @@
 {
     PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_LOW, NULL, cb, pszTag);
-    if (!pMemFreeBSD)
-        return VERR_NO_MEMORY;
-
-    int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G - 1, false, VERR_NO_LOW_MEMORY);
-    if (RT_FAILURE(rc))
-    {
-        rtR0MemObjDelete(&pMemFreeBSD->Core);
+    if (pMemFreeBSD)
+    {
+        int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G - 1, false /*fContiguous*/, VERR_NO_LOW_MEMORY);
+        if (RT_SUCCESS(rc))
+            *ppMem = &pMemFreeBSD->Core;
+        else
+            rtR0MemObjDelete(&pMemFreeBSD->Core);
         return rc;
     }
-
-    *ppMem = &pMemFreeBSD->Core;
-    return rc;
+    return VERR_NO_MEMORY;
 }
 
@@ -410,17 +404,17 @@
     PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_CONT,
                                                                        NULL, cb, pszTag);
-    if (!pMemFreeBSD)
-        return VERR_NO_MEMORY;
-
-    int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G - 1, true, VERR_NO_CONT_MEMORY);
-    if (RT_FAILURE(rc))
-    {
-        rtR0MemObjDelete(&pMemFreeBSD->Core);
+    if (pMemFreeBSD)
+    {
+        int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G - 1, true /*fContiguous*/, VERR_NO_CONT_MEMORY);
+        if (RT_SUCCESS(rc))
+        {
+            pMemFreeBSD->Core.u.Cont.Phys = vtophys(pMemFreeBSD->Core.pv);
+            *ppMem = &pMemFreeBSD->Core;
+        }
+        else
+            rtR0MemObjDelete(&pMemFreeBSD->Core);
         return rc;
     }
-
-    pMemFreeBSD->Core.u.Cont.Phys = vtophys(pMemFreeBSD->Core.pv);
-    *ppMem = &pMemFreeBSD->Core;
-    return rc;
+    return VERR_NO_MEMORY;
 }
 
@@ -429,41 +423,37 @@
                                            size_t uAlignment, bool fContiguous, int rcNoMem, const char *pszTag)
 {
-    uint32_t   cPages = atop(cb);
-    vm_paddr_t VmPhysAddrHigh;
-
     /* create the object. */
     PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), enmType, NULL, cb, pszTag);
-    if (!pMemFreeBSD)
-        return VERR_NO_MEMORY;
-
-    pMemFreeBSD->pObject = vm_object_allocate(OBJT_PHYS, atop(cb));
-
-    if (PhysHighest != NIL_RTHCPHYS)
-        VmPhysAddrHigh = PhysHighest;
-    else
-        VmPhysAddrHigh = ~(vm_paddr_t)0;
-
-    int rc = rtR0MemObjFreeBSDPhysAllocHelper(pMemFreeBSD->pObject, cPages, VmPhysAddrHigh,
-                                              uAlignment, fContiguous, true, rcNoMem);
-    if (RT_SUCCESS(rc))
-    {
-        if (fContiguous)
-        {
-            Assert(enmType == RTR0MEMOBJTYPE_PHYS);
-            VM_OBJECT_WLOCK(pMemFreeBSD->pObject);
-            pMemFreeBSD->Core.u.Phys.PhysBase = VM_PAGE_TO_PHYS(vm_page_find_least(pMemFreeBSD->pObject, 0));
-            VM_OBJECT_WUNLOCK(pMemFreeBSD->pObject);
-            pMemFreeBSD->Core.u.Phys.fAllocated = true;
-        }
-
-        *ppMem = &pMemFreeBSD->Core;
-    }
-    else
-    {
-        vm_object_deallocate(pMemFreeBSD->pObject);
-        rtR0MemObjDelete(&pMemFreeBSD->Core);
-    }
-
-    return rc;
+    if (pMemFreeBSD)
+    {
+        vm_paddr_t const VmPhysAddrHigh = PhysHighest != NIL_RTHCPHYS ? PhysHighest : ~(vm_paddr_t)0;
+        u_long const     cPages         = atop(cb);
+
+        pMemFreeBSD->pObject = vm_object_allocate(OBJT_PHYS, cPages);
+
+        int rc = rtR0MemObjFreeBSDPhysAllocHelper(pMemFreeBSD->pObject, cPages, VmPhysAddrHigh,
+                                                  uAlignment, fContiguous, true, rcNoMem);
+        if (RT_SUCCESS(rc))
+        {
+            if (fContiguous)
+            {
+                Assert(enmType == RTR0MEMOBJTYPE_PHYS);
+                VM_OBJECT_WLOCK(pMemFreeBSD->pObject);
+                pMemFreeBSD->Core.u.Phys.PhysBase = VM_PAGE_TO_PHYS(vm_page_find_least(pMemFreeBSD->pObject, 0));
+                VM_OBJECT_WUNLOCK(pMemFreeBSD->pObject);
+                pMemFreeBSD->Core.u.Phys.fAllocated = true;
+            }
+
+            pMemFreeBSD->Core.fFlags |= RTR0MEMOBJ_FLAGS_UNINITIALIZED_AT_ALLOC;
+            *ppMem = &pMemFreeBSD->Core;
+        }
+        else
+        {
+            vm_object_deallocate(pMemFreeBSD->pObject);
+            rtR0MemObjDelete(&pMemFreeBSD->Core);
+        }
+        return rc;
+    }
+    return VERR_NO_MEMORY;
 }
 
@@ -491,13 +481,14 @@
     PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_PHYS,
                                                                        NULL, cb, pszTag);
-    if (!pMemFreeBSD)
-        return VERR_NO_MEMORY;
-
-    /* there is no allocation here, it needs to be mapped somewhere first. */
-    pMemFreeBSD->Core.u.Phys.fAllocated = false;
-    pMemFreeBSD->Core.u.Phys.PhysBase = Phys;
-    pMemFreeBSD->Core.u.Phys.uCachePolicy = uCachePolicy;
-    *ppMem = &pMemFreeBSD->Core;
-    return VINF_SUCCESS;
+    if (pMemFreeBSD)
+    {
+        /* there is no allocation here, it needs to be mapped somewhere first. */
+        pMemFreeBSD->Core.u.Phys.fAllocated = false;
+        pMemFreeBSD->Core.u.Phys.PhysBase = Phys;
+        pMemFreeBSD->Core.u.Phys.uCachePolicy = uCachePolicy;
+        *ppMem = &pMemFreeBSD->Core;
+        return VINF_SUCCESS;
+    }
+    return VERR_NO_MEMORY;
 }
 
Index: trunk/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
===================================================================
--- trunk/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c	(revision 92245)
+++ trunk/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c	(revision 92246)
@@ -353,4 +353,5 @@
     if (!pMemLnx)
         return VERR_NO_MEMORY;
+    pMemLnx->Core.fFlags |= RTR0MEMOBJ_FLAGS_UNINITIALIZED_AT_ALLOC;
     pMemLnx->cPages = cPages;
 
Index: trunk/src/VBox/Runtime/r0drv/memobj-r0drv.cpp
===================================================================
--- trunk/src/VBox/Runtime/r0drv/memobj-r0drv.cpp	(revision 92245)
+++ trunk/src/VBox/Runtime/r0drv/memobj-r0drv.cpp	(revision 92246)
@@ -313,9 +313,47 @@
 
 /**
+ * Checks whether the allocation was zero initialized or not.
+ *
+ * This only works on allocations.  It is not meaningful for mappings, reserved
+ * memory and entered physical address, and will return false for these.
+ *
+ * @returns true if the allocation was initialized to zero at allocation time,
+ *          false if not or query not meaningful to the object type.
+ * @param   hMemObj             The ring-0 memory object to be freed.
+ *
+ * @remarks It can be expected that memory allocated in the same fashion will
+ *          have the same initialization state.  So, if this returns true for
+ *          one allocation it will return true for all other similarly made
+ *          allocations.
+ */
+RTR0DECL(bool) RTR0MemObjWasZeroInitialized(PRTR0MEMOBJ hMemObj)
+{
+    PRTR0MEMOBJINTERNAL pMem;
+
+    /* Validate the object handle. */
+    if (RT_UNLIKELY(hMemObj == NIL_RTR0MEMOBJ))
+        return false;
+    AssertPtrReturn(hMemObj, false);
+    pMem = (PRTR0MEMOBJINTERNAL)hMemObj;
+    AssertMsgReturn(pMem->u32Magic == RTR0MEMOBJ_MAGIC, ("%p: %#x\n", pMem, pMem->u32Magic), false);
+    AssertMsgReturn(pMem->enmType > RTR0MEMOBJTYPE_INVALID && pMem->enmType < RTR0MEMOBJTYPE_END, ("%p: %d\n", pMem, pMem->enmType), false);
+    Assert(   (pMem->fFlags & (RTR0MEMOBJ_FLAGS_ZERO_AT_ALLOC | RTR0MEMOBJ_FLAGS_UNINITIALIZED_AT_ALLOC))
+           !=                 (RTR0MEMOBJ_FLAGS_ZERO_AT_ALLOC | RTR0MEMOBJ_FLAGS_UNINITIALIZED_AT_ALLOC));
+
+    /* return the alloc init state. */
+    return (pMem->fFlags & (RTR0MEMOBJ_FLAGS_ZERO_AT_ALLOC | RTR0MEMOBJ_FLAGS_UNINITIALIZED_AT_ALLOC))
+        ==                  RTR0MEMOBJ_FLAGS_ZERO_AT_ALLOC;
+
+}
+RT_EXPORT_SYMBOL(RTR0MemObjWasZeroInitialized);
+
+
+/**
  * Frees a ring-0 memory object.
  *
  * @returns IPRT status code.
  * @retval  VERR_INVALID_HANDLE if
- * @param   MemObj          The ring-0 memory object to be freed. NULL is accepted.
+ * @param   MemObj          The ring-0 memory object to be freed. NIL is
+ *                          accepted.
  * @param   fFreeMappings   Whether or not to free mappings of the object.
  */
Index: trunk/src/VBox/Runtime/r0drv/netbsd/memobj-r0drv-netbsd.c
===================================================================
--- trunk/src/VBox/Runtime/r0drv/netbsd/memobj-r0drv-netbsd.c	(revision 92245)
+++ trunk/src/VBox/Runtime/r0drv/netbsd/memobj-r0drv-netbsd.c	(revision 92246)
@@ -189,9 +189,8 @@
 
 static int rtR0MemObjNetBSDAllocHelper(PRTR0MEMOBJNETBSD pMemNetBSD, size_t cb, bool fExecutable,
-                                         paddr_t VmPhysAddrHigh, bool fContiguous)
+                                       paddr_t VmPhysAddrHigh, bool fContiguous)
 {
     /* Virtual space first */
-    vaddr_t virt = uvm_km_alloc(kernel_map, cb, 0,
-            UVM_KMF_VAONLY | UVM_KMF_WAITVA | UVM_KMF_CANFAIL);
+    vaddr_t virt = uvm_km_alloc(kernel_map, cb, 0, UVM_KMF_VAONLY | UVM_KMF_WAITVA | UVM_KMF_CANFAIL);
     if (virt == 0)
         return VERR_NO_MEMORY;
@@ -202,9 +201,8 @@
 
     /* Physical pages */
-    if (uvm_pglistalloc(cb, 0, VmPhysAddrHigh,
-            PAGE_SIZE, 0, rlist, nsegs, 1) != 0)
+    if (uvm_pglistalloc(cb, 0, VmPhysAddrHigh, PAGE_SIZE, 0, rlist, nsegs, 1) != 0)
     {
         uvm_km_free(kernel_map, virt, cb, UVM_KMF_VAONLY);
-        return VERR_NO_MEMORY;
+        return VERR_NO_MEMORY; /** @todo inaccurate status code */
     }
 
@@ -221,4 +219,5 @@
     }
 
+    pMemNetBSD->Core.fFlags |= RTR0MEMOBJ_FLAGS_UNINITIALIZED_AT_ALLOC; /*?*/
     pMemNetBSD->Core.pv = (void *)virt;
     if (fContiguous)
@@ -234,22 +233,21 @@
 {
     PRTR0MEMOBJNETBSD pMemNetBSD = (PRTR0MEMOBJNETBSD)rtR0MemObjNew(sizeof(*pMemNetBSD), RTR0MEMOBJTYPE_PAGE, NULL, cb, pszTag);
-    if (!pMemNetBSD)
-        return VERR_NO_MEMORY;
-
-    void *pvMem = kmem_alloc(cb, KM_SLEEP);
-    if (RT_UNLIKELY(!pvMem))
-    {
+    if (pMemNetBSD)
+    {
+        void *pvMem = kmem_alloc(cb, KM_SLEEP);
+        if (pvMem)
+        {
+            if (fExecutable)
+                pmap_protect(pmap_kernel(), (vaddr_t)pvMem, (vaddr_t)pvMem + cb, VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE);
+
+            pMemNetBSD->Core.fFlags |= RTR0MEMOBJ_FLAGS_UNINITIALIZED_AT_ALLOC;
+            pMemNetBSD->Core.pv      = pvMem;
+            *ppMem = &pMemNetBSD->Core;
+            return VINF_SUCCESS;
+        }
         rtR0MemObjDelete(&pMemNetBSD->Core);
         return VERR_NO_PAGE_MEMORY;
     }
-    if (fExecutable)
-    {
-        pmap_protect(pmap_kernel(), (vaddr_t)pvMem, ((vaddr_t)pvMem) + cb,
-                VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE);
-    }
-
-    pMemNetBSD->Core.pv = pvMem;
-    *ppMem = &pMemNetBSD->Core;
-    return VINF_SUCCESS;
+    return VERR_NO_MEMORY;
 }
 
@@ -265,16 +263,16 @@
 {
     PRTR0MEMOBJNETBSD pMemNetBSD = (PRTR0MEMOBJNETBSD)rtR0MemObjNew(sizeof(*pMemNetBSD), RTR0MEMOBJTYPE_LOW, NULL, cb, pszTag);
-    if (!pMemNetBSD)
-        return VERR_NO_MEMORY;
-
-    int rc = rtR0MemObjNetBSDAllocHelper(pMemNetBSD, cb, fExecutable, _4G - 1, false);
-    if (rc)
-    {
+    if (pMemNetBSD)
+    {
+        int rc = rtR0MemObjNetBSDAllocHelper(pMemNetBSD, cb, fExecutable, _4G - 1, false /*fContiguous*/);
+        if (RT_SUCCESS(rc))
+        {
+            *ppMem = &pMemNetBSD->Core;
+            return VINF_SUCCESS;
+        }
         rtR0MemObjDelete(&pMemNetBSD->Core);
         return rc;
     }
-
-    *ppMem = &pMemNetBSD->Core;
-    return VINF_SUCCESS;
+    return VERR_NO_MEMORY;
 }
 
@@ -283,16 +281,16 @@
 {
     PRTR0MEMOBJNETBSD pMemNetBSD = (PRTR0MEMOBJNETBSD)rtR0MemObjNew(sizeof(*pMemNetBSD), RTR0MEMOBJTYPE_CONT, NULL, cb, pszTag);
-    if (!pMemNetBSD)
-        return VERR_NO_MEMORY;
-
-    int rc = rtR0MemObjNetBSDAllocHelper(pMemNetBSD, cb, fExecutable, _4G - 1, true);
-    if (rc)
-    {
+    if (pMemNetBSD)
+    {
+        int rc = rtR0MemObjNetBSDAllocHelper(pMemNetBSD, cb, fExecutable, _4G - 1, true /*fContiguous*/);
+        if (RT_SUCCESS(rc))
+        {
+            *ppMem = &pMemNetBSD->Core;
+            return VINF_SUCCESS;
+        }
         rtR0MemObjDelete(&pMemNetBSD->Core);
         return rc;
     }
-
-    *ppMem = &pMemNetBSD->Core;
-    return VINF_SUCCESS;
+    return VERR_NO_MEMORY;
 }
 
@@ -301,35 +299,28 @@
                                           RTHCPHYS PhysHighest, size_t uAlignment, bool fContiguous, const char *pszTag)
 {
-    paddr_t VmPhysAddrHigh;
-
     /* create the object. */
     PRTR0MEMOBJNETBSD pMemNetBSD = (PRTR0MEMOBJNETBSD)rtR0MemObjNew(sizeof(*pMemNetBSD), enmType, NULL, cb, pszTag);
-    if (!pMemNetBSD)
-        return VERR_NO_MEMORY;
-
-    if (PhysHighest != NIL_RTHCPHYS)
-        VmPhysAddrHigh = PhysHighest;
-    else
-        VmPhysAddrHigh = ~(paddr_t)0;
-
-    int nsegs = fContiguous ? 1 : INT_MAX;
-
-    int error = uvm_pglistalloc(cb, 0, VmPhysAddrHigh, uAlignment, 0, &pMemNetBSD->pglist, nsegs, 1);
-    if (error)
-    {
+    if (pMemNetBSD)
+    {
+        paddr_t const VmPhysAddrHigh = PhysHighest != NIL_RTHCPHYS ? PhysHighest : ~(paddr_t)0;
+        int const     nsegs          = fContiguous ? 1 : INT_MAX;
+        int rc = uvm_pglistalloc(cb, 0, VmPhysAddrHigh, uAlignment, 0, &pMemNetBSD->pglist, nsegs, 1);
+        if (!rc)
+        {
+            pMemNetBSD->Core.fFlags |= RTR0MEMOBJ_FLAGS_UNINITIALIZED_AT_ALLOC; /*?*/
+            if (fContiguous)
+            {
+                Assert(enmType == RTR0MEMOBJTYPE_PHYS);
+                const struct vm_page * const pg = TAILQ_FIRST(&pMemNetBSD->pglist);
+                pMemNetBSD->Core.u.Phys.PhysBase = VM_PAGE_TO_PHYS(pg);
+                pMemNetBSD->Core.u.Phys.fAllocated = true;
+            }
+            *ppMem = &pMemNetBSD->Core;
+            return VINF_SUCCESS;
+        }
         rtR0MemObjDelete(&pMemNetBSD->Core);
-        return VERR_NO_MEMORY;
-    }
-
-    if (fContiguous)
-    {
-        Assert(enmType == RTR0MEMOBJTYPE_PHYS);
-        const struct vm_page * const pg = TAILQ_FIRST(&pMemNetBSD->pglist);
-        pMemNetBSD->Core.u.Phys.PhysBase = VM_PAGE_TO_PHYS(pg);
-        pMemNetBSD->Core.u.Phys.fAllocated = true;
-    }
-    *ppMem = &pMemNetBSD->Core;
-
-    return VINF_SUCCESS;
+        return VERR_NO_PAGE_MEMORY;
+    }
+    return VERR_NO_MEMORY;
 }
 
@@ -355,14 +346,15 @@
     /* create the object. */
     PRTR0MEMOBJNETBSD pMemNetBSD = (PRTR0MEMOBJNETBSD)rtR0MemObjNew(sizeof(*pMemNetBSD), RTR0MEMOBJTYPE_PHYS, NULL, cb, pszTag);
-    if (!pMemNetBSD)
-        return VERR_NO_MEMORY;
-
-    /* there is no allocation here, it needs to be mapped somewhere first. */
-    pMemNetBSD->Core.u.Phys.fAllocated = false;
-    pMemNetBSD->Core.u.Phys.PhysBase = Phys;
-    pMemNetBSD->Core.u.Phys.uCachePolicy = uCachePolicy;
-    TAILQ_INIT(&pMemNetBSD->pglist);
-    *ppMem = &pMemNetBSD->Core;
-    return VINF_SUCCESS;
+    if (pMemNetBSD)
+    {
+        /* there is no allocation here, it needs to be mapped somewhere first. */
+        pMemNetBSD->Core.u.Phys.fAllocated = false;
+        pMemNetBSD->Core.u.Phys.PhysBase = Phys;
+        pMemNetBSD->Core.u.Phys.uCachePolicy = uCachePolicy;
+        TAILQ_INIT(&pMemNetBSD->pglist);
+        *ppMem = &pMemNetBSD->Core;
+        return VINF_SUCCESS;
+    }
+    return VERR_NO_MEMORY;
 }
 
@@ -373,21 +365,18 @@
     PRTR0MEMOBJNETBSD pMemNetBSD = (PRTR0MEMOBJNETBSD)rtR0MemObjNew(sizeof(*pMemNetBSD), RTR0MEMOBJTYPE_LOCK,
                                                                     (void *)R3Ptr, cb, pszTag);
-    if (!pMemNetBSD)
-        return VERR_NO_MEMORY;
-
-    int rc = uvm_map_pageable(
-            &((struct proc *)R0Process)->p_vmspace->vm_map,
-            R3Ptr,
-            R3Ptr + cb,
-            0, 0);
-    if (rc)
-    {
+    if (pMemNetBSD)
+    {
+        int rc = uvm_map_pageable(&((struct proc *)R0Process)->p_vmspace->vm_map, R3Ptr, R3Ptr + cb,
+                                  0 /*new_pageable*/, 0 /*lockflags*/);
+        if (!rc)
+        {
+            pMemNetBSD->Core.u.Lock.R0Process = R0Process;
+            *ppMem = &pMemNetBSD->Core;
+            return VINF_SUCCESS;
+        }
         rtR0MemObjDelete(&pMemNetBSD->Core);
-        return VERR_NO_MEMORY;
-    }
-
-    pMemNetBSD->Core.u.Lock.R0Process = R0Process;
-    *ppMem = &pMemNetBSD->Core;
-    return VINF_SUCCESS;
+        return VERR_LOCK_FAILED;
+    }
+    return VERR_NO_MEMORY;
 }
 
@@ -397,11 +386,12 @@
     /* Kernel memory (always?) wired; all memory allocated by vbox code is? */
     PRTR0MEMOBJNETBSD pMemNetBSD = (PRTR0MEMOBJNETBSD)rtR0MemObjNew(sizeof(*pMemNetBSD), RTR0MEMOBJTYPE_LOCK, pv, cb, pszTag);
-    if (!pMemNetBSD)
-        return VERR_NO_MEMORY;
-
-    pMemNetBSD->Core.u.Lock.R0Process = NIL_RTR0PROCESS;
-    pMemNetBSD->Core.pv = pv;
-    *ppMem = &pMemNetBSD->Core;
-    return VINF_SUCCESS;
+    if (pMemNetBSD)
+    {
+        pMemNetBSD->Core.u.Lock.R0Process = NIL_RTR0PROCESS;
+        pMemNetBSD->Core.pv = pv;
+        *ppMem = &pMemNetBSD->Core;
+        return VINF_SUCCESS;
+    }
+    return VERR_NO_MEMORY;
 }
 
@@ -418,19 +408,18 @@
     PRTR0MEMOBJNETBSD pMemNetBSD = (PRTR0MEMOBJNETBSD)rtR0MemObjNew(sizeof(*pMemNetBSD), RTR0MEMOBJTYPE_RES_VIRT,
                                                                     NULL, cb, pszTag);
-    if (!pMemNetBSD)
-        return VERR_NO_MEMORY;
-
-    vaddr_t virt = uvm_km_alloc(kernel_map, cb, uAlignment,
-            UVM_KMF_VAONLY | UVM_KMF_WAITVA | UVM_KMF_CANFAIL);
-    if (virt == 0)
-    {
+    if (pMemNetBSD)
+    {
+        vaddr_t virt = uvm_km_alloc(kernel_map, cb, uAlignment, UVM_KMF_VAONLY | UVM_KMF_WAITVA | UVM_KMF_CANFAIL);
+        if (virt != 0)
+        {
+            pMemNetBSD->Core.u.ResVirt.R0Process = NIL_RTR0PROCESS;
+            pMemNetBSD->Core.pv = (void *)virt;
+            *ppMem = &pMemNetBSD->Core;
+            return VINF_SUCCESS;
+        }
         rtR0MemObjDelete(&pMemNetBSD->Core);
         return VERR_NO_MEMORY;
     }
-
-    pMemNetBSD->Core.u.ResVirt.R0Process = NIL_RTR0PROCESS;
-    pMemNetBSD->Core.pv = (void *)virt;
-    *ppMem = &pMemNetBSD->Core;
-    return VINF_SUCCESS;
+    return VERR_NO_MEMORY;
 }
 
@@ -466,42 +455,39 @@
     PRTR0MEMOBJNETBSD pMemNetBSD = (PRTR0MEMOBJNETBSD)rtR0MemObjNew(sizeof(*pMemNetBSD), RTR0MEMOBJTYPE_MAPPING, NULL, sz, pszTag);
 
-    vaddr_t virt = uvm_km_alloc(kernel_map, sz, uAlignment,
-            UVM_KMF_VAONLY | UVM_KMF_WAITVA | UVM_KMF_CANFAIL);
-    if (virt == 0)
-    {
-        rtR0MemObjDelete(&pMemNetBSD->Core);
-        return VERR_NO_MEMORY;
-    }
-
-    vm_prot_t prot = 0;
-
-    if ((fProt & RTMEM_PROT_READ) == RTMEM_PROT_READ)
-        prot |= VM_PROT_READ;
-    if ((fProt & RTMEM_PROT_WRITE) == RTMEM_PROT_WRITE)
-        prot |= VM_PROT_WRITE;
-    if ((fProt & RTMEM_PROT_EXEC) == RTMEM_PROT_EXEC)
-        prot |= VM_PROT_EXECUTE;
-
-    struct vm_page *page;
-    vaddr_t virt2 = virt;
-    size_t map_pos = 0;
-    TAILQ_FOREACH(page, &pMemNetBSD0->pglist, pageq.queue)
-    {
-        if (map_pos >= offSub)
-        {
-            if (cbSub > 0 && (map_pos >= offSub + cbSub))
-                break;
-
-            pmap_kenter_pa(virt2, VM_PAGE_TO_PHYS(page), prot, 0);
-            virt2 += PAGE_SIZE;
-        }
-        map_pos += PAGE_SIZE;
-    }
-
-    pMemNetBSD->Core.pv = (void *)virt;
-    pMemNetBSD->Core.u.Mapping.R0Process = NIL_RTR0PROCESS;
-    *ppMem = &pMemNetBSD->Core;
-
-    return VINF_SUCCESS;
+    vaddr_t virt = uvm_km_alloc(kernel_map, sz, uAlignment, UVM_KMF_VAONLY | UVM_KMF_WAITVA | UVM_KMF_CANFAIL);
+    if (virt != 0)
+    {
+        vm_prot_t prot = 0;
+        if (fProt & RTMEM_PROT_READ)
+            prot |= VM_PROT_READ;
+        if (fProt & RTMEM_PROT_WRITE)
+            prot |= VM_PROT_WRITE;
+        if (fProt & RTMEM_PROT_EXEC)
+            prot |= VM_PROT_EXECUTE;
+
+        struct vm_page *page;
+        vaddr_t virt2 = virt;
+        size_t map_pos = 0;
+        TAILQ_FOREACH(page, &pMemNetBSD0->pglist, pageq.queue)
+        {
+            if (map_pos >= offSub)
+            {
+                if (cbSub > 0 && (map_pos >= offSub + cbSub))
+                    break;
+
+                pmap_kenter_pa(virt2, VM_PAGE_TO_PHYS(page), prot, 0);
+                virt2 += PAGE_SIZE;
+            }
+            map_pos += PAGE_SIZE;
+        }
+
+        pMemNetBSD->Core.pv = (void *)virt;
+        pMemNetBSD->Core.u.Mapping.R0Process = NIL_RTR0PROCESS;
+        *ppMem = &pMemNetBSD->Core;
+        return VINF_SUCCESS;
+    }
+
+    rtR0MemObjDelete(&pMemNetBSD->Core);
+    return VERR_NO_MEMORY;
 }
 
@@ -518,23 +504,21 @@
 DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt)
 {
-    vm_prot_t          ProtectionFlags = 0;
-    vaddr_t        AddrStart       = (vaddr_t)pMem->pv + offSub;
-    vm_map_t           pVmMap          = rtR0MemObjNetBSDGetMap(pMem);
-
-    if (!pVmMap)
-        return VERR_NOT_SUPPORTED;
-
-    if ((fProt & RTMEM_PROT_READ) == RTMEM_PROT_READ)
-        ProtectionFlags |= UVM_PROT_R;
-    if ((fProt & RTMEM_PROT_WRITE) == RTMEM_PROT_WRITE)
-        ProtectionFlags |= UVM_PROT_W;
-    if ((fProt & RTMEM_PROT_EXEC) == RTMEM_PROT_EXEC)
-        ProtectionFlags |= UVM_PROT_X;
-
-    int error = uvm_map_protect(pVmMap, AddrStart, AddrStart + cbSub,
-        ProtectionFlags, 0);
-    if (!error)
-        return VINF_SUCCESS;
-
+    vm_map_t const pVmMap = rtR0MemObjNetBSDGetMap(pMem);
+    if (pVmMap)
+    {
+        vaddr_t const   AddrStart       = (vaddr_t)pMem->pv + offSub;
+        vm_prot_t       ProtectionFlags = 0;
+        if (fProt & RTMEM_PROT_READ)
+            ProtectionFlags |= UVM_PROT_R;
+        if (fProt & RTMEM_PROT_WRITE)
+            ProtectionFlags |= UVM_PROT_W;
+        if (fProt & RTMEM_PROT_EXEC)
+            ProtectionFlags |= UVM_PROT_X;
+
+        int rc = uvm_map_protect(pVmMap, AddrStart, AddrStart + cbSub, ProtectionFlags, 0);
+        if (!rc)
+            return VINF_SUCCESS;
+        return RTErrConvertFromErrno(rc);
+    }
     return VERR_NOT_SUPPORTED;
 }
Index: trunk/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp
===================================================================
--- trunk/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp	(revision 92245)
+++ trunk/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp	(revision 92246)
@@ -283,4 +283,5 @@
                         if (pMemNt)
                         {
+                            pMemNt->Core.fFlags |= RTR0MEMOBJ_FLAGS_ZERO_AT_ALLOC;
                             pMemNt->fAllocatedPagesForMdl = true;
                             pMemNt->cMdls = 1;
@@ -333,4 +334,5 @@
             if (pMemNt)
             {
+                pMemNt->Core.fFlags |= RTR0MEMOBJ_FLAGS_UNINITIALIZED_AT_ALLOC;
                 pMemNt->cMdls = 1;
                 pMemNt->apMdls[0] = pMdl;
@@ -441,4 +443,5 @@
                         if (pMemNt)
                         {
+                            pMemNt->Core.fFlags |= RTR0MEMOBJ_FLAGS_ZERO_AT_ALLOC;
                             pMemNt->fAllocatedPagesForMdl = true;
                             pMemNt->cMdls = 1;
@@ -525,4 +528,5 @@
                         if (pMemNt)
                         {
+                            pMemNt->Core.fFlags |= RTR0MEMOBJ_FLAGS_ZERO_AT_ALLOC;
                             pMemNt->fAllocatedPagesForMdl = true;
                             pMemNt->cMdls = 1;
@@ -607,4 +611,5 @@
         if (pMemNt)
         {
+            pMemNt->Core.fFlags |= RTR0MEMOBJ_FLAGS_UNINITIALIZED_AT_ALLOC;
             pMemNt->Core.u.Cont.Phys = (RTHCPHYS)*MmGetMdlPfnArray(pMdl) << PAGE_SHIFT;
             pMemNt->cMdls = 1;
@@ -668,4 +673,5 @@
                     if (pMemNt)
                     {
+                        pMemNt->Core.fFlags |= RTR0MEMOBJ_FLAGS_ZERO_AT_ALLOC;
                         pMemNt->Core.u.Phys.fAllocated = true;
                         pMemNt->Core.u.Phys.PhysBase = (RTHCPHYS)paPfns[0] << PAGE_SHIFT;
@@ -705,4 +711,5 @@
                 if (pMemNt)
                 {
+                    pMemNt->Core.fFlags |= RTR0MEMOBJ_FLAGS_ZERO_AT_ALLOC;
                     pMemNt->fAllocatedPagesForMdl = true;
                     pMemNt->cMdls = 1;
Index: trunk/src/VBox/Runtime/r0drv/os2/memobj-r0drv-os2.cpp
===================================================================
--- trunk/src/VBox/Runtime/r0drv/os2/memobj-r0drv-os2.cpp	(revision 92245)
+++ trunk/src/VBox/Runtime/r0drv/os2/memobj-r0drv-os2.cpp	(revision 92246)
@@ -144,23 +144,25 @@
     PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_UOFFSETOF_DYN(RTR0MEMOBJOS2, aPages[cPages]),
                                                            RTR0MEMOBJTYPE_PAGE, NULL, cb, pszTag);
-    if (!pMemOs2)
-        return VERR_NO_MEMORY;
-
-    /* do the allocation. */
-    int rc = KernVMAlloc(cb, VMDHA_FIXED, &pMemOs2->Core.pv, (PPVOID)-1, NULL);
-    if (!rc)
-    {
-        ULONG cPagesRet = cPages;
-        rc = KernLinToPageList(pMemOs2->Core.pv, cb, &pMemOs2->aPages[0], &cPagesRet);
+    if (pMemOs2)
+    {
+        /* do the allocation. */
+        int rc = KernVMAlloc(cb, VMDHA_FIXED, &pMemOs2->Core.pv, (PPVOID)-1, NULL);
         if (!rc)
         {
-            rtR0MemObjFixPageList(&pMemOs2->aPages[0], cPages, cPagesRet);
-            *ppMem = &pMemOs2->Core;
-            return VINF_SUCCESS;
+            ULONG cPagesRet = cPages;
+            rc = KernLinToPageList(pMemOs2->Core.pv, cb, &pMemOs2->aPages[0], &cPagesRet);
+            if (!rc)
+            {
+                rtR0MemObjFixPageList(&pMemOs2->aPages[0], cPages, cPagesRet);
+                pMemOs2->Core.fFlags |= RTR0MEMOBJ_FLAGS_UNINITIALIZED_AT_ALLOC; /* doesn't seem to be possible to zero anything */
+                *ppMem = &pMemOs2->Core;
+                return VINF_SUCCESS;
+            }
+            KernVMFree(pMemOs2->Core.pv);
         }
-        KernVMFree(pMemOs2->Core.pv);
-    }
-    rtR0MemObjDelete(&pMemOs2->Core);
-    return RTErrConvertFromOS2(rc);
+        rtR0MemObjDelete(&pMemOs2->Core);
+        return RTErrConvertFromOS2(rc);
+    }
+    return VERR_NO_MEMORY;
 }
 
@@ -181,49 +183,53 @@
     PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_UOFFSETOF_DYN(RTR0MEMOBJOS2, aPages[cPages]),
                                                            RTR0MEMOBJTYPE_LOW, NULL, cb, pszTag);
-    if (!pMemOs2)
-        return VERR_NO_MEMORY;
-
-    /* do the allocation. */
-    int rc = KernVMAlloc(cb, VMDHA_FIXED, &pMemOs2->Core.pv, (PPVOID)-1, NULL);
-    if (!rc)
-    {
-        ULONG cPagesRet = cPages;
-        rc = KernLinToPageList(pMemOs2->Core.pv, cb, &pMemOs2->aPages[0], &cPagesRet);
+    if (pMemOs2)
+    {
+        /* do the allocation. */
+        int rc = KernVMAlloc(cb, VMDHA_FIXED, &pMemOs2->Core.pv, (PPVOID)-1, NULL);
         if (!rc)
         {
-            rtR0MemObjFixPageList(&pMemOs2->aPages[0], cPages, cPagesRet);
+            ULONG cPagesRet = cPages;
+            rc = KernLinToPageList(pMemOs2->Core.pv, cb, &pMemOs2->aPages[0], &cPagesRet);
+            if (!rc)
+            {
+                rtR0MemObjFixPageList(&pMemOs2->aPages[0], cPages, cPagesRet);
+                pMemOs2->Core.fFlags |= RTR0MEMOBJ_FLAGS_UNINITIALIZED_AT_ALLOC; /* doesn't seem to be possible to zero anything */
+                *ppMem = &pMemOs2->Core;
+                return VINF_SUCCESS;
+            }
+            KernVMFree(pMemOs2->Core.pv);
+        }
+        rtR0MemObjDelete(&pMemOs2->Core);
+        rc = RTErrConvertFromOS2(rc);
+        return rc == VERR_NO_MEMORY ? VERR_NO_LOW_MEMORY : rc;
+    }
+    return VERR_NO_MEMORY;
+}
+
+
+DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable, const char *pszTag)
+{
+    NOREF(fExecutable);
+
+    /* create the object. */
+    PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_UOFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_CONT,
+                                                           NULL, cb, pszTag);
+    if (pMemOs2)
+    {
+        /* do the allocation. */
+        ULONG ulPhys = ~0UL;
+        int rc = KernVMAlloc(cb, VMDHA_FIXED | VMDHA_CONTIG, &pMemOs2->Core.pv, (PPVOID)&ulPhys, NULL);
+        if (!rc)
+        {
+            Assert(ulPhys != ~0UL);
+            pMemOs2->Core.fFlags |= RTR0MEMOBJ_FLAGS_UNINITIALIZED_AT_ALLOC; /* doesn't seem to be possible to zero anything */
+            pMemOs2->Core.u.Cont.Phys = ulPhys;
             *ppMem = &pMemOs2->Core;
             return VINF_SUCCESS;
         }
-        KernVMFree(pMemOs2->Core.pv);
-    }
-    rtR0MemObjDelete(&pMemOs2->Core);
-    rc = RTErrConvertFromOS2(rc);
-    return rc == VERR_NO_MEMORY ? VERR_NO_LOW_MEMORY : rc;
-}
-
-
-DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable, const char *pszTag)
-{
-    NOREF(fExecutable);
-
-    /* create the object. */
-    PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_UOFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_CONT,
-                                                           NULL, cb, pszTag);
-    if (!pMemOs2)
-        return VERR_NO_MEMORY;
-
-    /* do the allocation. */
-    ULONG ulPhys = ~0UL;
-    int rc = KernVMAlloc(cb, VMDHA_FIXED | VMDHA_CONTIG, &pMemOs2->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);
+        rtR0MemObjDelete(&pMemOs2->Core);
+        return RTErrConvertFromOS2(rc);
+    }
+    return VERR_NO_MEMORY;
 }
 
@@ -241,20 +247,23 @@
     PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_UOFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_PHYS,
                                                            NULL, cb, pszTag);
-    if (!pMemOs2)
-        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);
-    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);
+    if (pMemOs2)
+    {
+        /* 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);
+        if (!rc)
+        {
+            Assert(ulPhys != ~0UL);
+            pMemOs2->Core.fFlags |= RTR0MEMOBJ_FLAGS_UNINITIALIZED_AT_ALLOC; /* doesn't seem to be possible to zero anything */
+            pMemOs2->Core.u.Phys.fAllocated = true;
+            pMemOs2->Core.u.Phys.PhysBase = ulPhys;
+            *ppMem = &pMemOs2->Core;
+            return VINF_SUCCESS;
+        }
+        rtR0MemObjDelete(&pMemOs2->Core);
+        return RTErrConvertFromOS2(rc);
+    }
+    return VERR_NO_MEMORY;
 }
 
@@ -275,13 +284,14 @@
     PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_UOFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_PHYS,
                                                            NULL, cb, pszTag);
-    if (!pMemOs2)
-        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;
-    pMemOs2->Core.u.Phys.uCachePolicy = uCachePolicy;
-    *ppMem = &pMemOs2->Core;
-    return VINF_SUCCESS;
+    if (pMemOs2)
+    {
+        /* 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;
+        pMemOs2->Core.u.Phys.uCachePolicy = uCachePolicy;
+        *ppMem = &pMemOs2->Core;
+        return VINF_SUCCESS;
+    }
+    return VERR_NO_MEMORY;
 }
 
@@ -296,22 +306,23 @@
     PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_UOFFSETOF_DYN(RTR0MEMOBJOS2, aPages[cPages]),
                                                            RTR0MEMOBJTYPE_LOCK, (void *)R3Ptr, cb, pszTag);
-    if (!pMemOs2)
-        return VERR_NO_MEMORY;
-
-    /* lock it. */
-    ULONG cPagesRet = cPages;
-    int rc = KernVMLock(VMDHL_LONG | (fAccess & RTMEM_PROT_WRITE ? VMDHL_WRITE : 0),
-                        (void *)R3Ptr, cb, &pMemOs2->Lock, &pMemOs2->aPages[0], &cPagesRet);
-    if (!rc)
-    {
-        rtR0MemObjFixPageList(&pMemOs2->aPages[0], cPages, cPagesRet);
-        Assert(cb == pMemOs2->Core.cb);
-        Assert(R3Ptr == (RTR3PTR)pMemOs2->Core.pv);
-        pMemOs2->Core.u.Lock.R0Process = R0Process;
-        *ppMem = &pMemOs2->Core;
-        return VINF_SUCCESS;
-    }
-    rtR0MemObjDelete(&pMemOs2->Core);
-    return RTErrConvertFromOS2(rc);
+    if (pMemOs2)
+    {
+        /* lock it. */
+        ULONG cPagesRet = cPages;
+        int rc = KernVMLock(VMDHL_LONG | (fAccess & RTMEM_PROT_WRITE ? VMDHL_WRITE : 0),
+                            (void *)R3Ptr, cb, &pMemOs2->Lock, &pMemOs2->aPages[0], &cPagesRet);
+        if (!rc)
+        {
+            rtR0MemObjFixPageList(&pMemOs2->aPages[0], cPages, cPagesRet);
+            Assert(cb == pMemOs2->Core.cb);
+            Assert(R3Ptr == (RTR3PTR)pMemOs2->Core.pv);
+            pMemOs2->Core.u.Lock.R0Process = R0Process;
+            *ppMem = &pMemOs2->Core;
+            return VINF_SUCCESS;
+        }
+        rtR0MemObjDelete(&pMemOs2->Core);
+        return RTErrConvertFromOS2(rc);
+    }
+    return VERR_NO_MEMORY;
 }
 
@@ -323,20 +334,21 @@
     PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_UOFFSETOF_DYN(RTR0MEMOBJOS2, aPages[cPages]),
                                                            RTR0MEMOBJTYPE_LOCK, pv, cb, pszTag);
-    if (!pMemOs2)
-        return VERR_NO_MEMORY;
-
-    /* lock it. */
-    ULONG cPagesRet = cPages;
-    int rc = KernVMLock(VMDHL_LONG | (fAccess & RTMEM_PROT_WRITE ? VMDHL_WRITE : 0),
-                        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);
+    if (pMemOs2)
+    {
+        /* lock it. */
+        ULONG cPagesRet = cPages;
+        int rc = KernVMLock(VMDHL_LONG | (fAccess & RTMEM_PROT_WRITE ? VMDHL_WRITE : 0),
+                            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);
+    }
+    return VERR_NO_MEMORY;
 }
 
Index: trunk/src/VBox/Runtime/r0drv/solaris/memobj-r0drv-solaris.c
===================================================================
--- trunk/src/VBox/Runtime/r0drv/solaris/memobj-r0drv-solaris.c	(revision 92245)
+++ trunk/src/VBox/Runtime/r0drv/solaris/memobj-r0drv-solaris.c	(revision 92246)
@@ -654,18 +654,19 @@
     /* Create the object. */
     PRTR0MEMOBJSOL pMemSolaris = (PRTR0MEMOBJSOL)rtR0MemObjNew(sizeof(*pMemSolaris), RTR0MEMOBJTYPE_PAGE, NULL, cb, pszTag);
-    if (RT_UNLIKELY(!pMemSolaris))
-        return VERR_NO_MEMORY;
-
-    void *pvMem = ddi_umem_alloc(cb, DDI_UMEM_SLEEP, &pMemSolaris->Cookie);
-    if (RT_UNLIKELY(!pvMem))
-    {
+    if (pMemSolaris)
+    {
+        void *pvMem = ddi_umem_alloc(cb, DDI_UMEM_SLEEP, &pMemSolaris->Cookie);
+        if (pvMem)
+        {
+            pMemSolaris->Core.fFlags |= RTR0MEMOBJ_FLAGS_ZERO_AT_ALLOC;
+            pMemSolaris->Core.pv  = pvMem;
+            pMemSolaris->pvHandle = NULL;
+            *ppMem = &pMemSolaris->Core;
+            return VINF_SUCCESS;
+        }
         rtR0MemObjDelete(&pMemSolaris->Core);
         return VERR_NO_PAGE_MEMORY;
     }
-
-    pMemSolaris->Core.pv  = pvMem;
-    pMemSolaris->pvHandle = NULL;
-    *ppMem = &pMemSolaris->Core;
-    return VINF_SUCCESS;
+    return VERR_NO_MEMORY;
 }
 
@@ -684,19 +685,21 @@
     /* Create the object */
     PRTR0MEMOBJSOL pMemSolaris = (PRTR0MEMOBJSOL)rtR0MemObjNew(sizeof(*pMemSolaris), RTR0MEMOBJTYPE_LOW, NULL, cb, pszTag);
-    if (!pMemSolaris)
-        return VERR_NO_MEMORY;
-
-    /* Allocate physically low page-aligned memory. */
-    uint64_t uPhysHi = _4G - 1;
-    void *pvMem = rtR0SolMemAlloc(uPhysHi, NULL /* puPhys */, cb, PAGE_SIZE, false /* fContig */);
-    if (RT_UNLIKELY(!pvMem))
-    {
+    if (pMemSolaris)
+    {
+        /* Allocate physically low page-aligned memory. */
+        uint64_t uPhysHi = _4G - 1;
+        void *pvMem = rtR0SolMemAlloc(uPhysHi, NULL /* puPhys */, cb, PAGE_SIZE, false /* fContig */);
+        if (pvMem)
+        {
+            pMemSolaris->Core.fFlags |= RTR0MEMOBJ_FLAGS_UNINITIALIZED_AT_ALLOC;
+            pMemSolaris->Core.pv = pvMem;
+            pMemSolaris->pvHandle = NULL;
+            *ppMem = &pMemSolaris->Core;
+            return VINF_SUCCESS;
+        }
         rtR0MemObjDelete(&pMemSolaris->Core);
         return VERR_NO_LOW_MEMORY;
     }
-    pMemSolaris->Core.pv = pvMem;
-    pMemSolaris->pvHandle = NULL;
-    *ppMem = &pMemSolaris->Core;
-    return VINF_SUCCESS;
+    return VERR_NO_MEMORY;
 }
 
@@ -713,49 +716,49 @@
 #if HC_ARCH_BITS == 64
     PRTR0MEMOBJSOL pMemSolaris = (PRTR0MEMOBJSOL)rtR0MemObjNew(sizeof(*pMemSolaris), RTR0MEMOBJTYPE_PHYS_NC, NULL, cb, pszTag);
-    if (RT_UNLIKELY(!pMemSolaris))
-        return VERR_NO_MEMORY;
-
-    if (PhysHighest == NIL_RTHCPHYS)
-    {
-        uint64_t PhysAddr = UINT64_MAX;
-        void *pvPages = rtR0MemObjSolPagesAlloc(&PhysAddr, cb);
-        if (!pvPages)
-        {
-            LogRel(("rtR0MemObjNativeAllocPhysNC: rtR0MemObjSolPagesAlloc failed for cb=%u.\n", cb));
-            rtR0MemObjDelete(&pMemSolaris->Core);
-            return VERR_NO_MEMORY;
-        }
-        Assert(PhysAddr != UINT64_MAX);
-        Assert(!(PhysAddr & PAGE_OFFSET_MASK));
-
-        pMemSolaris->Core.pv     = NULL;
-        pMemSolaris->pvHandle    = pvPages;
-        pMemSolaris->fIndivPages = true;
+    if (pMemSolaris)
+    {
+        if (PhysHighest == NIL_RTHCPHYS)
+        {
+            uint64_t PhysAddr = UINT64_MAX;
+            void *pvPages = rtR0MemObjSolPagesAlloc(&PhysAddr, cb);
+            if (!pvPages)
+            {
+                LogRel(("rtR0MemObjNativeAllocPhysNC: rtR0MemObjSolPagesAlloc failed for cb=%u.\n", cb));
+                rtR0MemObjDelete(&pMemSolaris->Core);
+                return VERR_NO_MEMORY;
+            }
+            Assert(PhysAddr != UINT64_MAX);
+            Assert(!(PhysAddr & PAGE_OFFSET_MASK));
+
+            pMemSolaris->Core.pv     = NULL;
+            pMemSolaris->pvHandle    = pvPages;
+            pMemSolaris->fIndivPages = true;
+        }
+        else
+        {
+            /*
+             * If we must satisfy an upper limit constraint, it isn't feasible to grab individual pages.
+             * We fall back to using contig_alloc().
+             */
+            uint64_t PhysAddr = UINT64_MAX;
+            void *pvMem = rtR0SolMemAlloc(PhysHighest, &PhysAddr, cb, PAGE_SIZE, false /* fContig */);
+            if (!pvMem)
+            {
+                LogRel(("rtR0MemObjNativeAllocPhysNC: rtR0SolMemAlloc failed for cb=%u PhysHighest=%RHp.\n", cb, PhysHighest));
+                rtR0MemObjDelete(&pMemSolaris->Core);
+                return VERR_NO_MEMORY;
+            }
+            Assert(PhysAddr != UINT64_MAX);
+            Assert(!(PhysAddr & PAGE_OFFSET_MASK));
+
+            pMemSolaris->Core.pv     = pvMem;
+            pMemSolaris->pvHandle    = NULL;
+            pMemSolaris->fIndivPages = false;
+        }
+        pMemSolaris->Core.fFlags |= RTR0MEMOBJ_FLAGS_UNINITIALIZED_AT_ALLOC;
         *ppMem = &pMemSolaris->Core;
         return VINF_SUCCESS;
     }
-    else
-    {
-        /*
-         * If we must satisfy an upper limit constraint, it isn't feasible to grab individual pages.
-         * We fall back to using contig_alloc().
-         */
-        uint64_t PhysAddr = UINT64_MAX;
-        void *pvMem = rtR0SolMemAlloc(PhysHighest, &PhysAddr, cb, PAGE_SIZE, false /* fContig */);
-        if (!pvMem)
-        {
-            LogRel(("rtR0MemObjNativeAllocPhysNC: rtR0SolMemAlloc failed for cb=%u PhysHighest=%RHp.\n", cb, PhysHighest));
-            rtR0MemObjDelete(&pMemSolaris->Core);
-            return VERR_NO_MEMORY;
-        }
-        Assert(PhysAddr != UINT64_MAX);
-        Assert(!(PhysAddr & PAGE_OFFSET_MASK));
-
-        pMemSolaris->Core.pv     = pvMem;
-        pMemSolaris->pvHandle    = NULL;
-        pMemSolaris->fIndivPages = false;
-        *ppMem = &pMemSolaris->Core;
-        return VINF_SUCCESS;
-    }
+    return VERR_NO_MEMORY;
 
 #else /* 32 bit: */
@@ -798,4 +801,5 @@
         {
             AssertMsg(!(PhysAddr & (cb - 1)), ("%RHp\n", PhysAddr));
+            pMemSolaris->Core.fFlags           |= RTR0MEMOBJ_FLAGS_UNINITIALIZED_AT_ALLOC; /*?*/
             pMemSolaris->Core.pv                = NULL;
             pMemSolaris->Core.u.Phys.PhysBase   = PhysAddr;
@@ -822,4 +826,5 @@
             Assert(PhysAddr + cb <= PhysHighest);
 
+            pMemSolaris->Core.fFlags           |= RTR0MEMOBJ_FLAGS_UNINITIALIZED_AT_ALLOC;
             pMemSolaris->Core.pv                = pvMem;
             pMemSolaris->Core.u.Phys.PhysBase   = PhysAddr;
