Loading...
--- xnu/xnu-3248.50.21/libkern/c++/OSSerialize.cpp
+++ xnu/xnu-2782.1.97/libkern/c++/OSSerialize.cpp
@@ -37,7 +37,6 @@
#include <libkern/c++/OSLib.h>
#include <libkern/c++/OSDictionary.h>
#include <libkern/OSSerializeBinary.h>
-#include <IOKit/IOLib.h>
#define super OSObject
@@ -51,6 +50,14 @@
OSMetaClassDefineReservedUnused(OSSerialize, 6);
OSMetaClassDefineReservedUnused(OSSerialize, 7);
+#if OSALLOCDEBUG
+extern "C" {
+ extern int debug_container_malloc_size;
+};
+#define ACCUMSIZE(s) do { debug_container_malloc_size += (s); } while(0)
+#else
+#define ACCUMSIZE(s)
+#endif
char * OSSerialize::text() const
{
@@ -177,7 +184,7 @@
// allocate from the kernel map so that we can safely map this data
// into user space (the primary use of the OSSerialize object)
- kern_return_t rc = kmem_alloc(kernel_map, (vm_offset_t *)&data, capacity, IOMemoryTag(kernel_map));
+ kern_return_t rc = kmem_alloc(kernel_map, (vm_offset_t *)&data, capacity);
if (rc) {
tags->release();
tags = 0;
@@ -186,7 +193,7 @@
bzero((void *)data, capacity);
- OSCONTAINER_ACCUMSIZE(capacity);
+ ACCUMSIZE(capacity);
return true;
}
@@ -226,14 +233,13 @@
(vm_offset_t)data,
capacity,
(vm_offset_t *)&newData,
- newCapacity,
- VM_KERN_MEMORY_IOKIT);
+ newCapacity);
if (!rc) {
- OSCONTAINER_ACCUMSIZE(newCapacity);
+ ACCUMSIZE(newCapacity);
// kmem realloc does not free the old address range
kmem_free(kernel_map, (vm_offset_t)data, capacity);
- OSCONTAINER_ACCUMSIZE(-((size_t)capacity));
+ ACCUMSIZE(-capacity);
// kmem realloc does not zero out the new memory
// and this could end up going to user land
@@ -253,7 +259,7 @@
if (data) {
kmem_free(kernel_map, (vm_offset_t)data, capacity);
- OSCONTAINER_ACCUMSIZE( -((size_t)capacity) );
+ ACCUMSIZE( -capacity );
}
super::free();
}