Loading...
libkern/c++/OSRuntime.cpp xnu-3248.50.21 xnu-1699.22.81
--- xnu/xnu-3248.50.21/libkern/c++/OSRuntime.cpp
+++ xnu/xnu-1699.22.81/libkern/c++/OSRuntime.cpp
@@ -33,7 +33,6 @@
 #include <libkern/c++/OSKext.h>
 #include <libkern/c++/OSLib.h>
 #include <libkern/c++/OSSymbol.h>
-#include <IOKit/IOKitDebug.h>
 
 #include <sys/cdefs.h>
 
@@ -74,6 +73,7 @@
         }                                                     \
     } while (0)
 
+
 #if PRAGMA_MARK
 #pragma mark kern_os Allocator Package
 #endif /* PRAGMA_MARK */
@@ -104,7 +104,7 @@
         return (0);
     }
 
-    mem = (struct _mhead *)kalloc_tag_bt(memsize, VM_KERN_MEMORY_LIBKERN);
+    mem = (struct _mhead *)kalloc(memsize);
     if (!mem) {
         return (0);
     }
@@ -172,7 +172,7 @@
     }
 
     nmemsize = sizeof (*nmem) + nsize ;
-    nmem = (struct _mhead *) kalloc_tag_bt(nmemsize, VM_KERN_MEMORY_LIBKERN);
+    nmem = (struct _mhead *) kalloc(nmemsize);
     if (!nmem){
         kern_os_free(addr);
         return (0);
@@ -412,7 +412,7 @@
     kernel_segment_command_t * segment         = NULL;  // do not free
     kernel_segment_command_t * failure_segment = NULL;  // do not free
 
-    if (!kmodInfo || !kmodInfo->address) {
+    if (!kmodInfo || !kmodInfo->address || !kmodInfo->name) {
         result = kOSKextReturnInvalidArgument;
         goto finish;
     }
@@ -537,15 +537,17 @@
 
 /*********************************************************************
 *********************************************************************/
+extern lck_spin_t  gOSObjectTrackLock;
 extern lck_grp_t * IOLockGroup;
 extern kmod_info_t g_kernel_kmod_info;
 
 void OSlibkernInit(void)
 {
+    lck_spin_init(&gOSObjectTrackLock, IOLockGroup, LCK_ATTR_NULL);
+ 
     // This must be called before calling OSRuntimeInitializeCPP.
     OSMetaClassBase::initialize();
     
-    g_kernel_kmod_info.address = (vm_address_t) &_mh_execute_header;
     if (kOSReturnSuccess != OSRuntimeInitializeCPP(&g_kernel_kmod_info, 0)) {
         panic("OSRuntime: C++ runtime failed to initialize.");
     }
@@ -565,9 +567,6 @@
 *********************************************************************/
 void *
 operator new(size_t size)
-#if __cplusplus >= 201103L
-								noexcept
-#endif
 {
     void * result;
 
@@ -577,9 +576,6 @@
 
 void
 operator delete(void * addr)
-#if __cplusplus >= 201103L
-								noexcept
-#endif
 {
     kern_os_free(addr);
     return;
@@ -587,9 +583,6 @@
 
 void *
 operator new[](unsigned long sz)
-#if __cplusplus >= 201103L
-								noexcept
-#endif
 {
     if (sz == 0) sz = 1;
     return kern_os_malloc(sz);
@@ -597,9 +590,6 @@
 
 void
 operator delete[](void * ptr)
-#if __cplusplus >= 201103L
-								noexcept
-#endif
 {
     if (ptr) {
         kern_os_free(ptr);