Loading...
libkern/c++/OSObject.cpp xnu-12377.101.15 xnu-6153.101.6
--- xnu/xnu-12377.101.15/libkern/c++/OSObject.cpp
+++ xnu/xnu-6153.101.6/libkern/c++/OSObject.cpp
@@ -42,7 +42,7 @@
 #include <kern/queue.h>
 
 __BEGIN_DECLS
-size_t debug_ivars_size;
+int debug_ivars_size;
 __END_DECLS
 
 
@@ -136,8 +136,8 @@
 #else /* DEBUG */
 				// @@@ gvdl: eventually need to make this panic optional
 				// based on a boot argument i.e. debug= boot flag
-				panic("OSObject(%p)::refcount: "
-				    "About to wrap the reference count, reference leak?", this);
+				panic("OSObject::refcount: "
+				    "About to wrap the reference count, reference leak?");
 #endif /* !DEBUG */
 			}
 		}
@@ -152,7 +152,7 @@
 OSObject::taggedRetain(const void *tag) const
 {
 	if (!taggedTryRetain(tag)) {
-		panic("OSObject(%p)::refcount: Attempting to retain a freed object", this);
+		panic("OSObject::refcount: Attempting to retain a freed object");
 	}
 }
 
@@ -195,8 +195,8 @@
 #else /* DEBUG */
 				// @@@ gvdl: eventually need to make this panic optional
 				// based on a boot argument i.e. debug= boot flag
-				panic("OSObject(%p)::refcount: %s",
-				    "About to unreference a pegged object, reference leak?", this);
+				panic("OSObject::refcount: %s",
+				    "About to unreference a pegged object, reference leak?");
 #endif /* !DEBUG */
 			}
 		}
@@ -220,8 +220,8 @@
 // xxx - any code in the kernel could trip this,
 // xxx - and it applies as noted to all collections, not just the registry
 	if ((UInt16) actualCount < (actualCount >> 16)) {
-		panic("A kext releasing a(n) %s %p has corrupted the registry.",
-		    getClassName(this), this);
+		panic("A kext releasing a(n) %s has corrupted the registry.",
+		    getClassName(this));
 	}
 
 	// Check for a 'free' condition and that if we are first through
@@ -280,17 +280,6 @@
 	return ok;
 }
 
-/*
- * Ignore -Wxnu-typed-allocators for the operator new/delete implementations
- */
-__typed_allocators_ignore_push
-
-/*
- * Given that all OSObjects have been transitioned to use
- * OSObject_typed_operator_new/OSObject_typed_operator_delete, this should
- * only be called from kexts that havent recompiled to use the new
- * definitions.
- */
 void *
 OSObject::operator new(size_t size)
 {
@@ -300,44 +289,9 @@
 	}
 #endif
 
-	void *mem = kheap_alloc(KHEAP_DEFAULT, size,
-	    Z_VM_TAG_BT(Z_WAITOK_ZERO, VM_KERN_MEMORY_LIBKERN));
+	void * mem = kalloc_tag_bt(size, VM_KERN_MEMORY_LIBKERN);
 	assert(mem);
-	OSIVAR_ACCUMSIZE(size);
-
-	return (void *) mem;
-}
-
-void *
-OSObject_typed_operator_new(kalloc_type_view_t ktv, vm_size_t size)
-{
-#if IOTRACKING
-	if (kIOTracking & gIOKitDebug) {
-		return OSMetaClass::trackedNew(size);
-	}
-#endif
-
-	/*
-	 * Some classes in kexts that subclass from iokit classes
-	 * don't use OSDeclare/OSDefine to declare/define structors.
-	 * When operator new is called on such objects they end up
-	 * using the parent's operator new/delete. If we detect such
-	 * a case we default to using kalloc rather than kalloc_type
-	 */
-	void *mem = NULL;
-	if (size <= kalloc_type_get_size(ktv->kt_size)) {
-		/*
-		 * OSObject_typed_operator_new can be called from kexts,
-		 * use the external symbol for kalloc_type_impl as
-		 * kalloc_type_views generated at some external callsites
-		 * many not have been processed during boot.
-		 */
-		mem = kalloc_type_impl_external(ktv, Z_WAITOK_ZERO);
-	} else {
-		mem = kheap_alloc(KHEAP_DEFAULT, size,
-		    Z_VM_TAG_BT(Z_WAITOK_ZERO, VM_KERN_MEMORY_LIBKERN));
-	}
-	assert(mem);
+	bzero(mem, size);
 	OSIVAR_ACCUMSIZE(size);
 
 	return (void *) mem;
@@ -356,33 +310,9 @@
 	}
 #endif
 
-	kheap_free(KHEAP_DEFAULT, mem, size);
+	kfree(mem, size);
 	OSIVAR_ACCUMSIZE(-size);
 }
-
-void
-OSObject_typed_operator_delete(kalloc_type_view_t ktv, void * mem,
-    vm_size_t size)
-{
-	if (!mem) {
-		return;
-	}
-
-#if IOTRACKING
-	if (kIOTracking & gIOKitDebug) {
-		return OSMetaClass::trackedDelete(mem, size);
-	}
-#endif
-
-	if (size <= kalloc_type_get_size(ktv->kt_size)) {
-		kern_os_typed_free(ktv, mem, size);
-	} else {
-		kheap_free(KHEAP_DEFAULT, mem, size);
-	}
-	OSIVAR_ACCUMSIZE(-size);
-}
-
-__typed_allocators_ignore_pop
 
 bool
 OSObject::init()