Index: trunk/i386/libsaio/bootstruct.c =================================================================== --- trunk/i386/libsaio/bootstruct.c (revision 2770) +++ trunk/i386/libsaio/bootstruct.c (revision 2771) @@ -126,7 +126,7 @@ void reserveKernBootStruct(void) { - if ( TIGER || LEOPARD || SNOW_LEOPARD ) + if ( MacOSVerCurrent < MacOSVer2Int("10.7") ) { // for 10.4 10.5 10.6 void *oldAddr = bootArgsLegacy; Index: trunk/i386/libsaio/bootstruct.h =================================================================== --- trunk/i386/libsaio/bootstruct.h (revision 2770) +++ trunk/i386/libsaio/bootstruct.h (revision 2771) @@ -33,9 +33,9 @@ /* * Kernel boot args global also used by booter for its own data. */ -extern boot_args *bootArgs; -extern boot_args_legacy *bootArgsLegacy; -extern Node *gMemoryMapNode; +extern boot_args *bootArgs; +extern boot_args_legacy *bootArgsLegacy; +extern Node *gMemoryMapNode; #define VGA_TEXT_MODE 0 //defined in /usr/../boot.h Index: trunk/i386/boot2/drivers.c =================================================================== --- trunk/i386/boot2/drivers.c (revision 2770) +++ trunk/i386/boot2/drivers.c (revision 2771) @@ -119,8 +119,7 @@ // Bungo: char gDarwinBuildVerStr[256] = "Darwin Kernel Version"; -/*static*/ unsigned long -Adler32( unsigned char *buffer, long length ) +/*static*/ unsigned long Adler32( unsigned char *buffer, long length ) { long cnt; unsigned long result, lowHalf, highHalf; @@ -150,7 +149,6 @@ //========================================================================== // InitDriverSupport - static long InitDriverSupport( void ) { gExtensionsSpec = malloc( 4096 ); @@ -169,8 +167,7 @@ //========================================================================== // LoadDrivers - -long LoadDrivers( char * dirSpec ) +long LoadDrivers( char *dirSpec ) { char dirSpecExtra[1024]; @@ -282,8 +279,7 @@ //========================================================================== // FileLoadMKext - -static long FileLoadMKext( const char * dirSpec, const char * extDirSpec ) +static long FileLoadMKext( const char *dirSpec, const char *extDirSpec ) { long ret, flags; u_int32_t time, time2; @@ -314,8 +310,7 @@ //========================================================================== // FileLoadDrivers - -long FileLoadDrivers( char * dirSpec, long plugin ) +long FileLoadDrivers( char *dirSpec, long plugin ) { long long index; long ret, length, flags, bundleType; @@ -396,11 +391,9 @@ return result; } - //========================================================================== // - -long NetLoadDrivers( char * dirSpec ) +long NetLoadDrivers( char *dirSpec ) { long tries; @@ -441,13 +434,12 @@ //========================================================================== // loadDriverMKext - -long LoadDriverMKext( char * fileSpec ) +long LoadDriverMKext( char *fileSpec ) { - unsigned long driversAddr, driversLength; - long length; - char segName[32]; - DriversPackage * package; + unsigned long driversAddr, driversLength; + long length; + char segName[32]; + DriversPackage *package; #define GetPackageElement(e) OSSwapBigToHostInt32(package->e) @@ -459,7 +451,7 @@ } // call hook to notify modules that the mkext has been loaded - execute_hook("LoadDriverMKext", (void*)fileSpec, (void*)package, (void*) &length, NULL); + execute_hook("LoadDriverMKext", (void *)fileSpec, (void *)package, (void *) &length, NULL); // Verify the MKext. @@ -488,9 +480,7 @@ //========================================================================== // LoadDriverPList - -long -LoadDriverPList( char * dirSpec, char * name, long bundleType ) +long LoadDriverPList( char *dirSpec, char *name, long bundleType ) { long length, executablePathLength, bundlePathLength; ModulePtr module; @@ -643,12 +633,9 @@ return ret; } - //========================================================================== // LoadMatchedModules - -long -LoadMatchedModules( void ) +long LoadMatchedModules( void ) { TagPtr prop; ModulePtr module; @@ -743,9 +730,7 @@ //========================================================================== // MatchPersonalities - -static long -MatchPersonalities( void ) +static long MatchPersonalities( void ) { /* IONameMatch support not implemented */ return 0; @@ -753,7 +738,6 @@ //========================================================================== // MatchLibraries - static long MatchLibraries( void ) { TagPtr prop; @@ -808,7 +792,6 @@ return 0; } - //========================================================================== // FindModule @@ -838,7 +821,6 @@ //========================================================================== // ParseXML - static long ParseXML( char *buffer, ModulePtr *module, TagPtr *personalities ) { long length; @@ -875,7 +857,7 @@ required = XMLGetProperty(moduleDict, kPropOSBundleRequired); - if ( (required == 0) || (required->type != kTagTypeString) || !strcmp(required->string, "Safe Boot")) + if ( (required == 0) || (required->type != kTagTypeString) || !strncmp(required->string, "Safe Boot", sizeof("Safe Boot"))) { XMLFreeTag(moduleDict); return -2; @@ -913,7 +895,7 @@ u_int32_t uncompressed_size = 0, size = 0, adler32 = 0; void *buffer = NULL; unsigned long len = 0; - + /*#if 0 printf("kernel header:\n"); printf("signature: 0x%x\n", kernel_header->signature); @@ -926,23 +908,23 @@ if (kernel_header->signature == OSSwapBigToHostConstInt32('comp')) { - DBG("Decompressing Kernel Cache"); + DBG("Decompressing Kernel Cache:\n"); if ((kernel_header->compress_type != OSSwapBigToHostConstInt32('lzss')) && (kernel_header->compress_type != OSSwapBigToHostConstInt32('lzvn'))) { - error("ERROR: kernel compression is bad!\n"); + error("\tERROR: kernel compression is bad!\n"); return -1; } if (kernel_header->compress_type == OSSwapBigToHostConstInt32('lzss')) { - verbose ("Decompressing Kernel Using lzss\n"); + verbose ("\t- Decompressing Kernel Using lzss\n"); } if (kernel_header->compress_type == OSSwapBigToHostConstInt32('lzvn')) { - verbose ("Decompressing Kernel Using lzvn\n"); + verbose ("\t- Decompressing Kernel Using lzvn\n"); } #if NOTDEF @@ -998,7 +980,7 @@ return -1; } - DBG("OK.\n"); + DBG("\n"); } ret = ThinFatFile(&binary, &len); Index: trunk/i386/boot2/boot.c =================================================================== --- trunk/i386/boot2/boot.c (revision 2770) +++ trunk/i386/boot2/boot.c (revision 2771) @@ -2,7 +2,7 @@ * Copyright (c) 1999-2003 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ - * + * * Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights * Reserved. This file contains Original Code and/or Modifications of * Original Code as defined in and that are subject to the Apple Public @@ -10,7 +10,7 @@ * except in compliance with the License. Please obtain a copy of the * License at http://www.apple.com/publicsource 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, @@ -18,11 +18,11 @@ * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the * License for the specific language governing rights and limitations * under the License. - * + * * @APPLE_LICENSE_HEADER_END@ */ -/* +/* * Mach Operating System * Copyright (c) 1990 Carnegie-Mellon University * Copyright (c) 1989 Carnegie-Mellon University @@ -31,8 +31,8 @@ * * INTEL CORPORATION PROPRIETARY INFORMATION * - * This software is supplied under the terms of a license agreement or - * nondisclosure agreement with Intel Corporation and may not be copied + * This software is supplied under the terms of a license agreement or + * nondisclosure agreement with Intel Corporation and may not be copied * nor disclosed except in accordance with the terms of that agreement. * * Copyright 1988, 1989 by Intel Corporation @@ -233,7 +233,7 @@ finalizeBootStruct(); // Jump to kernel's entry point. There's no going back now. - if ( TIGER || LEOPARD || SNOW_LEOPARD ) + if ( MacOSVerCurrent < MacOSVer2Int("10.7") ) { // Notify modules that the kernel is about to be started execute_hook("Kernel Start", (void *)kernelEntry, (void *)bootArgsLegacy, NULL, NULL); @@ -264,7 +264,7 @@ char kernelCacheFile[512]; char kernelCachePath[512]; long flags, ret=-1; - unsigned long adler32; + unsigned long adler32 = 0; u_int32_t time, cachetime, kerneltime, exttime; if((gBootMode & kBootModeSafe) != 0) @@ -333,7 +333,6 @@ // Check if the kernel cache file exists ret = -1; - // If boot from a boot helper partition check the kernel cache file on it if (gBootVolume->flags & kBVFlagBooter) { snprintf(kernelCachePath, sizeof(kernelCachePath), "/com.apple.boot.P/%s", kernelCacheFile); @@ -665,7 +664,8 @@ tryresumedefault = false; } - if (!getBoolForKey (kForceWake, &forceresume, &bootInfo->chameleonConfig)) { + if (!getBoolForKey (kForceWake, &forceresume, &bootInfo->chameleonConfig)) + { forceresume = false; } @@ -876,6 +876,9 @@ } + +// ========================================================================= + /*! Selects a new BIOS device, taking care to update the global state appropriately. */ @@ -897,7 +900,8 @@ } */ -bool checkOSVersion(const char * version) +// ========================================================================= +bool checkOSVersion(const char *version) { if ( (sizeof(version) > 4) && ('.' != version[4]) && ('\0' != version[4]) ) { @@ -910,7 +914,6 @@ return ((gMacOSVersion[0] == version[0]) && (gMacOSVersion[1] == version[1]) && (gMacOSVersion[2] == version[2]) && (gMacOSVersion[3] == version[3])); } - } uint32_t getMacOSVerCurrent() @@ -951,6 +954,8 @@ s1 %= BASE; s2 %= BASE; } + result = (s2 << 16) | s1; + return OSSwapHostToBigInt32(result); }