Loading...
iokit/Kernel/IODataQueue.cpp xnu-12377.121.6 xnu-8019.41.5
--- xnu/xnu-12377.121.6/iokit/Kernel/IODataQueue.cpp
+++ xnu/xnu-8019.41.5/iokit/Kernel/IODataQueue.cpp
@@ -33,7 +33,6 @@
 #include <IOKit/IODataQueue.h>
 
 #undef DISABLE_DATAQUEUE_WARNING
-#include <vm/vm_kern_xnu.h>
 
 #include <IOKit/IODataQueueShared.h>
 #include <IOKit/IOLib.h>
@@ -90,7 +89,6 @@
 IODataQueue::initWithCapacity(UInt32 size)
 {
 	vm_size_t allocSize = 0;
-	kern_return_t kr;
 
 	if (!super::init()) {
 		return false;
@@ -110,11 +108,11 @@
 	notifyMsg = IOMallocType(IODataQueueInternal);
 	((IODataQueueInternal *)notifyMsg)->queueSize = size;
 
-	kr = kmem_alloc(kernel_map, (vm_offset_t *)&dataQueue, allocSize,
-	    (kma_flags_t)(KMA_DATA_SHARED | KMA_ZERO), IOMemoryTag(kernel_map));
-	if (kr != KERN_SUCCESS) {
-		return false;
-	}
+	dataQueue = (IODataQueueMemory *)IOMallocAligned(allocSize, PAGE_SIZE);
+	if (dataQueue == NULL) {
+		return false;
+	}
+	bzero(dataQueue, allocSize);
 
 	dataQueue->queueSize    = size;
 //  dataQueue->head         = 0;
@@ -144,9 +142,7 @@
 {
 	if (notifyMsg) {
 		if (dataQueue) {
-			kmem_free(kernel_map, (vm_offset_t)dataQueue,
-			    round_page(((IODataQueueInternal *)notifyMsg)->queueSize +
-			    DATA_QUEUE_MEMORY_HEADER_SIZE));
+			IOFreeAligned(dataQueue, round_page(((IODataQueueInternal *)notifyMsg)->queueSize + DATA_QUEUE_MEMORY_HEADER_SIZE));
 			dataQueue = NULL;
 		}
 
@@ -277,8 +273,7 @@
 
 	msgh = &((IODataQueueInternal *) notifyMsg)->msg;
 	if (msgh->msgh_remote_port) {
-		kr = mach_msg_send_from_kernel_with_options(msgh, msgh->msgh_size,
-		    MACH64_SEND_TIMEOUT, MACH_MSG_TIMEOUT_NONE);
+		kr = mach_msg_send_from_kernel_with_options(msgh, msgh->msgh_size, MACH_SEND_TIMEOUT, MACH_MSG_TIMEOUT_NONE);
 		switch (kr) {
 		case MACH_SEND_TIMED_OUT: // Notification already sent
 		case MACH_MSG_SUCCESS: