Chameleon

Chameleon Commit Details

Date:2017-03-08 18:16:15 (7 years 1 month ago)
Author:zenith432
Commit:2848
Parents: 2847
Message:Sync with trunk (r.2847)
Changes:
C/trunk/artwork/themes/default/device_hfsraid_sie.png → /branches/zenith432/artwork/themes/default/device_hfsraid_sie.png
C/trunk/artwork/themes/default/device_hfsfusion_sie_o.png → /branches/zenith432/artwork/themes/default/device_hfsfusion_sie_o.png
C/trunk/artwork/themes/default/device_hfsplus_sie.png → /branches/zenith432/artwork/themes/default/device_hfsplus_sie.png
C/trunk/artwork/themes/default/device_hfsraid_sie_o.png → /branches/zenith432/artwork/themes/default/device_hfsraid_sie_o.png
C/trunk/artwork/themes/default/device_hfsplus_sie_o.png → /branches/zenith432/artwork/themes/default/device_hfsplus_sie_o.png
C/trunk/artwork/themes/default/device_hfsfusion_sie.png → /branches/zenith432/artwork/themes/default/device_hfsfusion_sie.png
M/branches/zenith432/i386/libsaio/cpu.c
M/branches/zenith432/i386/boot2/gui.c
M/branches/zenith432/i386/libsaio/fake_efi.c
M/branches/zenith432/i386/libsaio/platform.h
M/branches/zenith432/i386/libsaio/smbios_getters.c
M/branches/zenith432/i386/libsaio/disk.c
M/branches/zenith432/i386/libsaio/hda.c
M/branches/zenith432/i386/boot2/options.c
M/branches/zenith432/i386/libsaio/hda.h
M/branches/zenith432
M/branches/zenith432/i386/boot2/boot.c
M/branches/zenith432/i386/libsa/libsa.h
M/branches/zenith432/i386/libsaio/bootstruct.c
M/branches/zenith432/i386/libsaio/nvidia.c
M/branches/zenith432/i386/boot2/boot.h
M/branches/zenith432/i386/libsaio/ati.c
M/branches/zenith432/i386/libsa/string.c
M/branches/zenith432/i386/libsaio/stringTable.c
M/branches/zenith432/i386/util/boot1-install/Makefile
M/branches/zenith432/i386/boot2/drivers.c
M/branches/zenith432/i386/libsaio/ati.h
M/branches/zenith432/i386/libsaio/acpi_patcher.c
M/branches/zenith432/i386/libsaio/saio_types.h

File differences

branches/zenith432/i386/libsaio/bootstruct.c
155155
156156
157157
158
159
158
159
160160
161161
162162
......
257257
258258
259259
260
260
261261
262
263
264
265
262266
263267
264268
/* Memory size to use for defaults calculations (cparm) */
uint64_tsane_size = 0;
EfiMemoryRange *memoryMap= NULL;
MemoryRange *range= NULL;
EfiMemoryRange*memoryMap= NULL;
MemoryRange*range= NULL;
int memoryMapCount = bootInfo->memoryMapCount;
if (memoryMapCount == 0)
* For user visible memory size, round up to 128 Mb - accounting for the various stolen memory
* not reported by EFI. (cparm)
*/
#if DEBUG_BOOTSTRUCT
sane_size = (sane_size + 128 * MEG - 1) & ~((uint64_t)(128 * MEG - 1));
DBG( "Total amount of physical RAM in the system : %d\n", ((sane_size + 128 * MEG - 1) & ~((uint64_t)(128 * MEG - 1))) );
#else
DBG( "Total amount of RAM in the system : %d\n", sane_size );
#endif
bootArgs->PhysicalMemorySize = sane_size;
}
branches/zenith432/i386/libsaio/acpi_patcher.c
1616
1717
1818
19
20
19
20
2121
2222
2323
......
467467
468468
469469
470
471
472
473
474
475
476
477
470478
471479
472480
......
592600
593601
594602
603
604
605
606
607
608
609
610
595611
596612
597613
#include "state_generator.h"
#ifndef DEBUG_ACPI
#define DEBUG_ACPI 0
#endif
#define DEBUG_ACPI 0
#endif
#if DEBUG_ACPI==2
#define DBG(x...) {printf(x); sleep(1);}
rsdt_entries[i-dropoffset]=rsdt_entries[i];
// Dropping DMAR (DMA Remapping table) table can fix stuck on "waitForSystemMapper" or "PCI configuration begin" if nothing wokrks except rolling old AppleACPIplatform.kext back. Needs testing with current OEM AppleACPIplatform.kext not with old rolled back one
if (tableSign(table, "DMAR"))
{
DBG("\tOEM DMAR table was dropped\n");
dropoffset++;
continue;
}
if (drop_ssdt && tableSign(table, "SSDT"))
{
DBG("\tOEM SSDT tables was dropped\n");
}
xsdt_entries[i - dropoffset] = xsdt_entries[i];
// Dropping DMAR (DMA Remapping table) table can fix stuck on "waitForSystemMapper" or "PCI configuration begin" if nothing wokrks except rolling old AppleACPIplatform.kext back. Needs testing with current OEM AppleACPIplatform.kext not with old rolled back one
if (tableSign(table, "DMAR"))
{
DBG("\tOEM DMAR table was dropped\n");
dropoffset++;
continue;
}
if (drop_ssdt && tableSign(table, "SSDT"))
{
DBG("\tOEM SSDT tables was dropped\n");
branches/zenith432/i386/libsaio/hda.c
184184
185185
186186
187
188
187189
188190
189191
......
274276
275277
276278
279
277280
278281
279282
......
297300
298301
299302
303
300304
301305
302306
......
329333
330334
331335
332
336
333337
338
334339
335340
336341
......
623628
624629
625630
626
631
627632
628633
629634
630635
631636
632
637
633638
634639
635640
......
654659
655660
656661
657
662
658663
659664
660665
{ HDA_NVIDIA_GK106,"GK106" /*, 0, ? */ },
{ HDA_NVIDIA_GK107,"GK107" /*, 0, ? */ },
{ HDA_NVIDIA_GK104,"GK104" /*, 0, ? */ },
{ HDA_NVIDIA_GP104_2,"Pascal GP104-200" /*, 0, ? */ },
{ HDA_NVIDIA_GM204_2,"Maxwell GP204-200" /*, 0, ? */ },
//1002 Advanced Micro Devices [AMD] nee ATI Technologies Inc
{ HDA_ATI_SB450,"SB4x0" /*, 0, 0 */ },
{ HDA_CODEC_ALC221, 0, "ALC221" },
{ HDA_CODEC_ALC231, 0, "ALC231" },
{ HDA_CODEC_ALC233, 0, "ALC233" },
{ HDA_CODEC_ALC233, 0x0003,"ALC3236" },
{ HDA_CODEC_ALC235, 0, "ALC235" },
{ HDA_CODEC_ALC255, 0, "ALC255" },
{ HDA_CODEC_ALC256, 0, "ALC256" },
{ HDA_CODEC_ALC288, 0, "ALC288" },
{ HDA_CODEC_ALC290, 0, "ALC290" },
{ HDA_CODEC_ALC292, 0, "ALC292" },
{ HDA_CODEC_ALC292, 0x0001, "ALC3232" },
{ HDA_CODEC_ALC293, 0, "ALC293" },
{ HDA_CODEC_ALC298, 0, "ALC298" },
{ HDA_CODEC_ALC660, 0, "ALC660-VD" },
{ HDA_CODEC_ALC889, 0, "ALC889" },
{ HDA_CODEC_ALC892, 0, "ALC892" },
{ HDA_CODEC_ALC898, 0, "ALC898" },
{ HDA_CODEC_ALC899, 0,"ALC899" },
//{ HDA_CODEC_ALC899, 0,"ALC899" },
{ HDA_CODEC_ALC900, 0, "ALC1150" },
{ HDA_CODEC_ALC1220, 0, "ALC1220" },
{ HDA_CODEC_AD1882, 0, "AD1882" },
{ HDA_CODEC_AD1882A, 0, "AD1882A" },
name_format = "ATI %s HDA Controller (HDMi)"; break;
case INTEL_VENDORID:
name_format = "Intel %s High Definition Audio Controller"; break;
name_format = "Intel %s HDA Controller"; break;
case NVIDIA_VENDORID:
name_format = "nVidia %s HDA Controller (HDMi)"; break;
case RDC_VENDORID:
name_format = "RDC %s High Definition Audio Controller"; break;
name_format = "RDC %s HDA Controller"; break;
case SIS_VENDORID:
name_format = "SiS %s HDA Controller"; break;
}
/* Not in table */
snprintf(desc, sizeof(desc), "Unknown HD Audio device, vendor %04x, model %04x",
snprintf(desc, sizeof(desc), "Unknown HDA device, vendor %04x, model %04x",
controller_vendor_id, controller_device_id);
return desc;
}
branches/zenith432/i386/libsaio/hda.h
171171
172172
173173
174
175
174176
175177
176178
......
450452
451453
452454
453
454
455
456
457
455458
459
456460
457461
458462
#define HDA_NVIDIA_GK106HDA_MODEL_CONSTRUCT(NVIDIA, 0x0e0b)
#define HDA_NVIDIA_GK110HDA_MODEL_CONSTRUCT(NVIDIA, 0x0e1a)
#define HDA_NVIDIA_GK107HDA_MODEL_CONSTRUCT(NVIDIA, 0x0e1b) // HDACodec de104200 (10de0042)
#define HDA_NVIDIA_GP104_2 HDA_MODEL_CONSTRUCT(NVIDIA, 0x10f0) // GeForce GTX 1070
#define HDA_NVIDIA_GM204_2 HDA_MODEL_CONSTRUCT(NVIDIA, 0x0fbb) // GeForce GTX 970
#define HDA_NVIDIA_ALLHDA_MODEL_CONSTRUCT(NVIDIA, 0xffff)
/* ATI */
#define HDA_CODEC_ALC888 HDA_CODEC_CONSTRUCT(REALTEK, 0x0888)
#define HDA_CODEC_ALC889 HDA_CODEC_CONSTRUCT(REALTEK, 0x0889)
#define HDA_CODEC_ALC892 HDA_CODEC_CONSTRUCT(REALTEK, 0x0892)
#define HDA_CODEC_ALC898 HDA_CODEC_CONSTRUCT(REALTEK, 0x0898)
#define HDA_CODEC_ALC899 HDA_CODEC_CONSTRUCT(REALTEK, 0x0899)
#define HDA_CODEC_ALC898 HDA_CODEC_CONSTRUCT(REALTEK, 0x0899)
//#define HDA_CODEC_ALC898 HDA_CODEC_CONSTRUCT(REALTEK, 0x0898)
//#define HDA_CODEC_ALC899 HDA_CODEC_CONSTRUCT(REALTEK, 0x0899)
#define HDA_CODEC_ALC900 HDA_CODEC_CONSTRUCT(REALTEK, 0x0900)
#define HDA_CODEC_ALC1220 HDA_CODEC_CONSTRUCT(REALTEK, 0x1220)
#define HDA_CODEC_ALCXXXX HDA_CODEC_CONSTRUCT(REALTEK, 0xffff)
/* Motorola */
branches/zenith432/i386/libsaio/nvidia.c
821821
822822
823823
824
824
825825
826826
827827
......
847847
848848
849849
850
850
851851
852852
853853
......
911911
912912
913913
914
914
915915
916916
917917
......
943943
944944
945945
946
946
947947
948948
949949
......
12941294
12951295
12961296
1297
12971298
12981299
12991300
......
13191320
13201321
13211322
1323
1324
1325
1326
1327
1328
1329
13221330
13231331
13241332
......
13311339
13321340
13331341
1342
1343
13341344
13351345
13361346
1337
1347
1348
1349
1350
1351
13381352
13391353
13401354
......
13491363
13501364
13511365
1352
1353
1366
1367
1368
1369
1370
1371
1372
1373
1374
13541375
1355
1376
1377
1378
1379
1380
1381
13561382
13571383
13581384
13591385
13601386
13611387
1388
1389
1390
13621391
13631392
1393
13641394
13651395
13661396
......
13761406
13771407
13781408
1379
1409
13801410
13811411
1382
1412
13831413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
13841444
13851445
13861446
{ 0x10DE0A2A,"GeForce GT 230M" },
{ 0x10DE0A2B,"GeForce GT 330M" },
{ 0x10DE0A2C,"NVS 5100M" },
{ 0x10DE0A2D,"GeForce GT 320M" },
{ 0x10DE0A2D,"GeForce GT 320M" },
// 0A30 - 0A3F
{ 0x10DE0A30,"GeForce GT 330M" },
{ 0x10DE0A32,"GeForce GT 415" },
{ 0x10DE0A6A,"NVS 2100M" },
{ 0x10DE0A6C,"NVS 3100M" },
{ 0x10DE0A6E,"GeForce 305M" },
{ 0x10DE0A6F,"ION" },
{ 0x10DE0A6F,"ION" },
// 0A70 - 0A7F
{ 0x10DE0A70,"GeForce 310M" },
{ 0x10DE0A71,"GeForce 305M" },
{ 0x10DE0CAD,"N10E-ES" }, // SUBIDS
{ 0x10DE0CAE,"GT215-INT" },
{ 0x10DE0CAF,"GeForce GT 335M" },
// 0CB0 - 0CBF
// 0CB0 - 0CBF
{ 0x10DE0CB0,"GeForce GTS 350M" },
{ 0x10DE0CB1,"GeForce GTS 360M" },
{ 0x10DE0CBC,"Quadro FX 1800M" },
{ 0x10DE0DCD,"GeForce GT 555M" },
{ 0x10DE0DCE,"GeForce GT 555M" },
// { 0x10DE0DCF,"N12P-GT-B" },
// 0DD0 - 0DDF
// 0DD0 - 0DDF
{ 0x10DE0DD0,"N11E-GT" },
{ 0x10DE0DD1,"GeForce GTX 460M" },
{ 0x10DE0DD2,"GeForce GT 445M" },
{ 0x10DE1286,"GeForce GT 720" },
{ 0x10DE1287,"GeForce GT 730" }, // GK208
{ 0x10DE1288,"GeForce GT 720" }, // GK208
{ 0x10DE128b,"GeForce GT 710" },
// 1290 - 129F
{ 0x10DE1290,"GeForce GT 730M" },
{ 0x10DE1291,"GeForce GT 735M" },
{ 0x10DE1341,"GeForce 840M" },
{ 0x10DE1346,"GeForce 930M" }, // GM108M
{ 0x10DE1347,"GeForce 940M" }, // GM108M
{ 0x10DE1348,"GeForce 945M/945A" }, // GM108M
{ 0x10DE1349,"GeForce 930M" }, // GM108M
{ 0x10DE134D,"GeForce 940MX" }, // GM108M
{ 0x10DE134E,"GeForce 930MX" }, // GM108M
{ 0x10DE134F,"GeForce 920MX" }, // GM108M
{ 0x10DE137A,"Quadro K620M/M500M" }, // GM108GLM
{ 0x10DE137D,"GeForce 940A" }, // GM108M
{ 0x10DE1380,"GeForce GTX 750 Ti" },
{ 0x10DE1381,"GeForce GTX 750" },
{ 0x10DE1382,"GeForce GTX 745" },
{ 0x10DE1398,"GeForce 845M" }, //
{ 0x10DE139A,"GeForce GTX 950M" }, // GM107
{ 0x10DE139B,"GeForce GTX 960M" }, // GM107
{ 0x10DE139C,"GeForce 940M" }, // GM107M
{ 0x10DE139D,"GeForce GTX 750 Ti" }, // GM107M
{ 0x10DE13AD,"GM107 INT52" }, //
{ 0x10DE13AE,"GM107 CS1" }, //
//{ 0x10DE13AF,"Graphics Device" }, // GM107GLM
{ 0x10DE13B3,"Quadro K2200M" }, //
{ 0x10DE13B0,"GQuadro M2000M" }, // GM107GLM
{ 0x10DE13B1,"Quadro M1000M" }, // GM107GLM
{ 0x10DE13B2,"Quadro M600M" }, // GM107GLM
{ 0x10DE13B3,"Quadro K2200M" }, // GM107GLM
{ 0x10DE13B9,"NVS 810" }, // GM107GL
{ 0x10DE13BA,"Quadro K2200" },
{ 0x10DE13BB,"Quadro K620" },
{ 0x10DE13BC,"Quadro K1200" },
{ 0x10DE13D7,"GeForce GTX 980M" }, //
{ 0x10DE13D8,"GeForce GTX 970M" }, //
{ 0x10DE13D9,"GeForce GTX 965M" },
//{ 0x10DE13F0,"Graphics Device" }, // GM107GLM
//{ 0x10DE13F1,"Graphics Device" }, // GM107GLM
{ 0x10DE13DA,"GeForce GTX 980" }, // GM204M
{ 0x10DE13F0,"Quadro M5000" }, // GM204GL
{ 0x10DE13F1,"Quadro M4000" }, // GM204GL
{ 0x10DE13F2,"Tesla M60" }, // GM204GL
{ 0x10DE13F3,"Tesla M6" }, // GM204GL
{ 0x10DE13F8,"Quadro M5000M" }, // GM204GLM
{ 0x10DE13F9,"Quadro M4000M" }, // GM204GLM
{ 0x10DE13FA,"Quadro M3000M" }, // GM204GLM
{ 0x10DE13FB,"Quadro M5500" }, // GM204GLM
{ 0x10DE1401,"GeForce GTX 960" }, //
//{ 0x10DE1402,"Graphics Device" }, //
{ 0x10DE1402,"GeForce GTX 950" }, //
{ 0x10DE1406,"GeForce GTX 960" }, // GM206
{ 0x10DE1407,"GeForce GTX 750 v2" }, // GM206
{ 0x10DE1427,"GeForce GTX 965M" }, // GM206M
{ 0x10DE1430,"Quadro M2000" }, //
{ 0x10DE1431,"Tesla M4" }, // GM206GL
//{ 0x10DE143F,"Graphics Device" }, //
//{ 0x10DE1600,"Graphics Device" }, //
//{ 0x10DE1601,"Graphics Device" }, //
//{ 0x10DE1602,"Graphics Device" }, //
//{ 0x10DE1603,"Graphics Device" }, //
{ 0x10DE1617,"GeForce GTX 980M" }, //
{ 0x10DE1618,"GeForce GTX 970M" }, // GM204M
{ 0x10DE1619,"GeForce GTX 965M" }, // GM204M
{ 0x10DE161A,"GeForce GTX 980" }, // GM204M
//{ 0x10DE1630,"Graphics Device" }, //
//{ 0x10DE1631,"Graphics Device" }, //
{ 0x10DE1667,"GeForce GTX 965M" }, // GM204M
//{ 0x10DE1780,"Graphics Device" }, //
//{ 0x10DE1781,"Graphics Device" }, //
//{ 0x10DE1782,"Graphics Device" }, //
{ 0x10DE17BE,"GM107 CS1" }, // GM107
//{ 0x10DE17C1,"Graphics Device" }, //
{ 0x10DE17C2,"GeForce GTX Titan X" }, //
{ 0x10DE17C8,"GeForce GTX 980 TI" },
{ 0x10DE17C8,"GeForce GTX 980 TI" }, //
//{ 0x10DE17EE,"Graphics Device" }, //
//{ 0x10DE17EF,"Graphics Device" }, //
{ 0x10DE17F0,"Quadro M6000" }
{ 0x10DE17F0,"Quadro M6000" },
//{ 0x10DE17FF,"Graphics Device" }, //
{ 0x10DE17F1,"Quadro M6000" }, // GM200GL
{ 0x10DE17FD,"Tesla M40" }, // GM200GL
// 1B00 - 1CFFF
{ 0x10DE1B00, "Titan X Pascal"}, // GP102
//{ 0x10DE1B01,"Graphics Device" }, // GP102
{ 0x10DE1B30,"Quadro P6000" }, // GP102GL
//{ 0x10DE1B70,"Graphics Device" }, // GP102GL
//{ 0x10DE1B78,"Graphics Device" }, // GP102GL
{ 0x10DE1B80, "GeForce GTX 1080"}, // GP104
{ 0x10DE1B81, "GeForce GTX 1070"}, // GP104
//{ 0x10DE1B82,"Graphics Device" }, // GP104
//{ 0x10DE1B83,"Graphics Device" }, // GP104
{ 0x10DE1BA0,"GeForce GTX 1080" }, // GP104M
{ 0x10DE1BA1,"GeForce GTX 1070" }, // GP104M
{ 0x10DE1BB0,"Quadro P5000" }, // GP104GL
//{ 0x10DE1BB1,"Graphics Device" }, // GP104GL
//{ 0x10DE1BB4,"Graphics Device" }, // GP104GL
{ 0x10DE1BE0,"GeForce GTX 1080" }, //GP104M
{ 0x10DE1BE1,"GeForce GTX 1070" }, //GP104M
//{ 0x10DE1C00,"Graphics Device" }, // GP106
//{ 0x10DE1C01,"Graphics Device" }, // GP106
{ 0x10DE1C02, "GeForce GTX 1060"}, // GP106
{ 0x10DE1C03, "GeForce GTX 1060"}, // GP106
{ 0x10DE1c20,"GeForce GTX 1060" }, //GP106M
//{ 0x10DE1C30,"Graphics Device" }, // GP106GL
{ 0x10DE1C60,"GeForce GTX 1060" }, // GP106M
//{ 0x10DE1C70,"Graphics Device" }, // GP106GL
//{ 0x10DE1C80,"Graphics Device" }, // GP107
//{ 0x10DE1C81,"Graphics Device" }, // GP107
{ 0x10DE1C82,"GeForce GTX 1050 Ti"}, // GP107
};
static nvidia_card_info_t nvidia_card_exceptions[] = {
branches/zenith432/i386/libsaio/ati.c
6363
6464
6565
66
66
6767
6868
69
69
7070
7171
7272
......
8484
8585
8686
87
88
8789
8890
8991
......
9395
9496
9597
96
98
9799
98100
99101
......
105107
106108
107109
108
110
111
112
113
114
109115
110116
111
117
118
119
120
121
122
123
124
125
112126
113127
114128
......
12091223
12101224
12111225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
12121249
12131250
12141251
......
13091346
13101347
13111348
1312
1349
13131350
13141351
13151352
......
13221359
13231360
13241361
1325
1326
1362
1363
13271364
13281365
13291366
......
17671804
17681805
17691806
1807
17701808
17711809
17721810
......
17881826
17891827
17901828
1791
1829
17921830
17931831
1832
1833
1834
1835
1836
17941837
17951838
17961839
......
21602203
21612204
21622205
2163
2206
21642207
21652208
21662209
{"Galago",2},
{"Colobus",2},
{"Mangabey",2},
{"Nomascus",4}, // 5
{"Nomascus",5},
{"Orangutan",2},
/* AMD6000Controller */
{"Pithecia",2}, // 3
{"Pithecia",3},
{"Bulrushes",6},
{"Cattail",4},
{"Hydrilla",5},
{"Spikerush", 4},
{"Typha", 5},
/* AMD7000Controller */
{"Ramen",6},
{"Tako",6},
{"Namako",4},
{"Aji",4},
{"Buri",4},
{"Gari",5},
{"Futomaki",5},
{"Hamachi",4},
{"OPM", 6},
{"OPM", 5},
{"Ikura",1},
{"IkuraS",6},
{"Junsai",6},
/* AMD8000Controller */
{"Baladi", 6},
/* AMD9000Controller */
{"Exmoor",4},
{"Exmoor",6},
{"MalteseS",1},
{"Lagotto",4},
{"GreyhoundS",1},
{"Maltese",6},
{"Basset",4},
{"Greyhound",6},
{"Labrador",6}
{"Labrador",6},
/* AMD9500Controller */
{"Elqui",5},
{"Acre",3},
{"Berbice",5},
{"Caroni",5},
{"Florin",6},
{"Dayman",6},
{"Guariba",6}
};
static radeon_card_info_t radeon_cards[] = {
//{ 0x67BA,0x00000000, CHIP_FAMILY_HAWAII,"AMD Radeon", kFutomaki},
//{ 0x67BE,0x00000000, CHIP_FAMILY_HAWAII,"AMD Radeon", kFutomaki},
// Polaris 10
{ 0x67C0, 0x00000000, CHIP_FAMILY_ELLESMERE, "AMD Radeon Polaris 10", kNull },
{ 0x67C1, 0x00000000, CHIP_FAMILY_ELLESMERE, "AMD Radeon Polaris 10", kNull },
{ 0x67C2, 0x00000000, CHIP_FAMILY_ELLESMERE, "AMD Radeon Polaris 10", kNull },
{ 0x67C4, 0x00000000, CHIP_FAMILY_ELLESMERE, "AMD Radeon Polaris 10", kNull },
{ 0x67C7, 0x00000000, CHIP_FAMILY_ELLESMERE, "AMD Radeon Polaris 10", kNull },
{ 0x67C8, 0x00000000, CHIP_FAMILY_ELLESMERE, "AMD Radeon Polaris 10", kNull },
{ 0x67C9, 0x00000000, CHIP_FAMILY_ELLESMERE, "AMD Radeon Polaris 10", kNull },
{ 0x67CA, 0x00000000, CHIP_FAMILY_ELLESMERE, "AMD Radeon Polaris 10", kNull },
{ 0x67CC, 0x00000000, CHIP_FAMILY_ELLESMERE, "AMD Radeon Polaris 10", kNull },
{ 0x67CF, 0x00000000, CHIP_FAMILY_ELLESMERE, "AMD Radeon Polaris 10", kNull },
{ 0x67DF, 0x00000000, CHIP_FAMILY_ELLESMERE, "AMD Radeon RX480", kDayman },
// Polaris 11
{ 0x67E0, 0x00000000, CHIP_FAMILY_BAFFIN, "AMD Radeon RX460", kAcre },
{ 0x67E1, 0x00000000, CHIP_FAMILY_BAFFIN, "AMD Radeon Polaris 11", kNull },
{ 0x67E3, 0x00000000, CHIP_FAMILY_BAFFIN, "AMD Radeon Polaris 11", kNull },
{ 0x67E7, 0x00000000, CHIP_FAMILY_BAFFIN, "AMD Radeon Polaris 11", kNull },
{ 0x67E8, 0x00000000, CHIP_FAMILY_BAFFIN, "AMD Radeon Polaris 11", kNull },
{ 0x67E9, 0x00000000, CHIP_FAMILY_BAFFIN, "AMD Radeon Polaris 11", kNull },
{ 0x67EB, 0x00000000, CHIP_FAMILY_BAFFIN, "AMD Radeon Polaris 11", kNull },
{ 0x67EF, 0x00000000, CHIP_FAMILY_BAFFIN, "AMD Radeon RX460", kAcre },
{ 0x67FF, 0x00000000, CHIP_FAMILY_BAFFIN, "AMD Radeon Polaris 11", kNull },
// PITCAIRN
{ 0x6800,0x00000000, CHIP_FAMILY_PITCAIRN,"AMD Radeon HD 7970M",kBuri}, // Mobile
{ 0x6801,0x00000000, CHIP_FAMILY_PITCAIRN,"AMD Radeon HD 8970M Series",kFutomaki}, // Mobile
// CEDAR
{ 0x68E0,0x00000000, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5470 Series",kGalago},
{ 0x68E1,0x00000000, CHIP_FAMILY_CEDAR,"AMD Radeon HD 6230",kGalago},
{ 0x68E1,0x00000000, CHIP_FAMILY_CEDAR,"AMD Radeon HD 6230/6350/8350",kGalago},
{ 0x68E4,0x00000000, CHIP_FAMILY_CEDAR,"ATI Radeon HD 6370M Series",kGalago},
{ 0x68E5,0x00000000, CHIP_FAMILY_CEDAR,"ATI Radeon HD 6300M Series",kGalago},
//{ 0x68E8,0x00000000, CHIP_FAMILY_CEDAR,"ATI Radeon HD ??? Series",kNull},
//{ 0x68FE,0x00000000, CHIP_FAMILY_CEDAR,"ATI Radeon HD ??? Series",kNull},
//
{ 0x6900,0x00000000, CHIP_FAMILY_TOPAS,"ATI Radeon R7 M260/M265", kExmoor},
{ 0x6901,0x00000000, CHIP_FAMILY_TOPAS,"ATI Radeon R5 M255", kExmoor},
{ 0x6900,0x00000000, CHIP_FAMILY_TOPAZ,"ATI Radeon R7 M260/M265", kExmoor},
{ 0x6901,0x00000000, CHIP_FAMILY_TOPAZ,"ATI Radeon R5 M255", kExmoor},
{ 0x6920,0x00000000, CHIP_FAMILY_AMETHYST,"ATI Radeon R9 M395X", kLabrador},
{ 0x6921,0x00000000, CHIP_FAMILY_AMETHYST,"ATI Radeon R9 M295X", kExmoor},
{ 0x692B,0x00000000, CHIP_FAMILY_TONGA,"ATI Firepro W7100", kBaladi},
"Hemlock",
"Juniper",
"Redwood",
// "Broadway",
/* Northern Islands */
"Barts",
"Caicos",
"Hawaii",
/* ... */
"Mullins",
"Topas",
"Topaz",
"Amethyst",
"Tonga",
"Fiji",
"Carrizo",
"Tobago",
"Ellesmere",
"Baffin",
""
};
void get_vram_size(void)
{
ati_chip_family_t chip_family = card->info->chip_family;
card->vram_size = 0;
if (chip_family >= CHIP_FAMILY_CEDAR)
branches/zenith432/i386/libsaio/ati.h
9999
100100
101101
102
102
103103
104104
105
106
107
108
109
105110
106111
107112
......
172177
173178
174179
180
181
175182
176183
177184
......
194201
195202
196203
204
205
206
207
197208
198209
199210
211
212
213
214
215
216
217
218
200219
201220
202221
CHIP_FAMILY_HAWAII,
/* ... */
CHIP_FAMILY_MULLINS,
CHIP_FAMILY_TOPAS,
CHIP_FAMILY_TOPAZ,
CHIP_FAMILY_AMETHYST,
CHIP_FAMILY_TONGA,
CHIP_FAMILY_FIJI,
CHIP_FAMILY_CARRIZO,
CHIP_FAMILY_TOBAGO,
CHIP_FAMILY_ELLESMERE, /* Polaris 10 */
CHIP_FAMILY_BAFFIN, /* Polaris 11 */
CHIP_FAMILY_LAST
} ati_chip_family_t;
kSpikerush,
kTypha,
/* AMD7000Controller */
kRamen,
kTako,
kNamako,
kAji,
kBuri,
kBaladi,
/* AMD9000Controller */
kExmoor,
kMalteseS,
kLagotto,
kGreyhoundS,
kMaltese,
kBasset,
kGreyhound,
kLabrador,
/* AMD9500Controller */
kElqui,
kAcre,
kBerbice,
kCaroni,
kFlorin,
kDayman,
kGuariba,
kCfgEnd
} config_name_t;
branches/zenith432/i386/libsaio/cpu.c
2020
2121
2222
23
2423
2524
2625
......
590589
591590
592591
592
593593
594594
595595
596
597596
598597
599598
599
600
601
600602
603
604
605
606
607
601608
602
609
610
603611
604612
605613
......
613621
614622
615623
624
625
626
616627
617628
618629
......
622633
623634
624635
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640636
641637
642638
......
662658
663659
664660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
665675
666676
667677
#define DBG(x...)
#endif
#define UI_CPUFREQ_ROUNDING_FACTOR10000000
clock_frequency_info_t gPEClockFrequencyInfo;
case CPUID_MODEL_JAKETOWN:
case CPUID_MODEL_SANDYBRIDGE:
case CPUID_MODEL_IVYBRIDGE:
case CPUID_MODEL_IVYBRIDGE_XEON:
case CPUID_MODEL_HASWELL_U5:
case CPUID_MODEL_HASWELL:
case CPUID_MODEL_HASWELL_SVR:
//case CPUID_MODEL_HASWELL_H:
case CPUID_MODEL_HASWELL_ULT:
case CPUID_MODEL_HASWELL_ULX:
case CPUID_MODEL_BROADWELL_HQ:
case CPUID_MODEL_BRASWELL:
case CPUID_MODEL_AVOTON:
case CPUID_MODEL_SKYLAKE:
case CPUID_MODEL_BRODWELL_SVR:
case CPUID_MODEL_BRODWELL_MSVR:
case CPUID_MODEL_KNIGHT:
case CPUID_MODEL_ANNIDALE:
case CPUID_MODEL_GOLDMONT:
case CPUID_MODEL_VALLEYVIEW:
case CPUID_MODEL_SKYLAKE_S:
//case CPUID_MODEL_:
case CPUID_MODEL_SKYLAKE_AVX:
case CPUID_MODEL_CANNONLAKE:
msr = rdmsr64(MSR_CORE_THREAD_COUNT); // 0x35
p->CPU.NoCores= (uint32_t)bitfield((uint32_t)msr, 31, 16);
p->CPU.NoThreads= (uint32_t)bitfield((uint32_t)msr, 15, 0);
p->CPU.NoThreads= (uint32_t)bitfield((uint32_t)msr, 15, 0);
break;
case CPUID_MODEL_ATOM_3700:
p->CPU.NoCores= 4;
p->CPU.NoThreads= 4;
break;
case CPUID_MODEL_ATOM:
p->CPU.NoCores= 2;
p->CPU.NoThreads= 2;
break;
}
if (p->CPU.NoCores == 0)
{
p->CPU.NoCores= cores_per_package;
p->CPU.NoThreads= logical_per_package;
}
// MSR is *NOT* available on the Intel Atom CPU
// workaround for N270. I don't know why it detected wrong
if ((p->CPU.Model == CPUID_MODEL_ATOM) && (strstr(p->CPU.BrandString, "270")))
{
p->CPU.NoCores= 1;
p->CPU.NoThreads= 2;
}
// workaround for Xeon Harpertown and Yorkfield
if ((p->CPU.Model == CPUID_MODEL_PENRYN) &&
(p->CPU.NoCores== 0))
}
}
if (p->CPU.NoCores == 0)
{
p->CPU.NoCores= cores_per_package;
p->CPU.NoThreads= logical_per_package;
}
// MSR is *NOT* available on the Intel Atom CPU
// workaround for N270. I don't know why it detected wrong
if ((p->CPU.Model == CPUID_MODEL_ATOM) && (strstr(p->CPU.BrandString, "270")))
{
p->CPU.NoCores= 1;
p->CPU.NoThreads= 2;
}
// workaround for Quad
if ( strstr(p->CPU.BrandString, "Quad") )
{
branches/zenith432/i386/libsaio/platform.h
7373
7474
7575
76
76
7777
78
78
7979
8080
81
81
82
83
84
85
8286
8387
8488
#define CPUID_MODEL_BRODWELL_SVR0x4F// Broadwell Server **BDX
#define CPUID_MODEL_SKYLAKE_AVX0x55// Skylake with AVX-512 support.
#define CPUID_MODEL_BRODWELL_MSVR0x56// Broadwell Micro Server, Future Xeon **BDX-DE
//#define CPUID_MODEL_KNIGHT0x57
#define CPUID_MODEL_KNIGHT0x57// Knights Landing
#define CPUID_MODEL_ANNIDALE0x5A// Silvermont, Future Atom E3000, Z3000 (Annidale)
//#define CPUID_MODEL_GOLDMONT0x5C
#define CPUID_MODEL_GOLDMONT0x5C
#define CPUID_MODEL_VALLEYVIEW0x5D// Silvermont, Future Atom E3000, Z3000
#define CPUID_MODEL_SKYLAKE_S0x5E// Skylake **SKL
//#define CPUID_MODEL_CANNONLAKE0x66
#define CPUID_MODEL_CANNONLAKE0x66
#define CPUID_MODEL_DENVERTON0x5F// Goldmont Microserver
#define CPUID_MODEL_XEON_MILL0x85// Knights Mill
#define CPUID_MODEL_KABYLAKE10x8E// Kabylake Mobile
#define CPUID_MODEL_KABYLAKE20x9E// Kabylake Dektop
/* CPUID Vendor */
#defineCPUID_VID_INTEL"GenuineIntel"
branches/zenith432/i386/libsaio/disk.c
17001700
17011701
17021702
1703
1703
17041704
1705
17051706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
17061717
17071718
17081719
......
17111722
17121723
17131724
1714
1715
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
17161739
1717
1740
1741
1742
1743
17181744
1719
17201745
17211746
17221747
1723
1748
17241749
1725
1726
1727
1728
1750
1751
1752
17291753
1730
1731
1754
17321755
17331756
17341757
1735
1736
1737
1738
1758
1759
1760
17391761
1740
17411762
17421763
1743
1764
17441765
1745
1746
1747
1748
1749
1750
1766
17511767
1752
17531768
1769
17541770
1755
1771
1772
1773
1774
1775
1776
1777
17561778
1757
1758
1759
1760
1761
1779
17621780
1781
1782
17631783
1764
1765
1766
17671784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
17681815
17691816
1770
1817
17711818
17721819
1820
1821
1822
1823
1824
17731825
1774
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
17751839
1776
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
17771850
1778
1779
1780
1851
1852
1853
1854
1855
17811856
1782
1857
1858
1859
1860
1861
17831862
1784
1785
1786
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
17871899
17881900
17891901
1790
1902
17911903
1904
17921905
1906
1907
1908
1909
1910
17931911
1794
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
17951932
1796
1933
17971934
1935
1936
1937
1938
1939
1940
1941
17981942
17991943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
18001978
18011979
1802
1803
18041980
18051981
1806
1982
18071983
18081984
18091985
......
18171993
18181994
18191995
1996
1997
1998
1999
2000
2001
2002
2003
18202004
18212005
18222006
static bool getOSVersion(BVRef bvr, char *str)
{
bool valid = false;
config_file_t systemVersion;
config_file_t configFile;
char dirSpec[512];
const char *val; int len;
const char *fakeOSVersion;
int fakeOSVersionInt;
// our pattern: avoiding to use full path. this help if the app is named as Beta or DP..
char *LionPattern = "Install%20Mac%20OS%20X%20Lion";
char *MLPattern = "Install%20OS%20X%20Mountain%20Lion";
char *MavPattern = "Install%20OS%20X%20Mavericks";
char *YosPattern = "Install%20OS%20X%20Yosemite";
char *ECPattern = "Install%20OS%20X%20El%20Capitan";
char *SierraPattern = "Install%20macOS%20Sierra";
/*
* Only look for OS Version on HFS+
*/
return valid;
}
// OS X Recovery
sprintf(dirSpec, "hd(%d,%d)/com.apple.recovery.boot/SystemVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no);
/*
* Micky1979, let it search for the right Version *.plist
*
* NOTE:
* order is important because vanilla installer (createinstallermedia method 10.9 +) has both /.IABootFilesSystemVersion.plist and
* /System/Library/CoreServices/SystemVersion.plist otherwise fail to recognize it as Installer!
*
* OS X Installer made by the Vanilla app for Lion and newer.
* This kind of Installer can be a guest in a already working System, and produces some temporary files:
* 1) ".IABootFiles" folder is created in the root of the same partition where the app reside.
* 2) "Mac OS X Install Data" or "OS X Install Data" in the target partition
* 3) The presence of ".IABootFilesSystemVersion.plist" file if present or not, distinguishes this installer
* by the one create with "createinstallmedia" method (is present), so we know what kind of installer is.
*/
if (!loadConfigFile(dirSpec, &systemVersion))
// is an installer or a system to Upgrade OSX?
snprintf(dirSpec, sizeof(dirSpec), "hd(%d,%d)/.IAProductInfo", BIOS_DEV_UNIT(bvr), bvr->part_no);
if (!loadConfigFile(dirSpec, &configFile))
{
bvr->OSisInstaller = true;
valid = true;
}
if (!valid)
if (valid)
{
// OS X Standard
snprintf(dirSpec, sizeof(dirSpec), "hd(%d,%d)/System/Library/CoreServices/SystemVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no);
if (!loadConfigFile(dirSpec, &systemVersion))
// is createinstallmedia?
snprintf(dirSpec, sizeof(dirSpec), "hd(%d,%d)/.IABootFilesSystemVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no);
if (!loadConfigFile(dirSpec, &configFile))
{
bvr->OSisInstaller = false;
valid = true;
valid = false;
}
else
{
// OS X Server
snprintf(dirSpec, sizeof(dirSpec), "hd(%d,%d)/System/Library/CoreServices/ServerVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no);
if (!loadConfigFile(dirSpec, &systemVersion))
// if not exist probably is a vanilla installer made w/o createinstallermedia method
snprintf(dirSpec, sizeof(dirSpec), "hd(%d,%d)/.IABootFiles/com.apple.Boot.plist", BIOS_DEV_UNIT(bvr), bvr->part_no);
if (!loadConfigFile(dirSpec, &configFile))
{
bvr->OSisServer = false;
valid = true;
}
/*else
else
{
snprintf(dirSpec, sizeof(dirSpec), "hd(%d,%d)/.IAProductInfo", BIOS_DEV_UNIT(bvr), bvr->part_no);
if (!loadConfigFile(dirSpec, &systemVersion))
{
}
valid = false;
}
*/
}
}
if ( LION )
if (valid)
{
/*
* we don't know the real OS version, but "Kernel Flags" key contain the URL path to the app..
* and we try to see if contain a match for our patterns ("Install%20OS%20X%20El%20Capitan" = 10.11)
*/
if (getValueForKey("Kernel Flags", &val, &len, &configFile))
{
int fh = -1;
snprintf(dirSpec, sizeof(dirSpec), "hd(%d,%d)/.PhysicalMediaInstall", BIOS_DEV_UNIT(bvr), bvr->part_no);
fh = open(dirSpec, 0);
if (fh >= 0)
if(strstr(val, LionPattern))
{
fakeOSVersion = "10.7";
fakeOSVersionInt = 7;
valid = true;
bvr->OSisInstaller = true;
strcpy(bvr->OSVersion, "10.7"); // 10.7 +
close(fh);
}
else if(strstr(val, MLPattern))
{
fakeOSVersion = "10.8";
fakeOSVersionInt = 8;
valid = true;
}
else if(strstr(val, MavPattern))
{
fakeOSVersion = "10.9";
fakeOSVersionInt = 9;
valid = true;
}
else if(strstr(val, YosPattern))
{
fakeOSVersion = "10.10";
fakeOSVersionInt = 10;
valid = true;
}
else if(strstr(val, ECPattern))
{
fakeOSVersion = "10.11";
fakeOSVersionInt = 11;
valid = true;
}
else if(strstr(val, SierraPattern))
{
fakeOSVersion = "10.12";
fakeOSVersionInt = 12;
valid = true;
}
else
{
close(fh);
valid = false;
}
}
else
{
valid = false;
}
}
//if ( MOUNTAIN_LION ){}
if (valid)
{
/*
* if we are here that is an createinstallmedia Installer!
* fake the OS version so we can find the right path to the kernelcache/prelinked!
* To patch the kernelcache we aquire the "Darwin versionn" later..
*/
strncpy( bvr->OSFullVer, fakeOSVersion, strlen(fakeOSVersion) );
bvr->OSisInstaller = true;
// no SystemVersion.plist ...so no build...
strncpy( bvr->OSBuildVer, "INSTALLER", strlen("INSTALLER") );
return true;
}
if ( MAVERICKS )
/*
* Not valid? But we have the "/.IAProductInfo" in the root so this is not a conventional installer
* and probably this is an Upgrade made by the "Install OS X app"
*/
if (!valid)
{
len = 0; val = 0;
// 10.9 and later use "/OS X Install Data" folder
snprintf(dirSpec, sizeof(dirSpec), "hd(%d,%d)/OS X Install Data/com.apple.Boot.plist", BIOS_DEV_UNIT(bvr), bvr->part_no);
if (!loadConfigFile(dirSpec, &configFile))
{
int fh = -1;
snprintf(dirSpec, sizeof(dirSpec), "hd(%d,%d)/.IAPhysicalMedia", BIOS_DEV_UNIT(bvr), bvr->part_no);
fh = open(dirSpec, 0);
/*
* bad is that we can't find what is the exactly Major OS version..
* but what we need is the right path to the kernel cache:
* kernelcache = 10.9 and 10.10
* prelinkedkernel = 10.11 and later
if (fh >= 0)
* so we fake the OS version just to find the correct path!
* .. later the right "Darwin Version" will use to patch the kernel cache!
*/
if (getValueForKey("Kernel Cache", &val, &len, &configFile))
{
valid = true;
bvr->OSisInstaller = true;
strcpy(bvr->OSVersion, "10.9"); // 10.9 +
if(strstr(val, "prelinkedkernel")) // /OS X Install Data/prelinkedkernel
{
fakeOSVersion = "10.11"; // fake OS to find prelinkedkernel on newer OSes
switch (fakeOSVersionInt)
{
case 11:
fakeOSVersion = "10.11";
break;
case 12:
fakeOSVersion = "10.12";
break;
default:
fakeOSVersion = "10.12";
break;
}
valid = true;
}
else if(strstr(val, "kernelcache")) // /OS X Install Data/kernelcache
{
fakeOSVersion = "10.10"; // fake OS to find prelinkedkernel on 10.9 and 10.10
valid = true;
}
else
{
valid = false;
}
if (valid)
{
strncpy( bvr->OSFullVer, fakeOSVersion, strlen(fakeOSVersion) );
bvr->OSisOSXUpgrade = true;
strncpy( bvr->OSBuildVer, "UPGRADE", strlen("UPGRADE") );
return true;
}
}
else
{
close(fh);
valid = false;
}
}
else
{
valid = false;
}
}
//if ( YOSEMITE ){}
if (!valid)
{
/*
* Not valid? 10.8 and older use "/Mac OS X Install Data" folder..
*/
snprintf(dirSpec, sizeof(dirSpec), "hd(%d,%d)/Mac OS X Install Data/com.apple.Boot.plist", BIOS_DEV_UNIT(bvr), bvr->part_no);
if (!loadConfigFile(dirSpec, &configFile))
{
fakeOSVersion = "10.8"; // fake the OS version using 10.8.. just to find the kernelcache path for 10.7 and 10.8..
strncpy( bvr->OSFullVer, fakeOSVersion, strlen(fakeOSVersion) );
bvr->OSisMacOSXUpgrade = true;
// again no SystemVersion.plist, so no build version.. but is usefull to know that is a System upgrade..
strncpy( bvr->OSBuildVer, "UPGRADE", strlen("UPGRADE") );
return true;
}
else
{
valid = false;
}
}
//if ( ELCAPITAN ){}
len = 0; val = 0;
// OS X Installer createinstallermedia method for 10.9 and newer.
snprintf(dirSpec, sizeof(dirSpec), "hd(%d,%d)/.IABootFilesSystemVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no);
if (!loadConfigFile(dirSpec, &configFile))
{
bvr->OSisInstaller = true;
valid = true;
}
// OS X Standard
if (!valid)
{
snprintf(dirSpec, sizeof(dirSpec), "hd(%d,%d)/System/Library/CoreServices/SystemVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no);
if (!loadConfigFile(dirSpec, &configFile))
{
valid = true;
}
else
{
// OS X Server
snprintf(dirSpec, sizeof(dirSpec), "hd(%d,%d)/System/Library/CoreServices/ServerVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no);
if (!loadConfigFile(dirSpec, &configFile))
{
bvr->OSisServer = true;
valid = true;
}
}
}
if (!valid)
{
// OS X Recovery
sprintf(dirSpec, "hd(%d,%d)/com.apple.recovery.boot/SystemVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no);
if (!loadConfigFile(dirSpec, &configFile))
{
bvr->OSisRecovery = true;
valid = true;
}
}
if (valid)
{
const char *val;
int len;
// ProductVersion
if (getValueForKey(kProductVersion, &val, &len, &systemVersion))
if (getValueForKey(kProductVersion, &val, &len, &configFile))
{
// Copy the complete value into OSFullVer
strncpy( bvr->OSFullVer, val, len );
{
str[4] = '\0';
}
// ProductBuildVersion
if (getValueForKey(kProductBuildVersion, &val, &len, &configFile))
{
strncpy( bvr->OSBuildVer, val, len );
bvr->OSBuildVer[len] = '\0'; /* null character manually added */
}
}
else
{
branches/zenith432/i386/libsaio/stringTable.c
663663
664664
665665
666
666
667667
668668
669669
"/com.apple.recovery.boot/com.apple.Boot.plist",// OS X Recovery
"/OS X Install Data/com.apple.Boot.plist",// OS X Upgrade (10.8+)
"/Mac OS X Install Data/com.apple.Boot.plist",// OS X Upgrade (Lion 10.7)
//"/.IABootFiles/com.apple.Boot.plist",// OS X Installer
"/.IABootFiles/com.apple.Boot.plist",// OS X Installer
"/Library/Preferences/SystemConfiguration/com.apple.Boot.plist"// (Installed System or Installer)
};
branches/zenith432/i386/libsaio/saio_types.h
214214
215215
216216
217
218
217
218
219
220
219221
220222
221223
charOSFullVer[OSVERSTRLEN]; /* Null terminated string from '/System/Library/CoreServices/SystemVersion.plist/ProductVersion' */
charOSBuildVer[OSVERSTRLEN];/* Null terminated string from '/System/Library/CoreServices/SystemVersion.plist/ProductBuildVersion' */
boolOSisServer;/* 1 = OS X server , 0 = OS X client */
boolOSisInstaller;/* 1 = OS X Install partition / recovery partition , 0 = OS X Install */
boolOSisInstaller;/* 1 = OS X Installer */
boolOSisMacOSXUpgrade;/* 1 = OS X Installer Upgrade */
boolOSisOSXUpgrade;/* 1 = OS X Installer Upgrade */
boolOSisRecovery;/* 1 = Recovery HD partition */
};
enum
branches/zenith432/i386/libsaio/fake_efi.c
1717
1818
1919
20
2021
2122
2223
......
108109
109110
110111
111
112
112113
113114
114115
......
813814
814815
815816
817
818
819
820
821
822
823
824
825
826
827
828
829
816830
817831
818832
#include "convert.h"
#include "pci.h"
#include "sl.h"
#include "vers.h"
#ifndef DEBUG_EFI
#define DEBUG_EFI 0
/* Identify ourselves as the EFI firmware vendor */
static EFI_CHAR16 const FIRMWARE_VENDOR[] = {'C','h','a','m','e','l','e','o','n','_','2','.','3', 0};
static EFI_UINT32 const FIRMWARE_REVISION = 0x0001000a; // got from real MBP6,1
static EFI_UINT32 const FIRMWARE_REVISION = EFI_SYSTEM_TABLE_REVISION;
/* Default platform system_id (fix by IntVar)
static EFI_CHAR8 const SYSTEM_ID[] = "0123456789ABCDEF"; //random value gen by uuidgen
}
}
// Micky1979 : MIMIC booter entry for El Capitan
if ( MacOSVerCurrent >= MacOSVer2Int("10.11") ) // El Capitan
{
verbose("Adding booter spec to the Platform Expert \n");
// booter-build-time (Fri May 22 19:06:42 PDT 2015) DP1
// booter-build-time (Fri Jul 24 17:39:22 PDT 2015) DP7
DT__AddProperty(chosenNode, "booter-build-time", sizeof(I386BOOT_BUILDDATE), I386BOOT_BUILDDATE);
// booter-name (boot.efi)
DT__AddProperty(chosenNode, "booter-name", sizeof("Enoch"), "Enoch");
// booter-version (version:295.0.0.1.1) DP1
// booter-version (version:304) DP7
DT__AddProperty(chosenNode, "booter-version", sizeof(I386BOOT_CHAMELEONREVISION), I386BOOT_CHAMELEONREVISION);
}
}
/*
branches/zenith432/i386/libsaio/smbios_getters.c
2020
2121
2222
23
24
25
2326
2427
2528
......
384387
385388
386389
387
388390
389391
390392
......
424426
425427
426428
427
428
429
430
431
429
430
431
432
433
432434
433
434
435
436
437
435438
436439
437440
......
456459
457460
458461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
459486
460487
461488
#define XEON "Xeon"
#define CORE_M "Core(TM) M"
#define CORE_M3 "Core(TM) m3"
#define CORE_M5 "Core(TM) m5"
#define CORE_M7 "Core(TM) m7"
#define CORE_I3 "Core(TM) i3"
#define CORE_I5 "Core(TM) i5"
#define CORE_I7 "Core(TM) i7"
return true;
case CPUID_MODEL_HASWELL_U5:// 0x3D -
case CPUID_MODEL_SKYLAKE_S:// 0x5E
if (strstr(Platform.CPU.BrandString, CORE_M))
{
value->word = 0xA01;// 2561 - Xeon
return true;
case CPUID_MODEL_ATOM_3700:// 0x37 -
case CPUID_MODEL_HASWELL:// 0x3C -
case CPUID_MODEL_HASWELL_SVR:// 0x3F -
case CPUID_MODEL_HASWELL_ULT:// 0x45 -
case CPUID_MODEL_HASWELL_ULX:// 0x46 -
case CPUID_MODEL_ATOM_3700:// 0x37
case CPUID_MODEL_HASWELL:// 0x3C
case CPUID_MODEL_HASWELL_SVR:// 0x3F
case CPUID_MODEL_HASWELL_ULT:// 0x45
case CPUID_MODEL_HASWELL_ULX:// 0x46
case CPUID_MODEL_BROADWELL_HQ:// 0x47
case CPUID_MODEL_SKYLAKE:
case CPUID_MODEL_SKYLAKE_AVX:
case CPUID_MODEL_SKYLAKE:// 0x4E
case CPUID_MODEL_SKYLAKE_AVX:// 0x55
case CPUID_MODEL_SKYLAKE_S:// 0x5E
if (strstr(Platform.CPU.BrandString, XEON))
{
return true;
}
if (strstr(Platform.CPU.BrandString, CORE_M))
{
value->word = 0xB06;// 2822
return true;
}
if (strstr(Platform.CPU.BrandString, CORE_M3))
{
value->word = 0xC05;
return true;
}
if (strstr(Platform.CPU.BrandString, CORE_M5))
{
value->word = 0xD05;
return true;
}
if (strstr(Platform.CPU.BrandString, CORE_M7))
{
value->word = 0xE05;
return true;
}
if (Platform.CPU.NoCores <= 2)
{
value->word = 0x904;// - Core i3
branches/zenith432/i386/boot2/drivers.c
9292
9393
9494
95
95
9696
9797
9898
......
119119
120120
121121
122
122
123123
124124
125125
......
176176
177177
178178
179
180
179181
180182
181183
......
200202
201203
202204
205
206
207
208
209
203210
204211
205212
......
254261
255262
256263
257
264
258265
259266
260267
......
9981005
9991006
10001007
1008
10011009
10021010
10031011
......
10121020
10131021
10141022
1023
10151024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
10161055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
10171232
10181233
10191234
long (*LoadExtraDrivers_p)(FileLoadDrivers_t FileLoadDrivers_p);
/*static*/ unsigned long Adler32( unsigned char * buffer, long length );
static inline unsigned long Adler32( unsigned char * buffer, long length );
long FileLoadDrivers(char *dirSpec, long plugin);
long NetLoadDrivers(char *dirSpec);
// Bungo:
char gDarwinBuildVerStr[256] = "Darwin Kernel Version";
/*static*/ unsigned long Adler32( unsigned char *buffer, long length )
static inline unsigned long Adler32( unsigned char *buffer, long length )
{
long cnt;
unsigned long result, lowHalf, highHalf;
return 0;
}
// ========================================
// Load extra drivers if a hook has been installed.
if (LoadExtraDrivers_p != NULL)
{
}
verbose("Attempting to loading drivers from \"Extra\" repository:\n");
// =====================================================================
// Firstly try to load drivers from Common folder
sprintf(dirSpecExtra, "bt(0,0)/Extra/Common/");
FileLoadDrivers(dirSpecExtra, 0);
// =====================================================================
// Next try to load Extra extensions from the selected root partition.
strlcpy(dirSpecExtra, "/Extra/", sizeof(dirSpecExtra));
{
verbose("Attempting to loading drivers from standard repositories:\n");
if ( (gMacOSVersion[3] == '9') || ((gMacOSVersion[3] == '1') && ((gMacOSVersion[4] == '0') || gMacOSVersion[4] == '1' ) )) // issue 352
if ( (gMacOSVersion[3] == '9') || ((gMacOSVersion[3] == '1') && ((gMacOSVersion[4] == '0') || (gMacOSVersion[4] == '1') || (gMacOSVersion[4] == '2') ) )) // issue 352
{
verbose("\t- Third party extensions search path: /Library/Extensions\n");
strlcpy(gExtensionsSpec, dirSpec, 4087); /* 4096 - sizeof("Library/") mean 4096 - 9 = 4087 */
}
// Bungo: scan binary for Darwin Kernel Version string
useDarwinVersion = true;
uint32_t offset = 0;
strncpy(gDarwinBuildVerStr, "Darwin Kernel Version", sizeof(gDarwinBuildVerStr));
else
{
strcat(gDarwinBuildVerStr, ": Unknown");
useDarwinVersion = false;
}
// Micky1979 use Bungo gDarwinBuildVerStr and split into gDarwinMajor, gDarwinMinor and gDarwinRev
if (useDarwinVersion)
{
useDarwinVersion = false;
const char *pattern = strstr(gDarwinBuildVerStr, "Darwin Kernel Version ")+22;
const char *until = strstr(pattern, ":");
size_t vlen = until - pattern;
char *ver = (char *)malloc(sizeof(char)*(len+1));
strncpy(ver, pattern, vlen);
ver[vlen] = '\0';
char *delim;
char *temp;
gDarwinMajor = -1; gDarwinMinor = -1; gDarwinRev = -1;
if (ver != NULL)
{
temp = ver;
int count = 1;
while ((delim = strsep_c(&ver, ".")) != NULL)
{
switch (count)
{
case 1: gDarwinMajor = atoi(delim); break;
case 2: gDarwinMinor = atoi(delim); break;
case 3: gDarwinRev = atoi(delim); break;
default: break;
}
count ++;
}
free(temp);
}
if (gDarwinMajor >= 0 && gDarwinMinor >= 0 && gDarwinRev >= 0)
{
useDarwinVersion = true;
}
switch (gDarwinMajor)
{
case 10:
switch (gDarwinMinor)
{
case 0: kernelOSVer = 0xA060000; break;
case 1: kernelOSVer = 0xA060100; break;
case 2: kernelOSVer = 0xA060200; break;
case 3: kernelOSVer = 0xA060300; break;
case 4: kernelOSVer = 0xA060400; break;
case 5: kernelOSVer = 0xA060500; break;
case 6: kernelOSVer = 0xA060600; break;
case 7: kernelOSVer = 0xA060700; break;
case 8: kernelOSVer = 0xA060800; break;
default:kernelOSVer = 0xA060800; break; //Last known kernel
}
break;
case 11:
switch (gDarwinMinor)
{
case 0: kernelOSVer = 0xA070000; break;
case 1: kernelOSVer = 0xA070100; break;
case 2: kernelOSVer = 0xA070200; break;
case 3: kernelOSVer = 0xA070300; break;
case 4:
switch (gDarwinRev)
{
case 0: kernelOSVer = 0xA070400; break;
case 1: kernelOSVer = 0xA070400; break;
case 2: kernelOSVer = 0xA070500; break;
default:kernelOSVer = 0xA070500; break; //Last known kernel
}
default:kernelOSVer = 0xA070500; break; //Last known kernel
}
break;
case 12:
switch (gDarwinMinor)
{
case 0: kernelOSVer = 0xA080000; break;
case 1: kernelOSVer = 0xA080100; break;
case 2: kernelOSVer = 0xA080200; break;
case 3: kernelOSVer = 0xA080300; break;
case 4: kernelOSVer = 0xA080400; break;
case 5: kernelOSVer = 0xA080500; break; // 10.8.5
case 6: kernelOSVer = 0xA080500; break; // 10.8.5 update
default:kernelOSVer = 0xA080500; break; //Last known kernel
}
break;
case 13:
switch (gDarwinMinor)
{
case 0: kernelOSVer = 0xA090000;
switch (gDarwinRev)
{
case 0: kernelOSVer = 0xA090000; break;
case 1: kernelOSVer = 0xA090000; break; // never exist (or released)
case 2: kernelOSVer = 0xA090100; break;
default:kernelOSVer = 0xA090100; break; //Last known kernel
}
break;
case 1: kernelOSVer = 0xA090100; break; // never exist (or released)
case 2: kernelOSVer = 0xA090200; break;
case 3: kernelOSVer = 0xA090300; break;
case 4: kernelOSVer = 0xA090400; break;
case 5: kernelOSVer = 0xA090500; break;
default:kernelOSVer = 0xA090500; break; //Last known kernel
}
break;
case 14:
switch (gDarwinMinor)
{
case 0: kernelOSVer = 0xA0A0000; break; // same kernel of 10.10.1
case 1: kernelOSVer = 0xA0A0100; break; // same kernel of 10.10
case 2: kernelOSVer = 0xA0A0200; break;
case 3: kernelOSVer = 0xA0A0300; break;
case 4: kernelOSVer = 0xA0A0400; break;
case 5: kernelOSVer = 0xA0A0500; break;
default:kernelOSVer = 0xA0A0500; break; //Last known kernel
}
break;
case 15:
switch (gDarwinMinor)
{
case 0: kernelOSVer = 0xA0B0000; break;
case 1: kernelOSVer = 0xA0B0100; break;
case 2: kernelOSVer = 0xA0B0200; break;
case 3: kernelOSVer = 0xA0B0300; break;
case 4: kernelOSVer = 0xA0B0400; break;
case 5: kernelOSVer = 0xA0B0500; break;
case 6: kernelOSVer = 0xA0B0600; break;
default:kernelOSVer = 0xA0B0600; break; //Last known kernel (add here updates)
}
break;
case 16:
switch (gDarwinMinor)
{
case 0: kernelOSVer = 0xA0C0000; break;
case 1: kernelOSVer = 0xA0C0100; break;
case 2: kernelOSVer = 0xA0C0200; break;
case 3: kernelOSVer = 0xA0C0200; break;
case 4: kernelOSVer = 0xA0C0300; break;
case 5: kernelOSVer = 0xA0C0400; break;
default:kernelOSVer = 0xA0C0400; break; //Last known kernel (add here updates)
}
break;
default:
kernelOSVer = 0xA0C0400;
break;
}
}
else
{
switch (MacOSVerCurrent)
{
// Snow
case 0xA060000: gDarwinMajor = 10; gDarwinMinor = 0; gDarwinRev = 0; break; // 10.6
case 0xA060100: gDarwinMajor = 10; gDarwinMinor = 1; gDarwinRev = 0; break; // 10.6.1
case 0xA060200: gDarwinMajor = 10; gDarwinMinor = 2; gDarwinRev = 0; break; // 10.6.2
case 0xA060300: gDarwinMajor = 10; gDarwinMinor = 3; gDarwinRev = 0; break; // 10.6.3
case 0xA060400: gDarwinMajor = 10; gDarwinMinor = 4; gDarwinRev = 0; break; // 10.6.4
case 0xA060500: gDarwinMajor = 10; gDarwinMinor = 5; gDarwinRev = 0; break; // 10.6.5
case 0xA060600: gDarwinMajor = 10; gDarwinMinor = 6; gDarwinRev = 0; break; // 10.6.6
case 0xA060700: gDarwinMajor = 10; gDarwinMinor = 7; gDarwinRev = 0; break; // 10.6.7
case 0xA060800: gDarwinMajor = 10; gDarwinMinor = 8; gDarwinRev = 0; break; // 10.6.8
// Lion
case 0xA070000: gDarwinMajor = 11; gDarwinMinor = 0; gDarwinRev = 0; break; // 10.7
case 0xA070100: gDarwinMajor = 11; gDarwinMinor = 1; gDarwinRev = 0; break; // 10.7.1
case 0xA070200: gDarwinMajor = 11; gDarwinMinor = 2; gDarwinRev = 0; break; // 10.7.2
case 0xA070300: gDarwinMajor = 11; gDarwinMinor = 3; gDarwinRev = 0; break; // 10.7.3
case 0xA070400: gDarwinMajor = 11; gDarwinMinor = 4; gDarwinRev = 0; break; // 10.7.4
case 0xA070500: gDarwinMajor = 11; gDarwinMinor = 4; gDarwinRev = 2; break; // 10.7.5
// ML
case 0xA080000: gDarwinMajor = 12; gDarwinMinor = 0; gDarwinRev = 0; break; // 10.8
case 0xA080100: gDarwinMajor = 12; gDarwinMinor = 1; gDarwinRev = 0; break; // 10.8.1
case 0xA080200: gDarwinMajor = 12; gDarwinMinor = 2; gDarwinRev = 0; break; // 10.8.2
case 0xA080300: gDarwinMajor = 12; gDarwinMinor = 3; gDarwinRev = 0; break; // 10.8.3
case 0xA080400: gDarwinMajor = 12; gDarwinMinor = 4; gDarwinRev = 0; break; // 10.8.4
case 0xA080500: gDarwinMajor = 12; gDarwinMinor = 5; gDarwinRev = 0; break; // 10.8.5
// Mavericks
case 0xA090000: gDarwinMajor = 13; gDarwinMinor = 0; gDarwinRev = 0; break; // 10.9
case 0xA090100: gDarwinMajor = 13; gDarwinMinor = 1; gDarwinRev = 0; break; // 10.9.1
case 0xA090200: gDarwinMajor = 13; gDarwinMinor = 2; gDarwinRev = 0; break; // 10.9.2
case 0xA090300: gDarwinMajor = 13; gDarwinMinor = 3; gDarwinRev = 0; break; // 10.9.3
case 0xA090400: gDarwinMajor = 13; gDarwinMinor = 4; gDarwinRev = 0; break; // 10.9.4
case 0xA090500: gDarwinMajor = 13; gDarwinMinor = 5; gDarwinRev = 0; break; // 10.9.5
// Yosemite
case 0xA0A0000: gDarwinMajor = 14; gDarwinMinor = 0; gDarwinRev = 0; break; // 10.10
case 0xA0A0100: gDarwinMajor = 14; gDarwinMinor = 0; gDarwinRev = 0; break; // 10.10.1
case 0xA0A0200: gDarwinMajor = 14; gDarwinMinor = 2; gDarwinRev = 0; break; // 10.10.2
case 0xA0A0300: gDarwinMajor = 14; gDarwinMinor = 3; gDarwinRev = 0; break; // 10.10.3
case 0xA0A0400: gDarwinMajor = 14; gDarwinMinor = 4; gDarwinRev = 0; break; // 10.10.4
case 0xA0A0500: gDarwinMajor = 14; gDarwinMinor = 5; gDarwinRev = 0; break; // 10.10.5
// El Capitan
case 0xA0B0000: gDarwinMajor = 15; gDarwinMinor = 0; gDarwinRev = 0; break; // 10.11
case 0xA0B0100: gDarwinMajor = 15; gDarwinMinor = 1; gDarwinRev = 0; break; // 10.11.1
case 0xA0B0200: gDarwinMajor = 15; gDarwinMinor = 2; gDarwinRev = 0; break; // 10.11.2
case 0xA0B0300: gDarwinMajor = 15; gDarwinMinor = 3; gDarwinRev = 0; break; // 10.11.3
case 0xA0B0400: gDarwinMajor = 15; gDarwinMinor = 4; gDarwinRev = 0; break; // 10.11.4
case 0xA0B0500: gDarwinMajor = 15; gDarwinMinor = 5; gDarwinRev = 0; break; // 10.11.5
case 0xA0B0600: gDarwinMajor = 15; gDarwinMinor = 6; gDarwinRev = 0; break; // 10.11.6
// Sierra
case 0xA0C0000: gDarwinMajor = 16; gDarwinMinor = 0; gDarwinRev = 0; break; // 10.12
case 0xA0C0100: gDarwinMajor = 16; gDarwinMinor = 1; gDarwinRev = 0; break; // 10.12.1
case 0xA0C0200: gDarwinMajor = 16; gDarwinMinor = 3; gDarwinRev = 0; break; // 10.12.2
case 0xA0C0300: gDarwinMajor = 16; gDarwinMinor = 4; gDarwinRev = 0; break; // 10.12.3
case 0xA0C0400: gDarwinMajor = 16; gDarwinMinor = 5; gDarwinRev = 0; break; // 10.12.4
// default = last known kernel
default: gDarwinMajor = 16; gDarwinMinor = 5; gDarwinRev = 0; break; // 10.12.4;
}
}
// Notify modules that the kernel has been decompressed, thinned and is about to be decoded
execute_hook("DecodeKernel", (void *)binary, NULL, NULL, NULL);
branches/zenith432/i386/boot2/boot.c
8181
8282
8383
84
85
86
87
88
89
8490
8591
8692
......
140146
141147
142148
149
150
151
152
143153
144154
145155
......
149159
150160
151161
152
153162
154
155
156
157
158
159
160
161
162
163
164
163
165164
166
167
165
166
167
168168
169
170
171
172
173
169
174170
175
176
177
178
179
180
181
182
183
184
185
186
171
187172
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227173
228174
229175
......
395341
396342
397343
398
344
399345
400
401
402
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
403373
404374
405375
406
376
407377
408
409
410
411
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
412399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
413446
414447
415448
......
417450
418451
419452
420
421
453
454
455
456
422457
423
458
459
460
461
462
463
464
465
466
467
468
469
424470
425
471
426472
427473
428474
429475
430
476
431477
432478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
433520
434521
435
522
436523
437524
438525
......
463550
464551
465552
466
467
468
469
470
471
553
472554
473
474
475
555
556
557
476558
477
559
560
561
562
563
564
478565
479
480
481
482
483
566
567
568
569
570
571
572
573
484574
485575
486576
......
739829
740830
741831
742
832
743833
744
745
834
746835
747
836
837
748838
749
839
750840
751841
752
842
753843
754
844
755845
756846
757
847
758848
759
760
849
761850
762851
763
852
764853
765
766
767
768
854
855
856
857
858
859
860
861
862
769863
770
771
864
865
866
867
772868
773
774
869
870
871
872
873
775874
776
777
778
875
876
877
878
879
880
779881
780
781
882
883
782884
783
784
885
886
887
888
889
890
891
892
893
894
895
896
785897
786
787
898
899
788900
901
902
903
904
789905
790906
907
791908
792
793
909
910
911
794912
795913
796
797914
798915
799916
......
863980
864981
865982
866
983
867984
868985
869986
870987
871988
989
872990
873991
874992
......
9611079
9621080
9631081
1082
1083
1084
1085
1086
1087
1088
9641089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
9651167
1168
1169
1170
1171
1172
1173
9661174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
9671200
9681201
9691202
boolgScanSingleDrive;
booluseGUI;
/* recovery or installer ? */
bool isInstaller;
bool isRecoveryHD;
bool isMacOSXUpgrade;
bool isOSXUpgrade;
#if DEBUG_INTERRUPTS
static intinterruptsAvailable = 0;
#endif
malloc_init(0, 0, 0, malloc_error);
}
// =========================================================================
//==========================================================================
// ExecKernel - Load the kernel image (mach-o) and jump to its entry point.
entry_tkernelEntry;
bootArgs->kaddr = bootArgs->ksize = 0;
// ===============================================================================
// OS X Mountain Lion 10.8
if ( MacOSVerCurrent >= MacOSVer2Int("10.8") ) // Mountain Lion and Up!
{
// cparm
bool KPRebootOption= false;
bool HiDPIOption= false;
getBoolForKey(kRebootOnPanic, &KPRebootOption, &bootInfo->chameleonConfig);
if ( KPRebootOption )
{
bootArgs->flags |= kBootArgsFlagRebootOnPanic;
}
// ===============================================================================
// cparm
getBoolForKey(kEnableHiDPI, &HiDPIOption, &bootInfo->chameleonConfig);
gMacOSVersion[0] = 0;
// TODO identify sierra as macOS
verbose("Booting on %s %s (%s)\n", (MacOSVerCurrent < MacOSVer2Int("10.8")) ? "Mac OS X" : (MacOSVerCurrent < MacOSVer2Int("10.12")) ? "OS X" : "macOS", gBootVolume->OSFullVer, gBootVolume->OSBuildVer );
if ( HiDPIOption )
{
bootArgs->flags |= kBootArgsFlagHiDPI;
}
}
setupBooterArgs();
// OS X Yosemite 10.10
if ( MacOSVerCurrent >= MacOSVer2Int("10.10") ) // Yosemite and Up!
{
// Pike R. Alpha
bool FlagBlackOption= false;
getBoolForKey(kBlackMode, &FlagBlackOption, &bootInfo->chameleonConfig);
if ( FlagBlackOption )
{
//bootArgs->flags |= kBootArgsFlagBlack;
bootArgs->flags |= kBootArgsFlagBlackBg; // Micky1979
}
}
// ===============================================================================
// OS X El Capitan 10.11
if ( MacOSVerCurrent >= MacOSVer2Int("10.11") ) // El Capitan and Up!
{
// ErmaC
intcsrValue;
#if 0
/*
* A special BootArgs flag "kBootArgsFlagCSRBoot"
* is set in the Recovery or Installation environment.
* This flag is kind of overkill by turning off all the protections
*/
if (isRecoveryHD)
{
// SIP can be controlled with or without FileNVRAM.kext (Pike R. Alpha)
bootArgs->flags|=(kBootArgsFlagCSRActiveConfig + kBootArgsFlagCSRConfigMode + kBootArgsFlagCSRBoot);
}
#endif
bootArgs->flags|= kBootArgsFlagCSRActiveConfig;
// Set limit to 7bit
if ( getIntForKey(KCsrActiveConfig, &csrValue, &bootInfo->chameleonConfig) && (csrValue >= 0 && csrValue <= 127) )
{
bootArgs->csrActiveConfig= csrValue;
}
else
{
// zenith432
bootArgs->csrActiveConfig= 0x67;
}
verbose("CsrActiveConfig set to 0x%x\n", bootArgs->csrActiveConfig);
bootArgs->csrCapabilities= CSR_VALID_FLAGS;
bootArgs->boot_SMC_plimit= 0;
}
// ===============================================================================
execute_hook("ExecKernel", (void *)binary, NULL, NULL, NULL);
ret = DecodeKernel(binary,
}
closedir(cacheDir);
}
else if ( MacOSVerCurrent >= MacOSVer2Int("10.7") && MacOSVerCurrent < MacOSVer2Int("10.10") )
else if ( MacOSVerCurrent >= MacOSVer2Int("10.7") && MacOSVerCurrent < MacOSVer2Int("10.9") )
{
// Lion, Mountain Lion and Mavericks prelink kernel cache file
// for 10.7 10.8 10.9
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", kDefaultCachePathSnow);
// Lion, Mountain Lion
// for 10.7 10.8
if (isMacOSXUpgrade)
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", "/Mac OS X Install Data/");
}
else if (isInstaller)
{
if (MacOSVerCurrent >= MacOSVer2Int("10.7") && MacOSVerCurrent < MacOSVer2Int("10.8") )
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", kLionInstallerDataFolder);
}
else if ( MacOSVerCurrent >= MacOSVer2Int("10.8") && MacOSVerCurrent < MacOSVer2Int("10.9") )
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", kMLionInstallerDataFolder);
}
}
else if (isRecoveryHD)
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", kDefaultCacheRecoveryHD);
}
else
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", kDefaultCachePathSnow);
}
verbose("Kernel Cache file path (Mac OS X 10.7 and newer): %s\n", kernelCacheFile);
}
else
else if ( MacOSVerCurrent >= MacOSVer2Int("10.9") && MacOSVerCurrent < MacOSVer2Int("10.10") )
{
// Yosemite and El Capitan prelink kernel cache file
// for 10.10 10.11
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%sprelinkedkernel", kDefaultCachePathYosemite);
verbose("Kernel Cache file path (Mac OS X 10.10 and newer): %s\n", kernelCacheFile);
// Mavericks prelinked cache file
// for 10.9
if (isOSXUpgrade)
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", "/OS X Install Data/");
}
else if (isInstaller)
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", kDefaultCacheInstallerNew);
}
else if (isRecoveryHD)
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", kDefaultCacheRecoveryHD);
}
else
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", kDefaultCachePathSnow);
}
verbose("Kernel Cache file path (OS X 10.9): %s\n", kernelCacheFile);
}
else if ( MacOSVerCurrent >= MacOSVer2Int("10.10") && MacOSVerCurrent < MacOSVer2Int("10.11") )
{
// Yosemite prelink kernel cache file
// for 10.10 and 10.11
if (isOSXUpgrade)
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", "/OS X Install Data/");
}
else if (isInstaller)
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", kDefaultCacheInstallerNew);
}
else if (isRecoveryHD)
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", kDefaultCacheRecoveryHD);
}
else
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%sprelinkedkernel", kDefaultCachePathYosemite);
}
verbose("Kernel Cache file path (OS X 10.10): %s\n", kernelCacheFile);
}
else if ( MacOSVerCurrent >= MacOSVer2Int("10.11") )
{
// El Capitan on prelinked kernel cache file
// for 10.10 and 10.11
if (isOSXUpgrade)
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%sprelinkedkernel", "/OS X Install Data/");
}
else if (isInstaller)
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%sprelinkedkernel", kDefaultCacheInstallerNew);
}
else if (isRecoveryHD)
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%sprelinkedkernel", kDefaultCacheRecoveryHD);
}
else
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%sprelinkedkernel", kDefaultCachePathYosemite);
}
verbose("Kernel Cache file path (OS X 10.11 and newer): %s\n", kernelCacheFile);
}
}
// Check if the kernel cache file exists
if (gBootVolume->flags & kBVFlagBooter)
{
snprintf(kernelCachePath, sizeof(kernelCachePath), "/com.apple.boot.P/%s", kernelCacheFile);
ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime);
if (isRecoveryHD)
{
strncpy(kernelCachePath, "/com.apple.recovery.boot/prelinkedkernel", sizeof(kernelCachePath) );
ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime);
if ((ret == -1) || ((flags & kFileTypeMask) != kFileTypeFlat))
if ((ret == -1) || ((flags & kFileTypeMask) != kFileTypeFlat))
{
strncpy(kernelCachePath, "/com.apple.recovery.boot/kernelcache", sizeof(kernelCachePath) );
ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime);
if ((flags & kFileTypeMask) != kFileTypeFlat)
{
ret = -1;
}
}
}
else if (isInstaller)
{
snprintf(kernelCachePath, sizeof(kernelCachePath), "/com.apple.boot.R/%s", kernelCacheFile);
strncpy(kernelCachePath, "/.IABootFiles/prelinkedkernel", sizeof(kernelCachePath) );
ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime);
if ((ret == -1) || ((flags & kFileTypeMask) != kFileTypeFlat))
{
snprintf(kernelCachePath, sizeof(kernelCachePath), "/com.apple.boot.S/%s", kernelCacheFile);
strncpy(kernelCachePath, "/.IABootFiles/kernelcache", sizeof(kernelCachePath) );
ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime);
if ((flags & kFileTypeMask) != kFileTypeFlat)
{
ret = -1;
}
}
}
else if (isMacOSXUpgrade)
{
strncpy(kernelCachePath, "/Mac OS X Install Data/kernelcache", sizeof(kernelCachePath) );
ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime);
if ((flags & kFileTypeMask) != kFileTypeFlat)
{
ret = -1;
}
}
else if (isOSXUpgrade)
{
strncpy(kernelCachePath, "/OS X Install Data/prelinkedkernel", sizeof(kernelCachePath) );
ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime);
if ((ret == -1) || ((flags & kFileTypeMask) != kFileTypeFlat))
{
strncpy(kernelCachePath, "/OS X Install Data/kernelcache", sizeof(kernelCachePath) );
ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime);
if ((flags & kFileTypeMask) != kFileTypeFlat)
{
ret = -1;
}
}
}
else
{
snprintf(kernelCachePath, sizeof(kernelCachePath), "/com.apple.boot.P/%s", kernelCacheFile);
ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime);
if ((ret == -1) || ((flags & kFileTypeMask) != kFileTypeFlat))
{
snprintf(kernelCachePath, sizeof(kernelCachePath), "/com.apple.boot.R/%s", kernelCacheFile);
ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime);
if ((ret == -1) || ((flags & kFileTypeMask) != kFileTypeFlat))
{
strncpy(kernelCachePath, "/com.apple.recovery.boot/kernelcache", sizeof kernelCachePath);
snprintf(kernelCachePath, sizeof(kernelCachePath), "/com.apple.boot.S/%s", kernelCacheFile);
ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime);
if ((flags & kFileTypeMask) != kFileTypeFlat)
return -1;
}
// Check if the kernel cache file is more recent (mtime)
// than the kernel file or the S/L/E directory
ret = GetFileInfo(NULL, bootInfo->bootFile, &flags, &kerneltime);
// Check if the kernel file is more recent than the cache file
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeFlat) && (kerneltime > cachetime))
if ( !isInstaller && !isRecoveryHD && !isMacOSXUpgrade && !isOSXUpgrade )
{
DBG("Kernel file '%s' is more recent than Kernel Cache '%s'! Ignoring Kernel Cache.\n", bootInfo->bootFile, kernelCacheFile);
return -1;
}
// Check if the kernel cache file is more recent (mtime)
// than the kernel file or the S/L/E directory
ret = GetFileInfo(NULL, bootInfo->bootFile, &flags, &kerneltime);
ret = GetFileInfo("/System/Library/", "Extensions", &flags, &exttime);
// Check if the kernel file is more recent than the cache file
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeFlat) && (kerneltime > cachetime))
{
DBG("Kernel file '%s' is more recent than Kernel Cache '%s'! Ignoring Kernel Cache.\n", bootInfo->bootFile, kernelCacheFile);
return -1;
}
// Check if the S/L/E directory time is more recent than the cache file
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory) && (exttime > cachetime))
{
DBG("Folder '/System/Library/Extensions' is more recent than Kernel Cache file '%s'! Ignoring Kernel Cache.\n", kernelCacheFile);
return -1;
ret = GetFileInfo("/System/Library/", "Extensions", &flags, &exttime);
// Check if the S/L/E directory time is more recent than the cache file
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory) && (exttime > cachetime))
{
DBG("Folder '/System/Library/Extensions' is more recent than Kernel Cache file '%s'! Ignoring Kernel Cache.\n", kernelCacheFile);
return -1;
}
}
// Since the kernel cache file exists and is the most recent try to load it
// Notify modules that we are attempting to boot
execute_hook("PreBoot", NULL, NULL, NULL, NULL);
if (!getBoolForKey (kWake, &tryresume, &bootInfo->chameleonConfig))
if (gBootVolume->OSisInstaller)
{
tryresume = true;
tryresumedefault = true;
isInstaller = true;
}
else
if (gBootVolume->OSisMacOSXUpgrade)
{
tryresumedefault = false;
isMacOSXUpgrade = true;
}
if (!getBoolForKey (kForceWake, &forceresume, &bootInfo->chameleonConfig))
if (gBootVolume->OSisOSXUpgrade)
{
forceresume = false;
isOSXUpgrade = true;
}
if (forceresume)
if (gBootVolume->OSisRecovery)
{
tryresume = true;
tryresumedefault = false;
isRecoveryHD = true;
}
while (tryresume)
if ( !isRecoveryHD && !isInstaller && !isMacOSXUpgrade && !isOSXUpgrade )
{
const char *tmp;
BVRef bvr;
if (!getValueForKey(kWakeImage, &val, &len, &bootInfo->chameleonConfig))
val = "/private/var/vm/sleepimage";
if (!getBoolForKey (kWake, &tryresume, &bootInfo->chameleonConfig))
{
tryresume = true;
tryresumedefault = true;
}
else
{
tryresumedefault = false;
}
// Do this first to be sure that root volume is mounted
ret = GetFileInfo(0, val, &flags, &sleeptime);
if (!getBoolForKey (kForceWake, &forceresume, &bootInfo->chameleonConfig))
{
forceresume = false;
}
if ((bvr = getBootVolumeRef(val, &tmp)) == NULL)
break;
if (forceresume)
{
tryresume = true;
tryresumedefault = false;
}
// Can't check if it was hibernation Wake=y is required
if (bvr->modTime == 0 && tryresumedefault)
break;
while (tryresume)
{
const char *tmp;
BVRef bvr;
if (!getValueForKey(kWakeImage, &val, &len, &bootInfo->chameleonConfig))
val = "/private/var/vm/sleepimage";
if ((ret != 0) || ((flags & kFileTypeMask) != kFileTypeFlat))
break;
// Do this first to be sure that root volume is mounted
ret = GetFileInfo(0, val, &flags, &sleeptime);
if (!forceresume && ((sleeptime+3)<bvr->modTime))
{
if ((bvr = getBootVolumeRef(val, &tmp)) == NULL)
break;
// Can't check if it was hibernation Wake=y is required
if (bvr->modTime == 0 && tryresumedefault)
break;
if ((ret != 0) || ((flags & kFileTypeMask) != kFileTypeFlat))
break;
if (!forceresume && ((sleeptime+3)<bvr->modTime))
{
#if DEBUG
printf ("Hibernate image is too old by %d seconds. Use ForceWake=y to override\n",
bvr->modTime-sleeptime);
printf ("Hibernate image is too old by %d seconds. Use ForceWake=y to override\n",
bvr->modTime-sleeptime);
#endif
break;
}
HibernateBoot((char *)val);
break;
}
}
HibernateBoot((char *)val);
break;
if (!isRecoveryHD && !isInstaller && !isMacOSXUpgrade && !isOSXUpgrade )
{
getBoolForKey(kUseKernelCache, &useKernelCache, &bootInfo->chameleonConfig);
}
getBoolForKey(kUseKernelCache, &useKernelCache, &bootInfo->chameleonConfig);
if (useKernelCache)
{
do
// bootFile must start with a / if it not start with a device name
if (!bootFileWithDevice && (bootInfo->bootFile)[0] != '/')
{
if ( MacOSVerCurrent < MacOSVer2Int("10.10") ) // Micky1979 - Is prior to Yosemite 10.10
if ( MacOSVerCurrent < MacOSVer2Int("10.10") ) // Mavericks and older
{
snprintf(bootFile, sizeof(bootFile), "/%s", bootInfo->bootFile); // append a leading /
}
else
{
// Yosemite and newer
snprintf(bootFile, sizeof(bootFile), kDefaultKernelPathForYos"%s", bootInfo->bootFile); // Yosemite or El Capitan
}
}
}
// =========================================================================
//
void setupBooterArgs()
{
bool KPRebootOption= false;
bool HiDPIOption= false;
bool FlagBlackOption= false;
// OS X Mountain Lion 10.8
if ( MacOSVerCurrent >= MacOSVer2Int("10.8") ) // Mountain Lion and Up!
{
// cparm
getBoolForKey(kRebootOnPanic, &KPRebootOption, &bootInfo->chameleonConfig);
if ( KPRebootOption )
{
bootArgs->flags |= kBootArgsFlagRebootOnPanic;
}
// cparm
getBoolForKey(kEnableHiDPI, &HiDPIOption, &bootInfo->chameleonConfig);
if ( HiDPIOption )
{
bootArgs->flags |= kBootArgsFlagHiDPI;
}
}
// OS X Yosemite 10.10
if ( MacOSVerCurrent >= MacOSVer2Int("10.10") ) // Yosemite and Up!
{
// Pike R. Alpha
getBoolForKey(kBlackMode, &FlagBlackOption, &bootInfo->chameleonConfig);
if ( FlagBlackOption )
{
// bootArgs->flags |= kBootArgsFlagBlack;
bootArgs->flags |= kBootArgsFlagBlackBg; // Micky1979
}
}
// OS X El Capitan 10.11
if ( MacOSVerCurrent >= MacOSVer2Int("10.11") ) // El Capitan and Sierra!
{
// ErmaC
verbose("\n");
intcsrValue;
/*
* A special BootArgs flag "kBootArgsFlagCSRBoot"
* is set in the Recovery or Installation environment.
* This flag is kind of overkill by turning off all the protections
*/
if (isRecoveryHD || isInstaller || isOSXUpgrade || isMacOSXUpgrade)
{
// SIP can be controlled with or without FileNVRAM.kext (Pike R. Alpha)
bootArgs->flags|=(kBootArgsFlagCSRActiveConfig + kBootArgsFlagCSRConfigMode + kBootArgsFlagCSRBoot);
}
else
{
bootArgs->flags|= kBootArgsFlagCSRActiveConfig;
}
// Set limit to 7bit
if ( getIntForKey(kCsrActiveConfig, &csrValue, &bootInfo->chameleonConfig) && (csrValue >= 0 && csrValue <= 127) )
{
bootArgs->csrActiveConfig= csrValue;
csrInfo(csrValue, 1);
}
else
{
// zenith432
bootArgs->csrActiveConfig= 0x67;
csrInfo(0x67, 0);
}
// ===============================================================================
bootArgs->csrCapabilities= CSR_VALID_FLAGS;
bootArgs->boot_SMC_plimit= 0;
}
}
// =========================================================================
// ErmaC
void csrInfo(int csrValue, bool custom)
{
int mask = 0x20;
verbose("System Integrity Protection status: %s ", (csrValue == 0) ? "enabled":"disabled");
verbose("(%s Configuration).\nCsrActiveConfig = 0x%02x (", custom ? "Custom":"Default", csrValue);
// Display integer number into binary using bitwise operator
((csrValue & 0x20) == 0) ? verbose("0"): verbose("1");
while (mask != 0)
{
( ((csrValue & mask) == 0) ? verbose("0"): verbose("1") );
mask = mask >> 1;
}
verbose(")\n");
if (csrValue != 0)
{
verbose("\nConfiguration:\n");
verbose("Kext Signing: %s\n", ((csrValue & 0x01) == 0) ? "enabled":"disabled"); /* (1 << 0) Allow untrusted kexts */
verbose("Filesystem Protections: %s\n", ((csrValue & 0x02) == 0) ? "enabled":"disabled"); /* (1 << 1) Allow unrestricted file system. */
verbose("Task for PID: %s\n", ((csrValue & 0x04) == 0) ? "enabled":"disabled"); /* (1 << 2) */
verbose("Debugging Restrictions: %s\n", ((csrValue & 0x08) == 0) ? "enabled":"disabled"); /* (1 << 3) */
verbose("Apple Internal: %s\n", ((csrValue & 0x10) == 0) ? "enabled":"disabled"); /* (1 << 4) */
verbose("DTrace Restrictions: %s\n", ((csrValue & 0x20) == 0) ? "enabled":"disabled"); /* (1 << 5) Allow unrestricted dtrace */
verbose("NVRAM Protections: %s\n", ((csrValue & 0x40) == 0) ? "enabled":"disabled"); /* (1 << 6) Allow unrestricted NVRAM */
//verbose("DEVICE configuration: %s\n", ((csrValue & 0x80) == 0) ? "enabled":"disabled"); /* (1 << 7) Allow device configuration */
}
verbose("\n");
}
// =========================================================================
/*!
Selects a new BIOS device, taking care to update the global state appropriately.
*/
branches/zenith432/i386/boot2/boot.h
3030
3131
3232
33
3334
3435
3536
......
4748
4849
4950
51
5052
51
53
5254
53
5455
55
56
5657
57
5858
59
60
61
5962
6063
6164
......
188191
189192
190193
191
194
195
192196
197
198
199
193200
194201
195202
......
295302
296303
297304
305
306
307
308
309
310
298311
299312
300313
......
340353
341354
342355
356
357
358
359
360
361
362
363
364
343365
344366
345367
#include "libsaio.h"
// OS X Versions
#define SIERRA checkOSVersion("10.12") // Sierra
#define ELCAPITAN checkOSVersion("10.11") // El Capitan
#define YOSEMITE checkOSVersion("10.10") // Yosemite
#define MAVERICKS checkOSVersion("10.9") // Mavericks
#define kDefaultCachePathLeo"/System/Library/Caches/com.apple.kernelcaches/"
#define kDefaultCachePathSnow"/System/Library/Caches/com.apple.kext.caches/Startup/"
#define kDefaultCachePathYosemite"/System/Library/PrelinkedKernels/"
#define kDefaultCacheRecoveryHD"/com.apple.recovery.boot/"
// Lion installer
// Lion installer ??
#define kLionInstallerDataFolder"/Mac OS X Install Data/"
#define kLionInstallerPlistkLionInstallerDataFolder "com.apple.Boot.plist"
// Mountain Lion installer
// Mountain Lion installer ??
#define kMLionInstallerDataFolder"/OS X Install Data/"
#define kMLionInstallerPlistkMLionInstallerDataFolder "com.apple.Boot.plist"
// Installer new
#define kDefaultCacheInstallerNew"/.IABootFiles/"
//kernel path
#define kDefaultKernelPathPreYos"/"
#define kDefaultKernelPathForYos"/System/Library/Kernels/" //for Yosemite and El Capitan
#define kHDAEnabler"HDAEnabler"/* pci_setup.c */
#define kHDEFLayoutID"HDEFLayoutID"/* hda.c */
#define kHDAULayoutID"HDAULayoutID"/* hda.c */
#define KCsrActiveConfig"CsrActiveConfig"/* boot.c */
#define kCsrActiveConfig"CsrActiveConfig"/* boot.c */
#define kProductBuildVersion"ProductBuildVersion"/* boot.c */
uint32_t kernelOSVer; /* boot.c */
/* Pike R. Alpha: added this key */
#define kBlackMode"BlackMode"
// Bungo:
extern char gDarwinBuildVerStr[256];
// Micky1979
int gDarwinMajor;
int gDarwinMinor;
int gDarwinRev;
bool useDarwinVersion;
/*!
Hookable function pointer called during the driver loading phase that
allows other code to cause additional drivers to be loaded.
void*work);
*/
/*
* boot.c
*/
bool FlagBlackOption; // <-- This is first set in boot.c into setupBooterArgs function
bool HiDPIOption;
void setupBooterArgs(void);
void csrInfo(int csrValue, bool custom);
struct compressed_kernel_header {
u_int32_t signature;
u_int32_t compress_type;
branches/zenith432/i386/boot2/gui.c
5454
5555
5656
57
57
58
5859
5960
6061
......
7475
7576
7677
78
79
7780
7881
7982
......
9497
9598
9699
100
101
102
103
104
105
106
107
108
109
110
111
112
97113
98114
99115
......
149165
150166
151167
152
168
169
153170
154171
155172
......
169186
170187
171188
189
190
172191
173192
174193
......
189208
190209
191210
211
212
213
214
215
216
217
218
219
220
221
222
223
192224
193225
194226
......
397429
398430
399431
432
433
400434
401435
402436
......
416450
417451
418452
453
454
419455
420456
421457
......
10881124
10891125
10901126
1127
1128
1129
1130
10911131
10921132
10931133
iDeviceGeneric_o,
iDeviceHFS,
iDeviceHFS_o,
iDeviceHFS_sie,
iDeviceHFS_sie_o,
iDeviceHFS_cap,
iDeviceHFS_cap_o,
iDeviceHFS_yos,
iDeviceHFSRAID,
iDeviceHFSRAID_o,
iDeviceHFSRAID_sie,
iDeviceHFSRAID_sie_o,
iDeviceHFSRAID_cap,
iDeviceHFSRAID_cap_o,
iDeviceHFSRAID_yos,
iDeviceHFSRECOVERY,
iDeviceHFSRECOVERY_o,
iDeviceHFSFUSION,
iDeviceHFSFUSION_o,
iDeviceHFSFUSION_sie,
iDeviceHFSFUSION_sie_o,
iDeviceHFSFUSION_cap,
iDeviceHFSFUSION_cap_o,
iDeviceHFSFUSION_yos,
iDeviceHFSFUSION_yos_o,
iDeviceHFSFUSION_mav,
iDeviceHFSFUSION_mav_o,
iDeviceHFSFUSION_ML,
iDeviceHFSFUSION_ML_o,
iDeviceEXT3,
iDeviceEXT3_o,
iDeviceFreeBSD, /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
{.name = "device_generic_o", .image = NULL},
{.name = "device_hfsplus", .image = NULL},
{.name = "device_hfsplus_o", .image = NULL},
{.name = "device_hfsplus_sie", .image = NULL},
{.name = "device_hfsplus_sie_o", .image = NULL},
{.name = "device_hfsplus_cap", .image = NULL},
{.name = "device_hfsplus_cap_o", .image = NULL},
{.name = "device_hfsplus_yos", .image = NULL},
{.name = "device_hfsraid", .image = NULL},
{.name = "device_hfsraid_o", .image = NULL},
{.name = "device_hfsraid_sie", .image = NULL},
{.name = "device_hfsraid_sie_o", .image = NULL},
{.name = "device_hfsraid_cap", .image = NULL},
{.name = "device_hfsraid_cap_o", .image = NULL},
{.name = "device_hfsraid_yos", .image = NULL},
{.name = "device_hfsplus_recovery", .image = NULL},
{.name = "device_hfsplus_recovery_o", .image = NULL},
{.name = "device_hfsfusion", .image = NULL},
{.name = "device_hfsfusion_o", .image = NULL},
{.name = "device_hfsfusion_sie", .image = NULL},
{.name = "device_hfsfusion_sie_o", .image = NULL},
{.name = "device_hfsfusion_cap", .image = NULL},
{.name = "device_hfsfusion_cap_o", .image = NULL},
{.name = "device_hfsfusion_yos", .image = NULL},
{.name = "device_hfsfusion_yos_o", .image = NULL},
{.name = "device_hfsfusion_mav", .image = NULL},
{.name = "device_hfsfusion_mav_o", .image = NULL},
{.name = "device_hfsfusion_ml", .image = NULL},
{.name = "device_hfsfusion_ml_o", .image = NULL},
{.name = "device_ext3", .image = NULL},
{.name = "device_ext3_o", .image = NULL},
{.name = "device_freebsd", .image = NULL}, /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
LOADPNG(device_hfsplus, iDeviceGeneric);
LOADPNG(device_hfsplus_o, iDeviceHFS);
LOADPNG(device_hfsplus_sie, iDeviceHFS);
LOADPNG(device_hfsplus_sie_o, iDeviceHFS_sie);
LOADPNG(device_hfsplus_cap, iDeviceHFS);
LOADPNG(device_hfsplus_cap_o, iDeviceHFS_cap);
LOADPNG(device_hfsplus_yos, iDeviceHFS);
LOADPNG(device_hfsraid, iDeviceHFS);
LOADPNG(device_hfsraid_o, iDeviceHFSRAID);
LOADPNG(device_hfsraid_sie, iDeviceHFSRAID);
LOADPNG(device_hfsraid_sie_o, iDeviceHFSRAID_sie);
LOADPNG(device_hfsraid_cap, iDeviceHFSRAID);
LOADPNG(device_hfsraid_cap_o, iDeviceHFSRAID_cap);
LOADPNG(device_hfsraid_yos, iDeviceHFSRAID);
devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID_cap : iDeviceHFS_cap); // El Capitan
break;
}
if (device->OSVersion[4] == '2') { // 10.12
devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID_sie : iDeviceHFS_sie); // Sierra
break;
}
default:
devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID : iDeviceHFS);
break;
branches/zenith432/i386/boot2/options.c
13911391
13921392
13931393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
13941450
13951451
13961452
addBootArg("kext-dev-mode=1");
}
// Micky1979 (Recovery HD)
if (gBootVolume->OSisRecovery)
{
const char*rval = 0;
config_file_t ocBplist;
char caBp[1024]; //too large ?. On El capitan is 365 bytes.. but we are testing
snprintf(caBp, sizeof(caBp), "/com.apple.recovery.boot/com.apple.Boot.plist");
loadConfigFile(caBp, &ocBplist);
rval = getStringForKey(kKernelFlagsKey, &ocBplist);
addBootArg(rval);
}
// Micky1979 (Vanilla Installer)
if (gBootVolume->OSisInstaller)
{
const char*rval = 0;
config_file_t ocBplist;
char caBp[2048];
snprintf(caBp, sizeof(caBp), "/.IABootFiles/com.apple.Boot.plist");
loadConfigFile(caBp, &ocBplist);
rval = getStringForKey(kKernelFlagsKey, &ocBplist);
addBootArg(rval);
}
// Micky1979 (old Vanilla upgrade)
if (gBootVolume->OSisMacOSXUpgrade)
{
const char*rval = 0;
config_file_t ocBplist;
char caBp[2048];
snprintf(caBp, sizeof(caBp), "/Mac OS X Install Data/com.apple.Boot.plist");
loadConfigFile(caBp, &ocBplist);
rval = getStringForKey(kKernelFlagsKey, &ocBplist);
addBootArg(rval);
}
// Micky1979 (new Vanilla upgrade)
if (gBootVolume->OSisMacOSXUpgrade)
{
const char*rval = 0;
config_file_t ocBplist;
char caBp[2048];
snprintf(caBp, sizeof(caBp), "/OS X Install Data/com.apple.Boot.plist");
loadConfigFile(caBp, &ocBplist);
rval = getStringForKey(kKernelFlagsKey, &ocBplist);
addBootArg(rval);
}
cntRemaining = BOOT_STRING_LEN - 2; // save 1 for NULL, 1 for space
argP = bootArgs->CommandLine;
branches/zenith432/i386/libsa/libsa.h
107107
108108
109109
110
111
112
113
110114
111115
112116
extern char*strncat(char * s1, const char * s2, size_t n);
extern char*strdup(const char *s1);
extern char*strpbrk_c(const char *s, const char *accept);
extern char*strsep_c(char **stringp, const char *delim);
extern size_t__strxspn_c(const char *s, const char *map, int parity);
#if STRNCASECMP
extern int strncasecmp(const char *s1, const char *s2, size_t n);
#endif
branches/zenith432/i386/libsa/string.c
411411
412412
413413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
return csum;
}
/*
bsd functions variants (already available in klibc)
strsep, strpbrk and __strxspn
*/
#ifndef UCHAR_MAX
#define UCHAR_MAX255u
#endif
//==========================================================================
char *strsep_c(char **stringp, const char *delim)
{
char *s = *stringp;
char *e;
if (!s)
return NULL;
e = strpbrk_c(s, delim);
if (e)
*e++ = '\0';
*stringp = e;
return s;
}
//==========================================================================
char *strpbrk_c(const char *s, const char *accept)
{
const char *ss = s + __strxspn_c(s, accept, 1);
return *ss ? (char *)ss : NULL;
}
//==========================================================================
size_t __strxspn_c(const char *s, const char *map, int parity)
{
char matchmap[UCHAR_MAX + 1];
size_t n = 0;
/* Create bitmap */
memset(matchmap, 0, sizeof matchmap);
while (*map)
matchmap[(unsigned char)*map++] = 1;
/* Make sure the null character never matches */
matchmap[0] = parity;
/* Calculate span length */
while (matchmap[(unsigned char)*s++] ^ parity)
n++;
return n;
}
//==========================================================================
branches/zenith432/i386/util/boot1-install/Makefile
1818
1919
2020
21
21
22
2223
2324
2425
......
5758
5859
5960
60
61
-Wl,-no_function_starts \
-Wl,-no_data_in_code_info \
-Wl,-no_version_load_command \
-Wl,-no_uuid
-Wl,-no_uuid \
-Wl,-no_dependent_dr_info
CFLAGS := $(CFLAGS) -mmacosx-version-min=10.5
clean-local:
@for o in $(OBJS); do if [ -f "$${o}" ];then echo "[RM] $${o}"; fi; done
@for p in $(SYMPROG); do if [ -f "$${p}" ];then echo "[RM] $${p}"; fi; done
@rm -f $(SYMPROG) $(OBJS)
@rm -f $(SYMPROG) $(OBJS)

Archive Download the corresponding diff file

Revision: 2848