Loading...
--- xnu/xnu-10002.1.13/iokit/Kernel/IOBufferMemoryDescriptor.cpp
+++ xnu/xnu-8020.140.41/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
@@ -333,7 +332,7 @@
KMA_GUARD_LAST | KMA_ZERO);
if (((uint32_t) alignment) != alignment) {
- return false;
+ return NULL;
}
if (kheap == KHEAP_DATA_BUFFERS) {
kma_flags = (kma_flags_t) (kma_flags | KMA_DATA);
@@ -366,14 +365,10 @@
}
#endif /* defined(__x86_64__) */
} else if (alignment > 1) {
- /* BEGIN IGNORE CODESTYLE */
- __typed_allocators_ignore_push
_buffer = IOMallocAligned_internal(kheap, capacity, alignment,
Z_ZERO_VM_TAG_BT_BIT);
} else {
_buffer = IOMalloc_internal(kheap, capacity, Z_ZERO_VM_TAG_BT_BIT);
- __typed_allocators_ignore_pop
- /* END IGNORE CODESTYLE */
}
if (!_buffer) {
return false;
@@ -642,13 +637,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 +675,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 +690,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
@@ -750,13 +738,9 @@
#endif
IOStatisticsAlloc(kIOStatisticsFreeAligned, size);
} else if (alignment > 1) {
- /* BEGIN IGNORE CODESTYLE */
- __typed_allocators_ignore_push
IOFreeAligned_internal(kheap, buffer, size);
} else {
IOFree_internal(kheap, buffer, size);
- __typed_allocators_ignore_pop
- /* END IGNORE CODESTYLE */
}
}
if (range && (kIOMemoryAsReference & flags)) {