Chameleon

Chameleon Commit Details

Date:2015-09-28 03:25:02 (3 years 8 months ago)
Author:ErmaC
Commit:2769
Parents: 2768
Message:Typo
Changes:
M/branches/ErmaC/Enoch/i386/boot2/options.c
M/branches/ErmaC/Enoch/i386/libsaio/stringTable.c
M/branches/ErmaC/Enoch/i386/libsaio/xml.c
M/branches/ErmaC/Enoch/i386/boot2/drivers.c
M/branches/ErmaC/Enoch/i386/libsaio/vbe.h
M/branches/ErmaC/Enoch/i386/boot2/graphics.c
M/branches/ErmaC/Enoch/i386/boot2/boot.c
M/branches/ErmaC/Enoch/i386/libsaio/bootstruct.c
M/branches/ErmaC/Enoch/i386/libsaio/disk.c
M/branches/ErmaC/Enoch/i386/boot2/boot.h

File differences

branches/ErmaC/Enoch/i386/libsaio/xml.c
241241
242242
243243
244
245244
246245
247246
return key->tag;
}
// XMLGetTag(int index)
// XMLTagCount( TagPtr dict )
branches/ErmaC/Enoch/i386/libsaio/bootstruct.c
126126
127127
128128
129
129
130130
131131
132132
void reserveKernBootStruct(void)
{
if ( TIGER || LEOPARD || SNOW_LEOPARD )
if ( MacOSVerCurrent <= MacOSVer2Int("10.6") )
{
// for 10.4 10.5 10.6
void *oldAddr = bootArgsLegacy;
branches/ErmaC/Enoch/i386/libsaio/vbe.h
211211
212212
213213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
214231
215232
216233
mode1280x1024x555 = 0x119,
mode1280x1024x565 = 0x11A,
mode1280x1024x888 = 0x11B,
mode1600x1200x8 = 0x11C,
mode1600x1200x1555= 0x11D,
mode1600x1200x565 = 0x11E,
mode1600x1200x888 = 0x11F,
mode320X200X8888 = 0x140,
mode640X400X8888 = 0x141,
mode640X480X8888 = 0x142,
mode800X600X8888 = 0x143,
mode1024X768X8888 = 0x144,
mode1280X1024X8888= 0x145,
mode320X200X8 = 0x146,
mode1600X1200X8888= 0x147,
mode1152X864X8 = 0x148,
mode1152X864X1555 = 0x149,
mode1152X864X565 = 0x14A,
mode1152X864X888 = 0x14B,
mode1152X864X8888 = 0x14C,
modeSpecial = 0x81FF,
modeEndOfList = 0xFFFF
};
branches/ErmaC/Enoch/i386/libsaio/disk.c
18771877
18781878
18791879
1880
1880
18811881
18821882
18831883
......
22282228
22292229
22302230
2231
22322231
22332232
22342233
}
}
// Check for SystemVersion.plist or ServerVersion.plist to determine if a volume hosts an installed system.
// Check for SystemVersion.plist or ServerVersion.plist or com.apple.boot.plist to determine if a volume hosts an installed system.
if (bvr->flags & kBVFlagNativeBoot)
{
* The format for the rename string is the following:
* hd(x,y)|uuid|"label" "alias";hd(m,n)|uuid|"label" "alias"; etc...
*/
static bool getVolumeLabelAlias(BVRef bvr, char *str, long strMaxLen)
{
char *aliasList, *entryStart, *entryNext;
branches/ErmaC/Enoch/i386/libsaio/stringTable.c
634634
635635
636636
637
637
638638
639639
640640
* Returns 0 - successful.
* -1 - unsuccesful.
*/
int loadConfigFile(const char *configFile, config_file_t *config)
int loadConfigFile (const char *configFile, config_file_t *config)
{
int fd, count;
branches/ErmaC/Enoch/i386/boot2/graphics.c
364364
365365
366366
367
367
368368
369369
370370
......
378378
379379
380380
381
381
382382
383383
384384
......
434434
435435
436436
437
437
438438
439
439
440440
441441
442
442
443
444
443445
444446
445447
//==========================================================================
// setupPalette
/*
static void setupPalette( VBEPalette *p, const unsigned char *g )
{
int i;
(*p)[i] |= ((unsigned long)((*source++) >> 2)); // Blue
}
}
*/
//==========================================================================
// Simple decompressor for boot images encoded in RLE format.
// Is this required for buggy Video BIOS implementations? If so for which adapter?
if (minfo.BytesPerScanline == 0)
if ( minfo.BytesPerScanline == 0 )
{
minfo.BytesPerScanline = (minfo.XResolution * minfo.BitsPerPixel) >> 3; // ((1920 * 32 = 61440) >> 3) = 7680
minfo.BytesPerScanline = ( minfo.XResolution * minfo.BitsPerPixel ) >> 3;
}
// Update bootArgs with the data provided by the selected VESA mode.
// Update KernBootStruct using info provided by the selected
// VESA mode.
bootArgs->Video.v_display= GRAPHICS_MODE;
bootArgs->Video.v_width= minfo.XResolution;/* 1920 or 1600 */
bootArgs->Video.v_height= minfo.YResolution;/* 1200 or 900 */
branches/ErmaC/Enoch/i386/boot2/drivers.c
167167
168168
169169
170
170
171171
172172
173173
......
250250
251251
252252
253
253
254
255
254256
255
257
258
256259
257260
258261
259
262
263
264
260265
261266
262267
......
279284
280285
281286
282
287
283288
284289
285290
......
310315
311316
312317
313
318
314319
315320
316321
......
434439
435440
436441
437
442
438443
439
440
441
442
444
445
446
447
443448
444449
445450
......
451456
452457
453458
454
459
455460
456461
457462
//==========================================================================
// LoadDrivers
long LoadDrivers( char * dirSpec )
long LoadDrivers( char *dirSpec )
{
char dirSpecExtra[1024];
}
else
{
if ( MAVERICKS || YOSEMITE || ELCAPITAN ) // issue 352
verbose("Attempting to loading drivers from standard repositories:\n");
if ( (gMacOSVersion[3] == '9') || ((gMacOSVersion[3] == '1') && ((gMacOSVersion[4] == '0') || gMacOSVersion[4] == '1' ) )) // issue 352
{
strlcpy(gExtensionsSpec, dirSpec, 4087); /* 4096 - sizeof("Library/") */
verbose("\t- Third party extensions search path: /Library/Extensions\n");
strlcpy(gExtensionsSpec, dirSpec, 4087); /* 4096 - sizeof("Library/") mean 4096 - 9 = 4087 */
strcat(gExtensionsSpec, "Library/");
FileLoadDrivers(gExtensionsSpec, 0);
}
strlcpy(gExtensionsSpec, dirSpec, 4080); /* 4096 - sizeof("System/Library/") */
verbose("\t- Apple extensions search path: /System/Library/Extensions\n");
strlcpy(gExtensionsSpec, dirSpec, 4080); /* 4096 - sizeof("System/Library/") mean 4096 -16 = 4080 */
strcat(gExtensionsSpec, "System/Library/");
FileLoadDrivers(gExtensionsSpec, 0);
}
//==========================================================================
// 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;
//==========================================================================
// 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.
branches/ErmaC/Enoch/i386/boot2/boot.c
233233
234234
235235
236
236
237237
238238
239239
......
278278
279279
280280
281
281
282282
283283
284284
......
289289
290290
291291
292
292
293293
294294
295295
......
312312
313313
314314
315
315
316316
317317
318318
......
321321
322322
323323
324
324
325325
326326
327327
......
329329
330330
331331
332
333332
334333
335334
......
873872
874873
875874
875
876
877
876878
877879
878880
......
894896
895897
896898
897
899
900
898901
899902
900903
......
907910
908911
909912
910
911913
912914
913915
......
916918
917919
918920
921
922
923
919924
920925
921926
......
926931
927932
928933
929
930
934
935
931936
932937
933938
934
935939
936940
937941
938942
939
943
944
940945
941946
942947
943948
944
945
946
947
949
950
951
952
953
954
955
956
957
958
948959
949960
950961
962
951963
964
952965
953966
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);
else
{
// Leopard prelink kernel cache file
if ( TIGER || LEOPARD ) // OSX is 10.4 or 10.5
if ( MacOSVerCurrent >= MacOSVer2Int("10.4") && MacOSVerCurrent <= MacOSVer2Int("10.5") ) // OSX is 10.4 or 10.5
{
// Reset cache name.
bzero(gCacheNameAdler + 64, sizeof(gCacheNameAdler) - 64);
}
// Snow Leopard prelink kernel cache file
else if ( SNOW_LEOPARD )
else if ( MacOSVerCurrent >= MacOSVer2Int("10.6") && MacOSVerCurrent < MacOSVer2Int("10.7") )
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "kernelcache_%s",
(archCpuType == CPU_TYPE_I386) ? "i386" : "x86_64");
prev_time = time;
}
}
verbose("Kernel Cache file path (Mac OS X 10.6): %s\n", kernelCachePath);
verbose("Kernel Cache file path (Mac OS X 10.6): %s\n", kernelCacheFile);
}
closedir(cacheDir);
}
// Lion, Mountain Lion, Mavericks, Yosemite and El Capitan prelink kernel cache file
// for 10.7 10.8 10.9 10.10 10.11
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", kDefaultCachePathSnow);
verbose("Kernel Cache file path (Mac OS X 10.7 and newer): %s\n", kernelCachePath);
verbose("Kernel Cache file path (Mac OS X 10.7 and newer): %s\n", kernelCacheFile);
}
}
// 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);
}
// =========================================================================
/*!
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()
return MacOSVerCurrent;
}
// =========================================================================
unsigned long Adler32(unsigned char *buf, long len)
{
#define BASE 65521L /* largest prime smaller than 65536 */
#define NMAX 5000
// NMAX (was 5521) the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1
#define DO8(buf, i)DO4(buf, i); DO4(buf, i + 4);
#define DO16(buf)DO8(buf, 0); DO8(buf, 8);
unsigned long Adler32(unsigned char *buf, long len)
{
int k;
unsigned long s1 = 1; // adler & 0xffff;
unsigned long s2 = 0; // (adler >> 16) & 0xffff;
unsigned long result;
int k;
while (len > 0) {
k = len < NMAX ? len : NMAX;
len -= k;
while (k >= 16) {
while (k >= 16)
{
DO16(buf);
buf += 16;
k -= 16;
}
if (k != 0) do {
s1 += *buf++;
s2 += s1;
} while (--k);
if (k != 0)
{
do
{
s1 += *buf++;
s2 += s1;
} while (--k);
}
s1 %= BASE;
s2 %= BASE;
}
result = (s2 << 16) | s1;
return OSSwapHostToBigInt32(result);
}
branches/ErmaC/Enoch/i386/boot2/boot.h
6262
6363
6464
65
6566
6667
6768
/*
* Keys used in system Boot.plist
*/
#define kGraphicsModeKey"Graphics Mode"
#define kTextModeKey"Text Mode"
#define kQuietBootKey"Quiet Boot"
branches/ErmaC/Enoch/i386/boot2/options.c
402402
403403
404404
405
405
406
407
406408
407409
408410
......
13851387
13861388
13871389
1388
1390
13891391
1392
13901393
13911394
13921395
putca(' ', 0x07, 40);
}
printf(" %40s\n", item->name);
char Item[40];
strncpy(Item, item->name, sizeof(Item));
printf(" %s\n", Item);
}
//==========================================================================
}
// Ermac : Inject "kext-dev-mode=1" if OS X 10.10 is detected
if ( MacOSVerCurrent == MacOSVer2Int("10.10") ) // OS X is 10.10
if ( (gMacOSVersion[3] == '1') && (gMacOSVersion[4] == '0') ) // OS X is 10.10
{
verbose("Added: kext-dev-mode=1\n");
addBootArg("kext-dev-mode=1");
}

Archive Download the corresponding diff file

Revision: 2769