Chameleon

Chameleon Commit Details

Date:2015-09-30 21:12:50 (4 years 14 days ago)
Author:ErmaC
Commit:2771
Parents: 2770
Message:Corrected bootArgsStruct for Snow Leopard (Credits to Micky1979)
Changes:
M/trunk/i386/boot2/drivers.c
M/trunk/i386/boot2/boot.c
M/trunk/i386/libsaio/bootstruct.c
M/trunk/i386/libsaio/bootstruct.h

File differences

trunk/i386/libsaio/bootstruct.c
126126
127127
128128
129
129
130130
131131
132132
void reserveKernBootStruct(void)
{
if ( TIGER || LEOPARD || SNOW_LEOPARD )
if ( MacOSVerCurrent < MacOSVer2Int("10.7") )
{
// for 10.4 10.5 10.6
void *oldAddr = bootArgsLegacy;
trunk/i386/libsaio/bootstruct.h
3333
3434
3535
36
37
38
36
37
38
3939
4040
4141
/*
* 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
trunk/i386/boot2/drivers.c
119119
120120
121121
122
123
122
124123
125124
126125
......
150149
151150
152151
153
154152
155153
156154
......
169167
170168
171169
172
173
170
174171
175172
176173
......
282279
283280
284281
285
286
282
287283
288284
289285
......
314310
315311
316312
317
318
313
319314
320315
321316
......
396391
397392
398393
399
400394
401395
402
403
396
404397
405398
406399
......
441434
442435
443436
444
445
437
446438
447
448
449
450
439
440
441
442
451443
452444
453445
......
459451
460452
461453
462
454
463455
464456
465457
......
488480
489481
490482
491
492
493
483
494484
495485
496486
......
643633
644634
645635
646
647636
648637
649
650
651
638
652639
653640
654641
......
743730
744731
745732
746
747
748
733
749734
750735
751736
......
753738
754739
755740
756
757741
758742
759743
......
808792
809793
810794
811
812795
813796
814797
......
838821
839822
840823
841
842824
843825
844826
......
875857
876858
877859
878
860
879861
880862
881863
......
913895
914896
915897
916
898
917899
918900
919901
......
926908
927909
928910
929
911
930912
931913
932914
933915
934
916
935917
936918
937919
938920
939921
940
922
941923
942924
943925
944926
945
927
946928
947929
948930
......
998980
999981
1000982
1001
983
1002984
1003985
1004986
// 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;
//==========================================================================
// InitDriverSupport
static long InitDriverSupport( void )
{
gExtensionsSpec = malloc( 4096 );
//==========================================================================
// LoadDrivers
long LoadDrivers( char * dirSpec )
long LoadDrivers( char *dirSpec )
{
char dirSpecExtra[1024];
//==========================================================================
// FileLoadMKext
static long FileLoadMKext( const char * dirSpec, const char * extDirSpec )
static long FileLoadMKext( const char *dirSpec, const char *extDirSpec )
{
longret, flags;
u_int32_ttime, time2;
//==========================================================================
// FileLoadDrivers
long FileLoadDrivers( char * dirSpec, long plugin )
long FileLoadDrivers( char *dirSpec, long plugin )
{
long longindex;
longret, length, flags, bundleType;
return result;
}
//==========================================================================
//
long NetLoadDrivers( char * dirSpec )
long NetLoadDrivers( char *dirSpec )
{
long tries;
//==========================================================================
// loadDriverMKext
long LoadDriverMKext( char * fileSpec )
long LoadDriverMKext( char *fileSpec )
{
unsigned long driversAddr, driversLength;
long length;
char segName[32];
DriversPackage * package;
unsigned longdriversAddr, driversLength;
longlength;
charsegName[32];
DriversPackage*package;
#define GetPackageElement(e) OSSwapBigToHostInt32(package->e)
}
// 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.
//==========================================================================
// LoadDriverPList
long
LoadDriverPList( char * dirSpec, char * name, long bundleType )
long LoadDriverPList( char *dirSpec, char *name, long bundleType )
{
long length, executablePathLength, bundlePathLength;
ModulePtr module;
return ret;
}
//==========================================================================
// LoadMatchedModules
long
LoadMatchedModules( void )
long LoadMatchedModules( void )
{
TagPtr prop;
ModulePtr module;
//==========================================================================
// MatchPersonalities
static long
MatchPersonalities( void )
static long MatchPersonalities( void )
{
/* IONameMatch support not implemented */
return 0;
//==========================================================================
// MatchLibraries
static long MatchLibraries( void )
{
TagPtr prop;
return 0;
}
//==========================================================================
// FindModule
//==========================================================================
// ParseXML
static long ParseXML( char *buffer, ModulePtr *module, TagPtr *personalities )
{
longlength;
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;
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);
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
return -1;
}
DBG("OK.\n");
DBG("\n");
}
ret = ThinFatFile(&binary, &len);
trunk/i386/boot2/boot.c
22
33
44
5
5
66
77
88
......
1010
1111
1212
13
13
1414
1515
1616
......
1818
1919
2020
21
21
2222
2323
2424
25
25
2626
2727
2828
......
3131
3232
3333
34
35
34
35
3636
3737
3838
......
233233
234234
235235
236
236
237237
238238
239239
......
264264
265265
266266
267
267
268268
269269
270270
......
333333
334334
335335
336
337336
338337
339338
......
665664
666665
667666
668
667
668
669669
670670
671671
......
876876
877877
878878
879
880
881
879882
880883
881884
......
897900
898901
899902
900
903
904
901905
902906
903907
......
910914
911915
912916
913
914917
915918
916919
......
951954
952955
953956
957
954958
959
955960
956961
* 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
* 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,
* 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
*
* 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
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);
charkernelCacheFile[512];
charkernelCachePath[512];
longflags, ret=-1;
unsigned long adler32;
unsigned longadler32 = 0;
u_int32_t time, cachetime, kerneltime, exttime;
if((gBootMode & kBootModeSafe) != 0)
// 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);
tryresumedefault = false;
}
if (!getBoolForKey (kForceWake, &forceresume, &bootInfo->chameleonConfig)) {
if (!getBoolForKey (kForceWake, &forceresume, &bootInfo->chameleonConfig))
{
forceresume = false;
}
}
// =========================================================================
/*!
Selects a new BIOS device, taking care to update the global state appropriately.
*/
}
*/
bool checkOSVersion(const char * version)
// =========================================================================
bool checkOSVersion(const char *version)
{
if ( (sizeof(version) > 4) && ('.' != version[4]) && ('\0' != version[4]) )
{
return ((gMacOSVersion[0] == version[0]) && (gMacOSVersion[1] == version[1])
&& (gMacOSVersion[2] == version[2]) && (gMacOSVersion[3] == version[3]));
}
}
uint32_t getMacOSVerCurrent()
s1 %= BASE;
s2 %= BASE;
}
result = (s2 << 16) | s1;
return OSSwapHostToBigInt32(result);
}

Archive Download the corresponding diff file

Revision: 2771