Loading...
iokit/Kernel/IOBufferMemoryDescriptor.cpp xnu-10002.1.13 xnu-8792.81.2
--- xnu/xnu-10002.1.13/iokit/Kernel/IOBufferMemoryDescriptor.cpp
+++ xnu/xnu-8792.81.2/iokit/Kernel/IOBufferMemoryDescriptor.cpp
@@ -59,7 +59,6 @@
 void ipc_port_release_send(ipc_port_t port);
 #include <vm/pmap.h>
 
-KALLOC_HEAP_DEFINE(KHEAP_IOBMD_CONTROL, "IOBMD_control", KHEAP_ID_KT_VAR);
 __END_DECLS
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -219,10 +218,10 @@
 	}
 
 	/*
-	 * Set kalloc_heap to KHEAP_IOBMD_CONTROL if allocation contains pointers
+	 * Set kalloc_heap to default if allocation contains pointers
 	 */
 	if (kInternalFlagHasPointers & _internalFlags) {
-		kheap = KHEAP_IOBMD_CONTROL;
+		kheap = KHEAP_DEFAULT;
 	}
 
 	//  make sure super::free doesn't dealloc _ranges before super::init
@@ -642,13 +641,11 @@
     bool         inContiguous)
 {
 	OSSharedPtr<IOBufferMemoryDescriptor> me = OSMakeShared<IOBufferMemoryDescriptor>();
-	mach_vm_address_t alignment;
-
-	alignment = (inLength <= page_size) ? inLength : page_size;
+
 	if (me && !me->initWithPhysicalMask(
 		    kernel_task, inDirection | kIOMemoryUnshared
 		    | (inContiguous ? kIOMemoryPhysicallyContiguous : 0),
-		    inLength, alignment, 0 )) {
+		    inLength, inLength, 0 )) {
 		me.reset();
 	}
 
@@ -682,12 +679,9 @@
 	IOAddressRange * range     = _ranges.v64;
 	vm_offset_t      alignment = _alignment;
 	kalloc_heap_t    kheap     = KHEAP_DATA_BUFFERS;
-	vm_size_t        rsize;
 
 	if (alignment >= page_size) {
-		if (!round_page_overflow(size, &rsize)) {
-			size = rsize;
-		}
+		size = round_page(size);
 	}
 
 	if (reserved) {
@@ -700,13 +694,11 @@
 
 	if ((options & kIOMemoryPageable)
 	    || (kInternalFlagPageSized & internalFlags)) {
-		if (!round_page_overflow(size, &rsize)) {
-			size = rsize;
-		}
+		size = round_page(size);
 	}
 
 	if (internalFlags & kInternalFlagHasPointers) {
-		kheap = KHEAP_IOBMD_CONTROL;
+		kheap = KHEAP_DEFAULT;
 	}
 
 #if IOTRACKING