Loading...
libkern/c++/OSRuntime.cpp xnu-2422.100.13 xnu-1504.7.4
--- xnu/xnu-2422.100.13/libkern/c++/OSRuntime.cpp
+++ xnu/xnu-1504.7.4/libkern/c++/OSRuntime.cpp
@@ -225,41 +225,6 @@
 typedef void (*structor_t)(void);
 
 /*********************************************************************
-*********************************************************************/
-static boolean_t
-sectionIsDestructor(kernel_section_t * section)
-{
-    boolean_t result;
-
-    result = !strncmp(section->sectname, SECT_MODTERMFUNC,
-        sizeof(SECT_MODTERMFUNC) - 1);
-#if !__LP64__
-    result = result || !strncmp(section->sectname, SECT_DESTRUCTOR, 
-        sizeof(SECT_DESTRUCTOR) - 1);
-#endif
-
-    return result;
-}
-
-/*********************************************************************
-*********************************************************************/
-static boolean_t
-sectionIsConstructor(kernel_section_t * section)
-{
-    boolean_t result;
-
-    result = !strncmp(section->sectname, SECT_MODINITFUNC,
-        sizeof(SECT_MODINITFUNC) - 1);
-#if !__LP64__
-    result = result || !strncmp(section->sectname, SECT_CONSTRUCTOR, 
-        sizeof(SECT_CONSTRUCTOR) - 1);
-#endif
-
-    return result;
-}
-
-
-/*********************************************************************
 * OSRuntimeUnloadCPPForSegment()
 *
 * Given a pointer to a mach object segment, iterate the segment to
@@ -284,7 +249,9 @@
          section != 0;
          section = nextsect(segment, section)) {
 
-        if (sectionIsDestructor(section)) {
+        if (strncmp(section->sectname, SECT_DESTRUCTOR, 
+            sizeof(SECT_DESTRUCTOR)) == 0) {
+
             structor_t * destructors = (structor_t *)section->addr;
 
             if (destructors) {
@@ -455,7 +422,9 @@
              section != NULL;
              section = nextsect(segment, section)) {
 
-            if (sectionIsConstructor(section)) {
+            if (strncmp(section->sectname, SECT_CONSTRUCTOR, 
+                sizeof(SECT_CONSTRUCTOR)) == 0) {
+
                 structor_t * constructors = (structor_t *)section->addr;
 
                 if (constructors) {
@@ -548,7 +517,6 @@
     // 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.");
     }