#include <libsa/malloc.h>
};
+#include "kld_patch.h"
+
extern "C" {
/*****
* This function is used by IOCatalogue to load a kernel
* about loading and matching drivers.
*/
extern int kernelLinkerPresent;
-
-extern IOLock * kld_lock;
};
*/
KLDBootstrap::KLDBootstrap() {
- kld_lock = IOLockAlloc();
- IOLockLock(kld_lock);
-
kmod_load_function = &load_kernel_extension;
record_startup_extensions_function = &recordStartupExtensions;
remove_startup_extension_function = &removeStartupExtension;
kernelLinkerPresent = 1;
-
- IOLockUnlock(kld_lock);
}
/* The destructor frees all wired memory regions held
*/
KLDBootstrap::~KLDBootstrap() {
- OSDictionary * startupExtensions;
+ kld_file_cleanup_all_resources();
- IOLockLock(kld_lock);
+ /* Dump all device-tree entries for boot drivers, and all
+ * info on startup extensions. The IOCatalogue will now
+ * get personalities from kextd.
+ */
+ clearStartupExtensionsAndLoaderInfo();
+ /* Free all temporary malloc memory.
+ */
malloc_reset();
-
- startupExtensions = getStartupExtensions();
- if (startupExtensions) startupExtensions->release();
-
- IOLockUnlock(kld_lock);
- IOLockFree(kld_lock);
-
}