X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/5d5c5d0d5b79ade9a973d55186ffda2638ba2b6e..8f6c56a50524aa785f7e596d52dddfb331e18961:/libsa/catalogue.cpp diff --git a/libsa/catalogue.cpp b/libsa/catalogue.cpp index 7c68bbcb2..1c4c563bf 100644 --- a/libsa/catalogue.cpp +++ b/libsa/catalogue.cpp @@ -1,37 +1,34 @@ /* * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. * - * @APPLE_LICENSE_OSREFERENCE_HEADER_START@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the - * License may not be used to create, or enable the creation or - * redistribution of, unlawful or unlicensed copies of an Apple operating - * system, or to circumvent, violate, or enable the circumvention or - * violation of, any terms of an Apple operating system software license - * agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and * limitations under the License. - * - * @APPLE_LICENSE_OSREFERENCE_HEADER_END@ + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ #include #include #include #include -#include #include #include #include @@ -120,7 +117,6 @@ bool validateExtensionDict(OSDictionary * extension, int index) { bool id_missing = false; bool is_kernel_resource = false; bool has_executable = false; - bool ineligible_for_safe_boot = false; OSString * bundleIdentifier = NULL; // do not release OSObject * rawValue = NULL; // do not release OSString * stringValue = NULL; // do not release @@ -131,7 +127,6 @@ bool validateExtensionDict(OSDictionary * extension, int index) { OSString * key = NULL; // do not release VERS_version vers; VERS_version compatible_vers; - char namep[16]; // unused but needed for PE_parse_boot_arg() // Info dict is a dictionary if (!OSDynamicCast(OSDictionary, extension)) { @@ -354,10 +349,9 @@ bool validateExtensionDict(OSDictionary * extension, int index) { keyIterator = NULL; } - // OSBundleRequired, if present, must have a legal value. - // If it is not present and if we are safe-booting, - // then the kext is not eligible. - // + // OSBundleRequired is a legal value - *not* required at boot time + // so we can do install CDs and the like with mkext files containing + // all normally-used drivers. rawValue = extension->getObject("OSBundleRequired"); if (rawValue) { stringValue = OSDynamicCast(OSString, rawValue); @@ -375,10 +369,6 @@ bool validateExtensionDict(OSDictionary * extension, int index) { goto finish; } - } else if (PE_parse_boot_arg("-x", namep)) { /* safe boot */ - ineligible_for_safe_boot = true; - result = false; - goto finish; } @@ -386,24 +376,19 @@ finish: if (keyIterator) keyIterator->release(); if (!result) { - if (ineligible_for_safe_boot) { - IOLog(VTYELLOW "Skipping extension \"%s\" during safe boot " - "(no OSBundleRequired property)\n" - VTRESET, - bundleIdentifier->getCStringNoCopy()); - } else if (not_a_dict) { + if (not_a_dict) { if (index > -1) { - IOLog(VTYELLOW "mkext entry %d: " VTRESET, index); + IOLog(VTYELLOW "mkext entry %d:." VTRESET, index); } else { - IOLog(VTYELLOW "kernel extension " VTRESET); + IOLog(VTYELLOW "kernel extension" VTRESET); } IOLog(VTYELLOW "info dictionary isn't a dictionary\n" VTRESET); } else if (id_missing) { if (index > -1) { - IOLog(VTYELLOW "mkext entry %d: " VTRESET, index); + IOLog(VTYELLOW "mkext entry %d:." VTRESET, index); } else { - IOLog(VTYELLOW "kernel extension " VTRESET); + IOLog(VTYELLOW "kernel extension" VTRESET); } IOLog(VTYELLOW "\"CFBundleIdentifier\" property is " "missing or not a string\n" @@ -727,12 +712,13 @@ OSDictionary * readExtension(OSDictionary * propertyDict, bootxDriverDataObject->getBytesNoCopy(0, sizeof(MemoryMapFileInfo)); #if defined (__ppc__) - dataBuffer = (BootxDriverInfo *)ml_static_ptovirt(driverInfo->paddr); + dataBuffer = (BootxDriverInfo *)ml_static_ptovirt( + driverInfo->paddr); #elif defined (__i386__) - dataBuffer = (BootxDriverInfo *)ml_boot_ptovirt(driverInfo->paddr); - dataBuffer->plistAddr = (char *)ml_boot_ptovirt((vm_address_t)dataBuffer->plistAddr); + dataBuffer = (BootxDriverInfo *)driverInfo->paddr; + dataBuffer->plistAddr = ml_static_ptovirt(dataBuffer->plistAddr); if (dataBuffer->moduleAddr) - dataBuffer->moduleAddr = (void *)ml_boot_ptovirt((vm_address_t)dataBuffer->moduleAddr); + dataBuffer->moduleAddr = ml_static_ptovirt(dataBuffer->moduleAddr); #else #error unsupported architecture #endif @@ -821,7 +807,7 @@ OSDictionary * readExtension(OSDictionary * propertyDict, finish: if (loaded_kmod) { - kfree(loaded_kmod, sizeof(kmod_info_t)); + kfree((unsigned int)loaded_kmod, sizeof(kmod_info_t)); } // do not release bootxDriverDataObject @@ -971,7 +957,7 @@ bool extractExtensionsFromArchive(MemoryMapFileInfo * mkext_file_info, #if defined (__ppc__) mkext_data = (mkext_header *)mkext_file_info->paddr; #elif defined (__i386__) - mkext_data = (mkext_header *)ml_boot_ptovirt(mkext_file_info->paddr); + mkext_data = (mkext_header *)ml_static_ptovirt(mkext_file_info->paddr); #else #error unsupported architecture #endif @@ -1003,16 +989,6 @@ bool extractExtensionsFromArchive(MemoryMapFileInfo * mkext_file_info, goto finish; } - IORegistryEntry * root = IORegistryEntry::getRegistryRoot(); - assert(root); - OSData * checksumObj = OSData::withBytes((void *)&checksum, - sizeof(checksum)); - assert(checksumObj); - if (checksumObj) { - root->setProperty(kIOStartupMkextCRC, checksumObj); - checksumObj->release(); - } - /* If the MKEXT archive isn't fat, check that the CPU type & subtype * match that of the running kernel. */ @@ -1054,7 +1030,7 @@ bool extractExtensionsFromArchive(MemoryMapFileInfo * mkext_file_info, i++) { if (loaded_kmod) { - kfree(loaded_kmod, sizeof(kmod_info_t)); + kfree((unsigned int)loaded_kmod, sizeof(kmod_info_t)); loaded_kmod = 0; } @@ -1232,7 +1208,7 @@ bool extractExtensionsFromArchive(MemoryMapFileInfo * mkext_file_info, finish: - if (loaded_kmod) kfree(loaded_kmod, sizeof(kmod_info_t)); + if (loaded_kmod) kfree((unsigned int)loaded_kmod, sizeof(kmod_info_t)); if (driverPlistDataObject) { kmem_free(kernel_map, (unsigned int)driverPlistDataObject->getBytesNoCopy(),