+// From <osfmk/kern/debug.c>
+extern int debug_mode;
+
+/*****
+ * Pointer into bootstrap KLD segment for functions never used past startup.
+ */
+void (*record_startup_extensions_function)(void) = 0;
+
+void StartIOKit( void * p1, void * p2, void * p3, void * p4 )
+{
+ IOPlatformExpertDevice * rootNub;
+ int debugFlags;
+
+ if( PE_parse_boot_argn( "io", &debugFlags, sizeof (debugFlags) ))
+ gIOKitDebug = debugFlags;
+
+ if( PE_parse_boot_argn( "iotrace", &debugFlags, sizeof (debugFlags) ))
+ gIOKitTrace = debugFlags;
+
+ // Compat for boot-args
+ gIOKitTrace |= (gIOKitDebug & kIOTraceCompatBootArgs);
+
+ // Check for the log synchronous bit set in io
+ if (gIOKitDebug & kIOLogSynchronous)
+ debug_mode = true;
+
+ //
+ // Have to start IOKit environment before we attempt to start
+ // the C++ runtime environment. At some stage we have to clean up
+ // the initialisation path so that OS C++ can initialise independantly
+ // of iokit basic service initialisation, or better we have IOLib stuff
+ // initialise as basic OS services.
+ //
+ IOLibInit();
+ OSlibkernInit();
+
+ gIOProgressBackbufferKey = OSSymbol::withCStringNoCopy(kIOProgressBackbufferKey);
+ gIORemoveOnReadProperties = OSSet::withObjects((const OSObject **) &gIOProgressBackbufferKey, 1);
+
+ interruptAccountingInit();