Index: /trunk/src/VBox/ExtPacks/VBoxDTrace/VBoxDTraceR0/VBoxDTraceR0.cpp
===================================================================
--- /trunk/src/VBox/ExtPacks/VBoxDTrace/VBoxDTraceR0/VBoxDTraceR0.cpp	(revision 53674)
+++ /trunk/src/VBox/ExtPacks/VBoxDTrace/VBoxDTraceR0/VBoxDTraceR0.cpp	(revision 53675)
@@ -886,6 +886,6 @@
     /** The configured resource base. */
     uint32_t            uBase;
-    /** The configured resource end (base included). */
-    uint32_t            uEnd;
+    /** The configured max number of items. */
+    uint32_t            cMaxItems;
     /** The size of the apChunks array. */
     uint32_t            cMaxChunks;
@@ -910,4 +910,5 @@
      */
     AssertMsgReturn((uintptr_t)pvBase <= UINT32_MAX, ("%p\n", pvBase), NULL);
+    AssertMsgReturn(cb <= UINT32_MAX, ("%zu\n", cb), NULL);
     AssertMsgReturn((uintptr_t)pvBase + cb - 1 <= UINT32_MAX, ("%p %zu\n", pvBase, cb), NULL);
     AssertMsgReturn(cbUnit == 1, ("%zu\n", cbUnit), NULL);
@@ -922,7 +923,7 @@
      * Allocate the instance.
      */
-    uint32_t cChunks = (uint32_t)(cb - (uintptr_t)pvBase);
-    cChunks += VBOXDTVMEMCHUNK_BITS - 1;
-    cChunks /= VBOXDTVMEMCHUNK_BITS;
+    uint32_t cChunks = cb / VBOXDTVMEMCHUNK_BITS;
+    if (cb % VBOXDTVMEMCHUNK_BITS)
+        cChunks++;
     PVBOXDTVMEM pThis = (PVBOXDTVMEM)RTMemAllocZ(RT_OFFSETOF(VBOXDTVMEM, apChunks[cChunks]));
     if (!pThis)
@@ -938,5 +939,5 @@
     pThis->cCurChunks   = 0;
     pThis->uBase        = (uint32_t)(uintptr_t)pvBase;
-    pThis->uEnd         = (uint32_t)cb;
+    pThis->cMaxItems    = (uint32_t)cb;
     pThis->cMaxChunks   = cChunks;
 
@@ -1024,8 +1025,5 @@
         /* Out of resources? */
         if (cChunks >= pThis->cMaxChunks)
-        {
-SUPR0Printf("cChunks=%u cMaxChunks=%u!!\n", cChunks, pThis->cMaxChunks);
             break;
-        }
 
         /*
@@ -1034,5 +1032,5 @@
         uint32_t const  iFirstBit = cChunks > 0 ? pThis->apChunks[cChunks - 1]->iFirst + VBOXDTVMEMCHUNK_BITS : 0;
         uint32_t const  cFreeBits = cChunks + 1 == pThis->cMaxChunks
-                                  ? pThis->uEnd - pThis->uBase - iFirstBit
+                                  ? pThis->cMaxItems - (iFirstBit - pThis->uBase)
                                   : VBOXDTVMEMCHUNK_BITS;
         Assert(cFreeBits <= VBOXDTVMEMCHUNK_BITS);
@@ -1042,8 +1040,5 @@
         pChunk = (PVBOXDTVMEMCHUNK)RTMemAllocZ(sizeof(*pChunk));
         if (!pChunk)
-        {
-SUPR0Printf("returning NULL!!\n");
             return NULL;
-        }
 
 SUPR0Printf("Adding chunk %p at bit %u, covering %u bits\n", pChunk, iFirstBit, cFreeBits);
@@ -1099,7 +1094,7 @@
     uint32_t uMem = (uint32_t)(uintptr_t)pvMem;
     AssertReturnVoid(uMem >= pThis->uBase);
-    AssertReturnVoid(uMem < pThis->uEnd);
-
     uMem -= pThis->uBase;
+    AssertReturnVoid(uMem < pThis->cMaxItems);
+
 
     /*
Index: /trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/dtrace.c
===================================================================
--- /trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/dtrace.c	(revision 53674)
+++ /trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/dtrace.c	(revision 53675)
@@ -12565,6 +12565,11 @@
 	(void) snprintf(c, sizeof (c), "dtrace_aggid_%p", state);
 #endif
+#ifndef VBOX /* Avoid idProbe = UINT32_MAX as it is used as invalid value by VTG. */
 	state->dts_aggid_arena = vmem_create(c, (void *)1, UINT32_MAX, 1,
 	    NULL, NULL, NULL, 0, VM_SLEEP | VMC_IDENTIFIER);
+#else
+        state->dts_aggid_arena = vmem_create(c, (void *)1, _1G, 1,
+            NULL, NULL, NULL, 0, VM_SLEEP | VMC_IDENTIFIER);
+#endif
 
 #ifndef VBOX
@@ -14868,6 +14873,11 @@
 	ASSERT(MUTEX_HELD(&cpu_lock));
 
+#ifndef VBOX /* Reduce the area a bit just to be sure our vmem fake doesn't blow up. */
 	dtrace_arena = vmem_create("dtrace", (void *)1, UINT32_MAX, 1,
 	    NULL, NULL, NULL, 0, VM_SLEEP | VMC_IDENTIFIER);
+#else
+        dtrace_arena = vmem_create("dtrace", (void *)1, UINT32_MAX - 16, 1,
+            NULL, NULL, NULL, 0, VM_SLEEP | VMC_IDENTIFIER);
+#endif
 #ifndef VBOX
 	dtrace_minor = vmem_create("dtrace_minor", (void *)DTRACEMNRN_CLONE,
