Chameleon

Chameleon Commit Details

Date:2019-07-12 18:53:40 (4 years 9 months ago)
Author:ErmaC
Commit:2922
Parents: 2921
Message:Few update to kernelPatcher (Credits to CrazyBirdy)
Changes:
M/branches/ErmaC/Enoch/i386/boot2/drivers.c
M/branches/ErmaC/Enoch/i386/boot2/kernel_patcher_internal.c
M/branches/ErmaC/Enoch/i386/boot2/boot.c
M/branches/ErmaC/Enoch/i386/boot2/gui.c
M/branches/ErmaC/Enoch/Make.rules
M/branches/ErmaC/Enoch/i386/libsaio/disk.c
M/branches/ErmaC/Enoch/i386/boot2/boot.h

File differences

branches/ErmaC/Enoch/i386/libsaio/disk.c
17091709
17101710
17111711
1712
17121713
1714
17131715
1716
17141717
17151718
17161719
1720
1721
1722
17171723
17181724
17191725
......
17961802
17971803
17981804
1799
1805
18001806
18011807
18021808
18031809
18041810
1805
1811
18061812
18071813
18081814
18091815
18101816
1811
1817
18121818
18131819
18141820
18151821
18161822
1817
1823
18181824
18191825
18201826
18211827
18221828
1823
1829
18241830
1825
1826
1831
1832
18271833
18281834
1829
1835
18301836
1831
1832
1837
1838
18331839
18341840
18351841
char *MLPattern= "Install%20OS%20X%20Mountain%20Lion";// Install OS X Mountain Lion
char *MavPattern= "Install%20OS%20X%20Mavericks";// Install OS X Mavericks
char *YosPattern= "Install%20OS%20X%20Yosemite";// Install OS X Yosemite
char *YosPatternB= "Install%20OS%20X%2010.10";// Install OS X 10.10
char *ECPattern= "Install%20OS%20X%20El%20Capitan";// Install OS X El Capitan
char *ECPatternB= "Install%20OS%20X%2010.11";// Install OS X 10.11
char *SierraPattern= "Install%20macOS%20Sierra";// Install macOS Sierra
char *SierraPatternB= "Install%20macOS%20X%2010.12";// Install macOS 10.12
char *HSierraPattern= "Install%20macOS%20High%20Sierra";// Install macOS High Sierra
char *HSierraPatternB= "Install%20macOS%2010.13";// Install macOS 10.13
char *MojavePattern= "Install%20macOS%20Mojave";// Install macOS Mojave
char *MojavePatternB= "Install%20macOS%2010.14";// Install macOS 10.14
char *CatalinaPattern= "Install%20macOS%20Catalina";// Install macOS Catalina
char *CatalinaPatternB= "Install%20macOS%2010.15";// Install macOS 10.15
/*
* Only look for OS Version on HFS+
fakeOSVersionInt = 9;
valid = true;
}
else if(strstr(val, YosPattern))
else if( strstr(val, YosPattern) || strstr(val, YosPatternB) )
{
fakeOSVersion = "10.10";
fakeOSVersionInt = 10;
valid = true;
}
else if(strstr(val, ECPattern))
else if( strstr(val, ECPattern) || strstr(val, ECPatternB) )
{
fakeOSVersion = "10.11";
fakeOSVersionInt = 11;
valid = true;
}
else if(strstr(val, SierraPattern))
else if( strstr(val, SierraPattern) || strstr(val, SierraPatternB) )
{
fakeOSVersion = "10.12";
fakeOSVersionInt = 12;
valid = true;
}
else if(strstr(val, HSierraPattern))
else if( strstr(val, HSierraPattern) || strstr(val, HSierraPatternB) )
{
fakeOSVersion = "10.13";
fakeOSVersionInt = 13;
valid = true;
}
else if(strstr(val, HSierraPatternB))
else if( strstr(val, MojavePattern) || strstr(val, MojavePatternB) )
{
fakeOSVersion = "10.13";
fakeOSVersionInt = 13;
fakeOSVersion = "10.14";
fakeOSVersionInt = 14;
valid = true;
}
else if(strstr(val, MojavePattern))
else if( strstr(val, CatalinaPattern) || strstr(val, CatalinaPatternB) )
{
fakeOSVersion = "10.14";
fakeOSVersionInt = 14;
fakeOSVersion = "10.15";
fakeOSVersionInt = 15;
valid = true;
}
else
branches/ErmaC/Enoch/i386/boot2/drivers.c
15511551
15521552
15531553
1554
15551554
15561555
15571556
......
15591558
15601559
15611560
1562
1563
1564
1565
1566
1567
1568
1569
1570
1561
1562
1563
1564
1565
1566
1567
1568
15711569
15721570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
15731599
1574
1575
1600
1601
15761602
15771603
15781604
......
16331659
16341660
16351661
1636
16371662
16381663
1639
1664
1665
1666
1667
1668
1669
16401670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
16411681
16421682
1643
1683
16441684
16451685
16461686
case 5: kernelOSVer = 0xA0C0400; break;
case 6: kernelOSVer = 0xA0C0500; break;
case 7: kernelOSVer = 0xA0C0600; break;
//case 8: kernelOSVer = 0xA0C0700; break;
default:kernelOSVer = 0xA0C0600; break; //Last known kernel (add here updates)
}
break;
switch (gDarwinMinor)
{
case 0: kernelOSVer = 0xA0D0000; break;
case 1: kernelOSVer = 0xA0D0100; break;
//case 2: kernelOSVer = 0xA0D0200; break; // 17.2.0
//case 3: kernelOSVer = 0xA0C0200; break;
//case 4: kernelOSVer = 0xA0C0300; break;
//case 5: kernelOSVer = 0xA0C0400; break;
//case 6: kernelOSVer = 0xA0C0500; break;
//case 7: kernelOSVer = 0xA0C0600; break;
//case 8: kernelOSVer = 0xA0C0700; break;
default:kernelOSVer = 0xA0D0100; break; //Last known kernel (add here updates)
case 1: kernelOSVer = 0xA0D0100; break; // 17.2.0
case 2: kernelOSVer = 0xA0D0200; break;
case 3: kernelOSVer = 0xA0D0300; break;
case 4: kernelOSVer = 0xA0D0400; break;
case 5: kernelOSVer = 0xA0D0500; break;
case 6: kernelOSVer = 0xA0D0600; break;
case 7: kernelOSVer = 0xA0D0700; break;
default:kernelOSVer = 0xA0D0700; break; //Last known kernel (add here updates)
}
break;
case 18: /* Mojave */
switch (gDarwinMinor)
{
case 0: kernelOSVer = 0xA0E0000; break;
case 1: kernelOSVer = 0xA0E0100; break;
case 2: kernelOSVer = 0xA0E0200; break;
case 3: kernelOSVer = 0xA0E0300; break;
case 4: kernelOSVer = 0xA0E0400; break;
case 5: kernelOSVer = 0xA0E0500; break;
case 6: kernelOSVer = 0xA0E0600; break;
case 7: kernelOSVer = 0xA0E0700; break;
default:kernelOSVer = 0xA0E0700; break; //Last known kernel (add here updates)
}
break;
case 19: /* Catalina */
switch (gDarwinMinor)
{
case 0: kernelOSVer = 0xA0F0000; break;
//case 1: kernelOSVer = 0xA0F0100; break;
//case 2: kernelOSVer = 0xA0F0200; break;
//case 3: kernelOSVer = 0xA0F0300; break;
//case 4: kernelOSVer = 0xA0F0400; break;
//case 5: kernelOSVer = 0xA0F0500; break;
//case 6: kernelOSVer = 0xA0F0600; break;
//case 7: kernelOSVer = 0xA0F0700; break;
default:kernelOSVer = 0xA0F0000; break; //Last known kernel (add here updates)
}
break;
default:
kernelOSVer = 0xA0D0100;
break; //Last known kernel is Sierra 10.13.1
kernelOSVer = 0xA0F0000;
break; //Last known kernel is Sierra 10.15
}
}
else
case 0xA0C0400: gDarwinMajor = 16; gDarwinMinor = 5; gDarwinRev = 0; break; // 10.12.4
case 0xA0C0500: gDarwinMajor = 16; gDarwinMinor = 6; gDarwinRev = 0; break; // 10.12.5
case 0xA0C0600: gDarwinMajor = 16; gDarwinMinor = 7; gDarwinRev = 0; break; // 10.12.6
//case 0xA0C0700: gDarwinMajor = 16; gDarwinMinor = x; gDarwinRev = x; break; // 10.12.7
// High Sierra
case 0xA0D0000: gDarwinMajor = 17; gDarwinMinor = 0; gDarwinRev = 0; break; // 10.13
case 0xA0D0100: gDarwinMajor = 17; gDarwinMinor = 1; gDarwinRev = 0; break; // 10.13.1
case 0xA0D0100: gDarwinMajor = 17; gDarwinMinor = 2; gDarwinRev = 0; break; // 10.13.1
case 0xA0D0200: gDarwinMajor = 17; gDarwinMinor = 3; gDarwinRev = 0; break; // 10.13.2
case 0xA0D0300: gDarwinMajor = 17; gDarwinMinor = 4; gDarwinRev = 0; break; // 10.13.3
case 0xA0D0400: gDarwinMajor = 17; gDarwinMinor = 5; gDarwinRev = 0; break; // 10.13.4
case 0xA0D0500: gDarwinMajor = 17; gDarwinMinor = 6; gDarwinRev = 0; break; // 10.13.5
case 0xA0D0600: gDarwinMajor = 17; gDarwinMinor = 7; gDarwinRev = 0; break; // 10.13.6
// Mojave
case 0xA0E0000: gDarwinMajor = 18; gDarwinMinor = 0; gDarwinRev = 0; break; // 10.14
case 0xA0E0100: gDarwinMajor = 18; gDarwinMinor = 2; gDarwinRev = 0; break; // 10.14.1
case 0xA0E0200: gDarwinMajor = 18; gDarwinMinor = 2; gDarwinRev = 0; break; // 10.14.2
case 0xA0E0300: gDarwinMajor = 18; gDarwinMinor = 2; gDarwinRev = 0; break; // 10.14.3
case 0xA0E0400: gDarwinMajor = 18; gDarwinMinor = 5; gDarwinRev = 0; break; // 10.14.4
case 0xA0E0500: gDarwinMajor = 18; gDarwinMinor = 6; gDarwinRev = 0; break; // 10.14.5
case 0xA0E0600: gDarwinMajor = 18; gDarwinMinor = 7; gDarwinRev = 0; break; // 10.14.6
// Catalina
case 0xA0F0000: gDarwinMajor = 19; gDarwinMinor = 0; gDarwinRev = 0; break; // 10.15
//case 0xA0F0100: gDarwinMajor = 19; gDarwinMinor = 1; gDarwinRev = 0; break; // 10.15.1
// default = last known kernel
default: gDarwinMajor = 17; gDarwinMinor = 1; gDarwinRev = 0; break; // 10.13.1;
default: gDarwinMajor = 19; gDarwinMinor = 0; gDarwinRev = 0; break; // 10.15
}
}
branches/ErmaC/Enoch/i386/boot2/boot.c
422422
423423
424424
425
425
426426
427427
428428
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", kMLionInstallerDataFolder);
}
else if ( MacOSVerCurrent > MacOSVer2Int("10.12") && MacOSVerCurrent < MacOSVer2Int("10.14") )
else if ( MacOSVerCurrent > MacOSVer2Int("10.12") && MacOSVerCurrent < MacOSVer2Int("10.16") )
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", kHSierraInstallerDataFolder);
}
branches/ErmaC/Enoch/i386/boot2/boot.h
3030
3131
3232
33
3334
3435
3536
#include "libsaio.h"
// OS X Versions
#define CATALINA checkOSVersion("10.15") // Catalina
#define MOJAVE checkOSVersion("10.14") // Mojave
#define HSIERRA checkOSVersion("10.13") // High Sierra
#define SIERRA checkOSVersion("10.12") // Sierra
branches/ErmaC/Enoch/i386/boot2/kernel_patcher_internal.c
5757
5858
5959
60
6160
6261
6362
......
118117
119118
120119
121
122
123
124
125
126
127120
128121
129122
......
447440
448441
449442
450
451
452
453
454
455
456443
457444
458445
......
667654
668655
669656
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812657
813658
814659
......
816661
817662
818663
664
819665
666
820667
821668
822669
......
841688
842689
843690
844
691
845692
846693
847694
......
863710
864711
865712
866
713
867714
868715
869716
......
885732
886733
887734
888
735
889736
890737
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
1006773
1007774
1008775
......
1019786
1020787
1021788
1022
789
1023790
1024
1025
791
792
793
794
1026795
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
1055
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
796
1082797
1083
798
799
800
801
802
803
804
805
806
807
808
809
1084810
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
1104870
1105871
1106872
......
13781144
13791145
13801146
1147
1148
1149
1150
1151
1152
1153
13811154
13821155
13831156
......
13891162
13901163
13911164
1392
1393
1394
1165
1166
1167
13951168
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
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
14301197
14311198
1432
1433
1199
1200
14341201
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
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
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
14581253
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
16311254
16321255
16331256
......
21951818
21961819
21971820
2198
1821
1822
1823
21991824
22001825
22011826
......
22481873
22491874
22501875
2251
1876
1877
1878
22521879
22531880
22541881
verbose("\tKernelBooter_kexts state: %s!\n", KernelBooter_kexts ? " enabled" : "disabled");
verbose("\tKernelPm state: %s!\n", KernelPm ? " enabled" : "disabled");
verbose("\tKernelLapicError state: %s!\n", KernelLapicError ? " enabled" : "disabled");
verbose("\tKernelLapicVersion state: %s!\n", KernelLapicVersion ? " enabled" : "disabled");
verbose("\tKernelHaswell state: %s!\n", KernelHaswell ? " enabled" : "disabled");
verbose("\tKernelcpuFamily state: %s!\n", KernelcpuFamily ? " enabled" : "disabled");
verbose("\tKernelSSE3 state: %s!\n", KernelSSE3 ? " enabled" : "disabled");
verbose("\tLapic Error call removed.\n");
}
// Lapic Version
if (KernelLapicVersion && patch_lapic_version_init_64(kernelData))
{
verbose("\tLapic Version call removed.\n");
}
// Power Managment
if (KernelPm && patch_pm_init(kernelData))
{
verbose("\tLapic Error call removed.\n");
}
// Lapic Version
if (KernelLapicVersion && patch_lapic_version_init_32(kernelData))
{
verbose("\tLapic Version call removed.\n");
}
if (KernelcpuFamily)
{
verbose("\t- Looking for _cpuid_set_info _panic ...\n");
}
// ===================================
// Bronya: Lapic Panic Version 64
bool patch_lapic_version_init_64(void *kernelData) // KernelLapicVersionPatch_64
{
UInt8 *bytes = (UInt8 *)kernelData;
UInt32 patchLocation = 0;
UInt32 i;
verbose("\t- Looking for Lapic Version panic call Start\n");
for (i = 0; i < 0x1000000; i++)
{
// Bronya: Snow Leopard 10.6 Lapic Version
if (bytes[i + 0] == 0x48
&& bytes[i + 1] == 0x0f
&& bytes[i + 2] == 0x44
&& bytes[i + 3] == 0xc2
&& bytes[i + 57] == 0x31
&& bytes[i + 58] == 0xc0)
{
patchLocation = i + 59;
verbose("\tFound Snow Leopard Lapic panic at 0x%08X\n", (unsigned int)patchLocation);
break;
}
// Bronya: Lion 10.7 Lapic Version
else if (bytes[i + 0] == 0x48
&& bytes[i + 1] == 0x0f
&& bytes[i + 2] == 0x44
&& bytes[i + 3] == 0xc8
&& bytes[i + 61] == 0x30
&& bytes[i + 62] == 0xc0
&& bytes[i + 63] == 0xe8)
{
patchLocation = i + 63;
verbose("\tFound Lion, Lapic Version panic at 0x%08X\n", (unsigned int)patchLocation);
break;
}
// Bronya: Mountain Lion 10.8 Lapic Version
else if (bytes[i + 0] == 0x45
&& bytes[i + 1] == 0x85
&& bytes[i + 2] == 0xf6
&& bytes[i + 3] == 0x48
&& bytes[i + 4] == 0x0f
&& bytes[i + 5] == 0x45
&& bytes[i + 6] == 0xc1
&& bytes[i + 68] == 0xe8
&& bytes[i + 69] == 0x3d
&& bytes[i + 70] == 0x15
&& bytes[i + 71] == 0xf6
&& bytes[i + 72] == 0xff)
{
patchLocation = i + 68;
verbose("\tFound Mountain Lion, Lapic Version panic at 0x%08X\n", (unsigned int)patchLocation);
break;
}
// Bronya: Mavericks 10.9 Lapic Version
else if (bytes[i + 0] == 0xff
&& bytes[i + 1] == 0x50
&& bytes[i + 2] == 0x08
&& bytes[i + 3] == 0x89
&& bytes[i + 4] == 0xc3
&& bytes[i + 90] == 0xe8
&& bytes[i + 91] == 0x02
&& bytes[i + 92] == 0x17
&& bytes[i + 93] == 0xf4
&& bytes[i + 94] == 0xff)
{
patchLocation = i + 90;
verbose("\tFound Mavericks Lapic Version panic at 0x%08X\n", (unsigned int)patchLocation);
break;
}
// Bronya: Yosemite 10.10 lapic version
else if (bytes[i + 0] == 0xff
&& bytes[i + 1] == 0x50
&& bytes[i + 2] == 0x08
&& bytes[i + 38] == 0x31
&& bytes[i + 39] == 0xdb
&& bytes[i + 40] == 0x31
&& bytes[i + 41] == 0xc0)
{
patchLocation = i + 42;
verbose("\tFound Yosemite Lapic Version panic at 0x%08X\n", (unsigned int)patchLocation);
break;
}
// Bronya: El Capitan 10.11 Lapic Version/10.12/10.13
else if (bytes[i + 0] == 0xff
&& bytes[i + 1] == 0x50
&& bytes[i + 2] == 0x08
&& bytes[i + 38] == 0x31
&& bytes[i + 39] == 0xc0)
{
patchLocation = i + 40;
if (kernelOSVer >= MacOSVer2Int("10.14") && kernelOSVer < MacOSVer2Int("10.15"))
{
verbose("\tFound Mojave Lapic Version panic at 0x%08X\n", (unsigned int)patchLocation);
}
else if (kernelOSVer >= MacOSVer2Int("10.13") && kernelOSVer < MacOSVer2Int("10.14"))
{
verbose("\tFound High Sierra Lapic Version panic at 0x%08X\n", (unsigned int)patchLocation);
}
else if (kernelOSVer >= MacOSVer2Int("10.12") && kernelOSVer < MacOSVer2Int("10.13"))
{
verbose("\tFound Sierra Lapic Version panic at 0x%08X\n", (unsigned int)patchLocation);
}
else
{
verbose("\tFound El Capitan Lapic Version panic at 0x%08X\n", (unsigned int)patchLocation);
}
break;
}
}
if (!patchLocation)
{
verbose("\tCan't find Lapic Version panic, kernel patch aborted.\n");
return false;
}
// Already patched? May be running a non-vanilla kernel already?
if (bytes[patchLocation + 0] == 0x90
&& bytes[patchLocation + 1] == 0x90
&& bytes[patchLocation + 2] == 0x90
&& bytes[patchLocation + 3] == 0x90
&& bytes[patchLocation + 4] == 0x90)
{
verbose("\tLapic Version panic already patched, kernel file manually patched?\n");
return false;
}
else
{
bytes[patchLocation + 0] = 0x90;
bytes[patchLocation + 1] = 0x90;
bytes[patchLocation + 2] = 0x90;
bytes[patchLocation + 3] = 0x90;
bytes[patchLocation + 4] = 0x90;
}
return true;
}
// ===================================
// Lapic Error Panic 64
bool patch_lapic_init_64(void *kernelData) // KernelLapicPatch_64
{
UInt8 *bytes = (UInt8 *)kernelData;
UInt32 patchLocation = 0;
UInt32 patchLocation2 = 0;
UInt32 i;
UInt32 y;
verbose("\t- Looking for Lapic panic call Start\n");
&& bytes[i + 52] == 0x00))
{
patchLocation = i + 40;
verbose("\tFound Snow Leopard Lapic panic at 0x%08X\n", (unsigned int)patchLocation);
verbose("\tFound Lapic panic (10.6) at 0x%08X\n", (unsigned int)patchLocation);
break;
}
else if (KernelLapicError
&& bytes[i + 42] == 0x00))
{
patchLocation = i + 30;
verbose("\tFound %sLion Lapic panic at 0x%08X\n", checkOSVersion("10.7") ? "" : "Mountain ", (unsigned int)patchLocation);
verbose("\tFound Lapic panic (10.7 - 10.8) at 0x%08X\n", (unsigned int)patchLocation);
break;
}
else if (KernelLapicError
&& bytes[i + 43] == 0x00))
{
patchLocation = i + 31;
verbose("\tFound Mavericks Lapic panic at 0x%08X\n", (unsigned int)patchLocation);
verbose("\tFound Lapic panic (10.9) at 0x%08X\n", (unsigned int)patchLocation);
break;
}
// RehabMan: 10.10.DP1 lapic
else if (KernelLapicError
&& (bytes[i + 0] == 0x65
&& bytes[i + 1] == 0x8B
&& bytes[i + 2] == 0x04
&& bytes[i + 3] == 0x25
&& bytes[i + 4] == 0x1C
&& bytes[i + 5] == 0x00
&& bytes[i + 6] == 0x00
&& bytes[i + 7] == 0x00
&& bytes[i + 33] == 0x65
&& bytes[i + 34] == 0x8B
&& bytes[i + 35] == 0x04
&& bytes[i + 36] == 0x25
&& bytes[i + 37] == 0x1C
&& bytes[i + 38] == 0x00
&& bytes[i + 39] == 0x00
&& bytes[i + 40] == 0x00))
{
patchLocation = i + 28;
verbose("\tFound Yosemite Lapic panic at 0x%08X\n", (unsigned int)patchLocation);
break;
}
// Sherlocks: 10.11.DP1
else if (KernelLapicError
&& (bytes[i + 0] == 0x65
&& bytes[i + 1] == 0x8B
&& bytes[i + 2] == 0x0C
&& bytes[i + 3] == 0x25
&& bytes[i + 4] == 0x1C
&& bytes[i + 5] == 0x00
&& bytes[i + 6] == 0x00
&& bytes[i + 7] == 0x00
&& bytes[i + 1411] == 0x65
&& bytes[i + 1412] == 0x8B
&& bytes[i + 1413] == 0x0C
&& bytes[i + 1414] == 0x25
&& bytes[i + 1415] == 0x1C
&& bytes[i + 1416] == 0x00
&& bytes[i + 1417] == 0x00
&& bytes[i + 1418] == 0x00))
{
patchLocation = i + 1400;
verbose("\tFound El Capitan Lapic panic at 0x%08X\n", (unsigned int)patchLocation);
break;
}
// Sherlocks: 10.12.DP1
else if (KernelLapicError
&& (bytes[i+0] == 0x65
&& bytes[i+1] == 0x8B
&& bytes[i+2] == 0x0C
&& bytes[i+3] == 0x25
&& bytes[i+4] == 0x1C
&& bytes[i+5] == 0x00
&& bytes[i+6] == 0x00
&& bytes[i+7] == 0x00
&& bytes[i+1409] == 0x65
&& bytes[i+1410] == 0x8B
&& bytes[i+1411] == 0x0C
&& bytes[i+1412] == 0x25
&& bytes[i+1413] == 0x1C
&& bytes[i+1414] == 0x00
&& bytes[i+1415] == 0x00
&& bytes[i+1416] == 0x00))
{
patchLocation = i+1398;
verbose("\tFound Sierra Lapic panic at 0x%08X\n", (unsigned int)patchLocation);
break;
}
// PMheart: 10.13.DP1
else if (KernelLapicError
&& (bytes[i+0] == 0x65
&& bytes[i+1] == 0x8B
&& bytes[i+2] == 0x0C
&& bytes[i+3] == 0x25
&& bytes[i+4] == 0x1C
&& bytes[i+5] == 0x00
&& bytes[i+6] == 0x00
&& bytes[i+7] == 0x00
&& bytes[i+1407] == 0x65
&& bytes[i+1408] == 0x8B
&& bytes[i+1409] == 0x0C
&& bytes[i+1410] == 0x25
&& bytes[i+1411] == 0x1C
&& bytes[i+1412] == 0x00
&& bytes[i+1413] == 0x00
&& bytes[i+1414] == 0x00))
{
patchLocation = i+1396;
verbose("\tFound High Sierra Lapic panic at 0x%08X\n", (unsigned int)patchLocation);
break;
}
// PMheart: 10.14.DP1
else if (KernelLapicError
&& (bytes[i+0] == 0x65
&& bytes[i+1] == 0x8B
&& bytes[i+2] == 0x0C
&& bytes[i+3] == 0x25
&& bytes[i+4] == 0x1C
&& bytes[i+5] == 0x00
&& bytes[i+6] == 0x00
&& bytes[i+7] == 0x00
&& bytes[i+1396] == 0x65
&& bytes[i+1397] == 0x8B
&& bytes[i+1398] == 0x0C
&& bytes[i+1399] == 0x25
&& bytes[i+1400] == 0x1C
&& bytes[i+1401] == 0x00
&& bytes[i+1402] == 0x00
&& bytes[i+1403] == 0x00))
{
patchLocation = i+1385;
verbose("\tFound Mojave Lapic panic at 0x%08X\n", (unsigned int)patchLocation);
break;
}
// 00 29 C7 78 XX 31 DB 8D 47 FA 83
else if (bytes[i+0] == 0x00
&& bytes[i+1] == 0x29
&& bytes[i+2] == 0xC7
&& bytes[i+3] == 0x78
//(bytes[i+4] == 0x3F || bytes[i+4] == 0x4F) && // 3F:10.10-10.12/4F:10.13+
&& bytes[i+5] == 0x31
&& bytes[i+6] == 0xDB
&& bytes[i+7] == 0x8D
&& bytes[i+8] == 0x47
&& bytes[i+9] == 0xFA
&& bytes[i+10] == 0x83) {
for (y = i; y < 0x1000000; y++) {
// Lapic panic patch, by vit9696
// mov eax, gs:1Ch
// cmp eax, cs:_master_cpu
// 65 8B 04 25 1C 00 00 00 3B 05 XX XX XX 00
if (bytes[y+0] == 0x65
&& bytes[y+1] == 0x8B
&& bytes[y+2] == 0x04
&& bytes[y+3] == 0x25
&& bytes[y+4] == 0x1C
&& bytes[y+5] == 0x00
&& bytes[y+6] == 0x00
&& bytes[y+7] == 0x00
&& bytes[y+8] == 0x3B
&& bytes[y+9] == 0x05
&& bytes[y+13] == 0x00) {
patchLocation = y;
verbose("\tFound Lapic panic (10.10 - recent macOS) at 0x%08X\n", (unsigned int)patchLocation);
break;
}
}
break;
}
}
if (!patchLocation)
&& bytes[patchLocation + 3] == 0x90
&& bytes[patchLocation + 4] == 0x90)
{
verbose("\tLapic panic already patched, kernel file manually patched?\n");
verbose("\tLapic panic already patched, kernel file (10.6 - 10.9) manually patched?\n");
return false;
}
else
} else if (bytes[patchLocation + 0] == 0x31
&& bytes[patchLocation + 1] == 0xC0
&& bytes[patchLocation + 2] == 0x90
&& bytes[patchLocation + 3] == 0x90)
{
bytes[patchLocation + 0] = 0x90;
bytes[patchLocation + 1] = 0x90;
bytes[patchLocation + 2] = 0x90;
bytes[patchLocation + 3] = 0x90;
bytes[patchLocation + 4] = 0x90;
}
return true;
}
// ===================================
// Bronya: Lapic Panic Version 32 bit
bool patch_lapic_version_init_32(void *kernelData)
{
UInt8 *bytes = (UInt8 *)kernelData;
UInt32 patchLocation = 0;
UInt32 i;
verbose("\t- Looking for Lapic Version panic call Start\n");
for (i = 0; i < 0x1000000; i++)
{
// Bronya: Snow Leopard 10.6 Lapic Version
if (bytes[i + 0] == 0x0f
&& bytes[i + 1] == 0x44
&& bytes[i + 2] == 0xc2
&& bytes[i + 49] == 0x89
&& bytes[i + 50] == 0x44
&& bytes[i + 51] == 0x24
&& bytes[i + 52] == 0x04)
{
patchLocation = i+60;
verbose("\tFound Snow Leopard Lapic Version panic at 0x%08X\n", (unsigned int)patchLocation);
break;
}
else
{
// Bronya: Lion 10.7 Lapic Version
if (bytes[i + 0] == 0x0f
&& bytes[i + 1] == 0x44
&& bytes[i + 2] == 0xc8
&& bytes[i + 52] == 0x89
&& bytes[i + 53] == 0x44
&& bytes[i + 54] == 0x24
&& bytes[i + 55] == 0x04)
{
patchLocation = i+63;
verbose("\tFound Lion, Lion Lapic Version panic at 0x%08X\n", (unsigned int)patchLocation);
break;
}
}
}
if (!patchLocation)
{
verbose("\tCan't find Lapic Version panic, kernel patch aborted.\n");
verbose("\tLapic panic already patched, kernel file (10.10 - recent macOS) manually patched?\n");
return false;
}
} else {
if (bytes[patchLocation + 8] == 0x3B
&& bytes[patchLocation + 9] == 0x05
&& bytes[patchLocation + 13] == 0x00) {
// 65 8B 04 25 1C 00 00 00 3B XX XX XX XX 00
// 31 C0 90 90 90 90 90 90 90 90 90 90 90 90
verbose("\tPatched Lapic panic (10.10 - recent macOS)\n");
bytes[patchLocation + 0] = 0x31;
bytes[patchLocation + 1] = 0xC0;
for (i = 2; i < 14; i++) {
bytes[patchLocation + i] = 0x90;
}
// Already patched? May be running a non-vanilla kernel already?
if (bytes[patchLocation + 0] == 0x90
&& bytes[patchLocation + 1] == 0x90
&& bytes[patchLocation + 2] == 0x90
&& bytes[patchLocation + 3] == 0x90
&& bytes[patchLocation + 4] == 0x90)
{
verbose("\tLapic Version panic already patched, kernel file manually patched?\n");
return false;
}
else
{
bytes[patchLocation + 0] = 0x90;
bytes[patchLocation + 1] = 0x90;
bytes[patchLocation + 2] = 0x90;
bytes[patchLocation + 3] = 0x90;
bytes[patchLocation + 4] = 0x90;
}
for (i = 0; i < 0x1000000; i++) {
// 00 29 C7 78 XX 31 DB 8D 47 FA 83
if (bytes[i+0] == 0x00
&& bytes[i+1] == 0x29
&& bytes[i+2] == 0xC7
&& bytes[i+3] == 0x78
//(bytes[i+4] == 0x3F || bytes[i+4] == 0x4F) && // 3F:10.10-10.12/4F:10.13+
&& bytes[i+5] == 0x31
&& bytes[i+6] == 0xDB
&& bytes[i+7] == 0x8D
&& bytes[i+8] == 0x47
&& bytes[i+9] == 0xFA
&& bytes[i+10] == 0x83) {
for (y = i; y < 0x1000000; y++) {
// Lapic panic master patch, by vit9696
// cmp cs:_debug_boot_arg, 0
// E8 XX XX FF FF 83 XX XX XX XX 00 00
if (bytes[y+0] == 0xE8
&& bytes[y+3] == 0xFF
&& bytes[y+4] == 0xFF
&& bytes[y+5] == 0x83
&& bytes[y+10] == 0x00
&& bytes[y+11] == 0x00) {
patchLocation2 = y;
verbose("\tFound Lapic panic master (10.10 - recent macOS) at 0x%08X\n", (unsigned int)patchLocation2);
break;
}
}
break;
}
}
if (!patchLocation2) {
verbose("\tCan't find Lapic panic master (10.10 - recent macOS), kernel patch aborted.\n");
return false;
}
// Already patched? May be running a non-vanilla kernel already?
if (bytes[patchLocation2 + 5] == 0x31
&& bytes[patchLocation2 + 6] == 0xC0) {
verbose("\tLapic panic master already patched, kernel file (10.6 - 10.9) manually patched?\n");
return false;
} else {
verbose("\tPatched Lapic panic master (10.10 - recent macOS)\n");
// E8 XX XX FF FF 83 XX XX XX XX 00 00
// E8 XX XX FF FF 31 C0 90 90 90 90 90
bytes[patchLocation2 + 5] = 0x31;
bytes[patchLocation2 + 6] = 0xC0;
for (i = 7; i < 12; i++) {
bytes[patchLocation2 + i] = 0x90;
}
}
} else {
verbose("\tPatched Lapic panic (10.6 - 10.9)\n");
for (i = 0; i < 5; i++) {
bytes[patchLocation + i] = 0x90;
}
}
}
return true;
}
void patch_BooterExtensions_64(void *kernelData)
{
// Port from Clover 4979
UInt32 i;
UInt32 y;
UInt32 patchLocation = 0;
UInt32 patchLocation2 = 0;
// Port from Clover 4979
// KernelBooterExtensionsPatch to load extra kexts besides kernelcache
UInt8 *Bytes;
UInt32 Index;
Bytes = (UInt8 *)kernelData;
PatchApplied = false;
// High Sierra, Mojave onward, need to use 10.12 instead of 10.13. kernel bug?
// if (kernelOSVer >= MacOSVer2Int("10.13") && kernelOSVer < MacOSVer2Int("10.14"))
if (kernelOSVer >= MacOSVer2Int("10.12"))
// Port from Clover 4979 start.
// EXT - 10.8 - recent macOS
if (kernelOSVer >= MacOSVer2Int("10.8"))
{
for (Index = 0; Index < 0x1000000; ++Index)
{
// High Sierra
if (Bytes[Index] == 0xC3
&& Bytes[Index + 1] == 0x48
&& Bytes[Index + 2] == 0x85
&& Bytes[Index + 3] == 0xDB
&& Bytes[Index + 4] == 0x74
&& Bytes[Index + 5] == 0x69
&& Bytes[Index + 6] == 0x48
&& Bytes[Index + 7] == 0x8B
&& Bytes[Index + 8] == 0x03
&& Bytes[Index + 9] == 0x48
&& Bytes[Index + 10] == 0x89
&& Bytes[Index + 11] == 0xDF
&& Bytes[Index + 12] == 0xFF
&& Bytes[Index + 13] == 0x50
&& Bytes[Index + 14] == 0x28
&& Bytes[Index + 15] == 0x48)
{
Bytes[Index + 4] = 0xEB;
Bytes[Index + 5] = 0x12;
count++;
verbose("\tFound High Sierra, Mojave SIP pattern: patched!\n");
if (PatchApplied)
{
break;
}
PatchApplied = true;
}
}
// EXT - load extra kexts besides kernelcache.
for (i = 0; i < 0x1000000; i++) {
// 01 00 31 FF BE 14 00 05
if (Bytes[i+0] == 0x01 && Bytes[i+1] == 0x00 && Bytes[i+2] == 0x31 &&
Bytes[i+3] == 0xFF && Bytes[i+4] == 0xBE && Bytes[i+5] == 0x14 &&
Bytes[i+6] == 0x00 && Bytes[i+7] == 0x05) {
for (y = i; y < 0x1000000; y++) {
// E8 XX 00 00 00 EB XX XX
if (Bytes[y+0] == 0xE8 && Bytes[y+2] == 0x00 && Bytes[y+3] == 0x00 &&
Bytes[y+4] == 0x00 && Bytes[y+5] == 0xEB) {
//(Bytes[y+7] == 0x48 || Bytes[y+7] == 0xE8)) { // 48:10.8-10.9/E8:10.10+
patchLocation = y;
break;
}
}
break;
}
}
if (patchLocation) {
verbose("\tFound EXT pattern (10.8 - recent macOS): patched!\n");
for (i = 5; i < 7; i++) {
// E8 XX 00 00 00 EB XX
// E8 XX 00 00 00 90 90
Bytes[patchLocation + i] = 0x90;
}
count++;
PatchApplied = true;
}
}
// Sierra
if (kernelOSVer >= MacOSVer2Int("10.12") && kernelOSVer < MacOSVer2Int("10.13"))
// SIP - 10.11 - recent macOS
if (kernelOSVer >= MacOSVer2Int("10.11"))
{
for (Index = 0; Index < 0x1000000; ++Index)
{
// Sierra
if (Bytes[Index] == 0xC3
&& Bytes[Index + 1] == 0x48
&& Bytes[Index + 2] == 0x85
&& Bytes[Index + 3] == 0xDB
&& Bytes[Index + 4] == 0x74
&& Bytes[Index + 5] == 0x71
&& Bytes[Index + 6] == 0x48
&& Bytes[Index + 7] == 0x8B
&& Bytes[Index + 8] == 0x03
&& Bytes[Index + 9] == 0x48
&& Bytes[Index + 10] == 0x89
&& Bytes[Index + 11] == 0xDF
&& Bytes[Index + 12] == 0xFF
&& Bytes[Index + 13] == 0x50
&& Bytes[Index + 14] == 0x28
&& Bytes[Index + 15] == 0x48)
{
Bytes[Index + 4] = 0xEB;
Bytes[Index + 5] = 0x12;
count++;
// SIP - bypass kext check by System Integrity Protection.
for (i = 0; i < 0x1000000; ++i) {
// 45 31 FF 41 XX 01 00 00 DC 48
if (Bytes[i + 0] == 0x45 && Bytes[i + 1] == 0x31 && Bytes[i + 3] == 0x41 &&
//(Bytes[i + 4] == 0xBF || Bytes[i + 4] == 0xBE) && // BF:10.11/BE:10.12+
Bytes[i + 5] == 0x01 && Bytes[i + 6] == 0x00 && Bytes[i + 7] == 0x00 &&
Bytes[i + 8] == 0xDC && Bytes[i + 9] == 0x48) {
for (y = i; y < 0x1000000; ++y) {
// 48 85 XX 74 XX 48 XX XX 48
if (Bytes[y+0] == 0x48 && Bytes[y+1] == 0x85 && Bytes[y+3] == 0x74 &&
Bytes[y+5] == 0x48 && Bytes[y+8] == 0x48) {
patchLocation2 = y;
break;
// 00 85 C0 0F 84 XX 00 00 00 49
} else if (Bytes[y+0] == 0x00 && Bytes[y+1] == 0x85 && Bytes[y+2] == 0xC0 &&
Bytes[y+3] == 0x0F && Bytes[y+4] == 0x84 && Bytes[y+9] == 0x49) {
patchLocation2 = y;
break;
}
}
}
}
if (patchLocation2) {
if (Bytes[patchLocation2 + 0] == 0x48 && Bytes[patchLocation2 + 1] == 0x85) {
Bytes[patchLocation2 + 3] = 0xEB;
verbose("\tFound SIP pattern (10.11 - 10.14): patched!\n");
if (Bytes[patchLocation2 + 4] == 0x6C) {
// 48 85 XX 74 6C 48 XX XX 48
// 48 85 XX EB 15 48 XX XX 48
Bytes[patchLocation2 + 4] = 0x15; // 10.14.4-10.14.6
} else {
// 48 85 XX 74 XX 48 XX XX 48
// 48 85 XX EB 12 48 XX XX 48
Bytes[patchLocation2 + 4] = 0x12; // 10.11-10.14.3
}
count++;
PatchApplied = true;
// PMheart
} else if (Bytes[patchLocation2 + 0] == 0x00 && Bytes[patchLocation2 + 1] == 0x85) {
verbose("\tFound SIP pattern (10.15 - recent macOS): patched!\n");
for (i = 3; i < 9; i++) {
// 00 85 C0 0F 84 XX 00 00 00 49
// 00 85 C0 90 90 90 90 90 90 49
Bytes[patchLocation2 + i] = 0x90;
}
count++;
PatchApplied = true;
}
}
}
// Port from Clover 4979 end.
verbose("\tFound Sierra SIP pattern: patched!\n");
if (PatchApplied)
{
break;
}
PatchApplied = true;
}
}
}
// Yosemite/El Capitan
if (kernelOSVer >= MacOSVer2Int("10.10") && kernelOSVer < MacOSVer2Int("10.12"))
{
for (Index = 0; Index < 0x1000000; ++Index)
{
// El Capitan
if (Bytes[Index] == 0xC3
&& Bytes[Index + 1] == 0x48
&& Bytes[Index + 2] == 0x85
&& Bytes[Index + 3] == 0xDB
&& Bytes[Index + 4] == 0x74
&& Bytes[Index + 5] == 0x70
&& Bytes[Index + 6] == 0x48
&& Bytes[Index + 7] == 0x8B
&& Bytes[Index + 8] == 0x03
&& Bytes[Index + 9] == 0x48
&& Bytes[Index + 10] == 0x89
&& Bytes[Index + 11] == 0xDF
&& Bytes[Index + 12] == 0xFF
&& Bytes[Index + 13] == 0x50
&& Bytes[Index + 14] == 0x28
&& Bytes[Index + 15] == 0x48)
{
Bytes[Index + 4] = 0xEB;
Bytes[Index + 5] = 0x12;
count++;
if (kernelOSVer >= MacOSVer2Int("10.11"))
{
verbose("\tFound El Capitan SIP pattern: patched!\n");
}
else
{
verbose("\tFound Yosemite SIP pattern: patched!\n");
}
if (PatchApplied)
{
break;
}
PatchApplied = true;
}
}
}
// Mojave, need to use 10.12 instead of 10.14. kernel bug?
// if (kernelOSVer >= MacOSVer2Int("10.10") && kernelOSVer < MacOSVer2Int("10.14"))
if (kernelOSVer >= MacOSVer2Int("10.12"))
{
for (Index = 0; Index < 0x1000000; ++Index)
{
if (Bytes[Index] == 0xE8
&& Bytes[Index + 1] == 0xAF
&& Bytes[Index + 2] == 0x00
&& Bytes[Index + 3] == 0x00
&& Bytes[Index + 4] == 0x00
&& Bytes[Index + 5] == 0xEB
&& Bytes[Index + 6] == 0x05
&& Bytes[Index + 7] == 0xE8)
{
Bytes[Index + 5] = 0x90;
Bytes[Index + 6] = 0x90;
count++;
verbose("\tFound Mojave EXT pattern: patched!\n");
if (PatchApplied)
{
break;
}
PatchApplied = true;
}
}
}
// Yosemite onward.
// Yosemite/EL Capitan/Sierra/High Sierra
// if (kernelOSVer >= MacOSVer2Int("10.10") && kernelOSVer < MacOSVer2Int("10.14"))
if (kernelOSVer >= MacOSVer2Int("10.10"))
{
for (Index = 0; Index < 0x1000000; ++Index)
{
if (Bytes[Index] == 0xE8
&& Bytes[Index + 1] == 0x25
&& Bytes[Index + 2] == 0x00
&& Bytes[Index + 3] == 0x00
&& Bytes[Index + 4] == 0x00
&& Bytes[Index + 5] == 0xEB
&& Bytes[Index + 6] == 0x05
&& Bytes[Index + 7] == 0xE8)
{
Bytes[Index + 5] = 0x90;
Bytes[Index + 6] = 0x90;
count++;
if (kernelOSVer >= MacOSVer2Int("10.13") && kernelOSVer < MacOSVer2Int("10.14"))
{
verbose("\tFound High Sierra EXT pattern: patched!\n");
}
else if (kernelOSVer >= MacOSVer2Int("10.12") && kernelOSVer < MacOSVer2Int("10.13"))
{
verbose("\tFound Sierra EXT pattern: patched!\n");
}
else if (kernelOSVer >= MacOSVer2Int("10.11") && kernelOSVer < MacOSVer2Int("10.12"))
{
verbose("\tFound EL Capitan EXT pattern: patched!\n");
}
else
{
verbose("\tFound Yosemite EXT pattern: patched!\n");
}
if (PatchApplied)
{
break;
}
PatchApplied = true;
}
}
}
// Mountain Lion/Mavericks
if (kernelOSVer >= MacOSVer2Int("10.8") && kernelOSVer < MacOSVer2Int("10.10"))
{
for (Index = 0; Index < 0x1000000; ++Index)
{
if (Bytes[Index] == 0xC6
&& Bytes[Index + 1] == 0xE8
&& Bytes[Index + 2] == 0x30
&& Bytes[Index + 3] == 0x00
&& Bytes[Index + 4] == 0x00
&& Bytes[Index + 5] == 0x00
&& Bytes[Index + 6] == 0xEB
&& Bytes[Index + 7] == 0x08
&& Bytes[Index + 8] == 0x48
&& Bytes[Index + 9] == 0x89
&& Bytes[Index + 10] == 0xDF)
{
Bytes[Index + 6] = 0x90;
Bytes[Index + 7] = 0x90;
count++;
verbose("\tFound M%s EXT pattern: patched!\n", checkOSVersion("10.8") ? "ountain Lion" : "avericks");
if (PatchApplied)
{
break;
}
PatchApplied = true;
}
}
}
// Lion 64
if (kernelOSVer >= MacOSVer2Int("10.7") && kernelOSVer < MacOSVer2Int("10.8"))
{
//int lessBytes = (int)((uncompressed_size/3)*2); // speedup, the _PrelinkInfoDictionary should not be 1/3 of entire cache!
for (Index = 0/*lessBytes*/; Index < uncompressed_size; ++Index)
{
//scan for _PrelinkInfoDictionary
// scan for _PrelinkInfoDictionary
// <dict><key>_PrelinkInfoDictionary</key>
// 3C 64 69 63 74 3E 3C 6B 65 79 3E 5F 50 72 65 6C 69 6E 6B 49 6E 66 6F 44 69 63 74 69 6F 6E 61 72 79 3C 2F 6B 65 79 3E
if (Bytes[Index] == 0x3C
&& Bytes[Index + 1] == 0x64
&& Bytes[Index + 2] == 0x69
{
for (Index = prelinkDictStartLocation; Index < uncompressed_size; ++Index)
{
// end of prelink ( <> plus some zeros)
// end of prelink ( <> plus some zeros)
// </dict>
// 3C 2F 64 69 63 74 3E 00 00 00 00 00 00 00
if (Bytes[Index] == 0x3C
&& Bytes[Index + 1] == 0x2F
&& Bytes[Index + 2] == 0x64
branches/ErmaC/Enoch/i386/boot2/gui.c
5151
5252
5353
54
55
5456
5557
5658
......
7678
7779
7880
81
82
7983
8084
8185
......
107111
108112
109113
114
115
110116
111117
112118
......
177183
178184
179185
186
187
180188
181189
182190
......
202210
203211
204212
213
214
205215
206216
207217
......
233243
234244
235245
246
247
236248
237249
238250
......
456468
457469
458470
471
472
459473
460474
461475
......
481495
482496
483497
498
499
484500
485501
486502
......
512528
513529
514530
531
532
515533
516534
517535
......
11911209
11921210
11931211
1212
1213
1214
1215
11941216
11951217
11961218
iDeviceGeneric_o,
iDeviceHFS,
iDeviceHFS_o,
iDeviceHFS_cat,
iDeviceHFS_cat_o,
iDeviceHFS_moj,
iDeviceHFS_moj_o,
iDeviceHFS_hsi,
iDeviceHFSRAID,
iDeviceHFSRAID_o,
iDeviceHFSRAID_cat,
iDeviceHFSRAID_cat_o,
iDeviceHFSRAID_moj,
iDeviceHFSRAID_moj_o,
iDeviceHFSRAID_hsi,
iDeviceHFSFUSION,
iDeviceHFSFUSION_o,
iDeviceHFSFUSION_cat,
iDeviceHFSFUSION_cat_o,
iDeviceHFSFUSION_moj,
iDeviceHFSFUSION_moj_o,
iDeviceHFSFUSION_hsi,
{.name = "device_generic_o", .image = NULL},
{.name = "device_hfsplus", .image = NULL},
{.name = "device_hfsplus_o", .image = NULL},
{.name = "device_hfsplus_cat", .image = NULL},
{.name = "device_hfsplus_cat_o", .image = NULL},
{.name = "device_hfsplus_moj", .image = NULL},
{.name = "device_hfsplus_moj_o", .image = NULL},
{.name = "device_hfsplus_hsi", .image = NULL},
{.name = "device_hfsraid", .image = NULL},
{.name = "device_hfsraid_o", .image = NULL},
{.name = "device_hfsraid_cat", .image = NULL},
{.name = "device_hfsraid_cat_o", .image = NULL},
{.name = "device_hfsraid_moj", .image = NULL},
{.name = "device_hfsraid_moj_o", .image = NULL},
{.name = "device_hfsraid_hsi", .image = NULL},
{.name = "device_hfsfusion", .image = NULL},
{.name = "device_hfsfusion_o", .image = NULL},
{.name = "device_hfsfusion_cat", .image = NULL},
{.name = "device_hfsfusion_cat_o", .image = NULL},
{.name = "device_hfsfusion_moj", .image = NULL},
{.name = "device_hfsfusion_moj_o", .image = NULL},
{.name = "device_hfsfusion_hsi", .image = NULL},
LOADPNG(device_hfsplus, iDeviceGeneric);
LOADPNG(device_hfsplus_o, iDeviceHFS);
LOADPNG(device_hfsplus_cat, iDeviceHFS);
LOADPNG(device_hfsplus_cat_o, iDeviceHFS_cat);
LOADPNG(device_hfsplus_moj, iDeviceHFS);
LOADPNG(device_hfsplus_moj_o, iDeviceHFS_moj);
LOADPNG(device_hfsplus_hsi, iDeviceHFS);
LOADPNG(device_hfsraid, iDeviceHFS);
LOADPNG(device_hfsraid_o, iDeviceHFSRAID);
LOADPNG(device_hfsraid_cat, iDeviceHFSRAID);
LOADPNG(device_hfsraid_cat_o, iDeviceHFSRAID_cat);
LOADPNG(device_hfsraid_moj, iDeviceHFSRAID);
LOADPNG(device_hfsraid_moj_o, iDeviceHFSRAID_moj);
LOADPNG(device_hfsraid_hsi, iDeviceHFSRAID);
LOADPNG(device_hfsfusion, iDeviceHFS);
LOADPNG(device_hfsfusion_o, iDeviceHFSFUSION);
LOADPNG(device_hfsfusion_cat, iDeviceHFSFUSION);
LOADPNG(device_hfsfusion_cat_o, iDeviceHFSFUSION_cat);
LOADPNG(device_hfsfusion_moj, iDeviceHFSFUSION);
LOADPNG(device_hfsfusion_moj_o, iDeviceHFSFUSION_moj);
LOADPNG(device_hfsfusion_hsi, iDeviceHFSFUSION);
devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID_moj : iDeviceHFS_moj); // Mojave
break;
}
if (device->OSVersion[4] == '5') { // 10.15
devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID_cat : iDeviceHFS_cat); // Catalina
break;
}
default:
devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID : iDeviceHFS);
break;
branches/ErmaC/Enoch/Make.rules
1717
1818
1919
20
20
2121
2222
2323
NASM = $(shell which nasm) -p $(SRCROOT)/autoconf.inc
CFLAGS= $(CONFIG_OPTIMIZATION_LEVEL) -g -Wmost -Werror
CFLAGS= $(CONFIG_OPTIMIZATION_LEVEL) -g -Wmost -Werror -Wno-expansion-to-defined
CPPFLAGS = $(MORECPP) -g -Wmost -Werror -fno-exceptions -fno-rtti
DEFINES=

Archive Download the corresponding diff file

Revision: 2922