Chameleon

Chameleon Commit Details

Date:2017-06-15 01:27:34 (2 years 5 months ago)
Author:ErmaC
Commit:2883
Parents: 2882
Message:small update for H.Sierra (thx Clover Team)
Changes:
M/branches/ErmaC/Enoch/i386/libsaio/stringTable.c
M/branches/ErmaC/Enoch/i386/libsaio/smbios_decode.c
M/branches/ErmaC/Enoch/i386/boot2/drivers.c
M/branches/ErmaC/Enoch/i386/libsaio/smbios.h
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/i386/libsaio/bootstruct.c
M/branches/ErmaC/Enoch/i386/libsaio/disk.c
M/branches/ErmaC/Enoch/i386/boot2/boot.h

File differences

branches/ErmaC/Enoch/i386/libsaio/bootstruct.c
134134
135135
136136
137
137
138138
139139
140140
}
else
{
// for 10.7 10.8 10.9 10.10 10.11 10.12
// for 10.7 10.8 10.9 10.10 10.11 10.12 10.13
void *oldAddr = bootArgs;
bootArgs = (boot_args *)AllocateKernelMemory(sizeof(boot_args));
bcopy(oldAddr, bootArgs, sizeof(boot_args));
branches/ErmaC/Enoch/i386/libsaio/disk.c
17111711
17121712
17131713
1714
17141715
17151716
17161717
......
18101811
18111812
18121813
1814
1815
1816
1817
1818
1819
18131820
18141821
18151822
......
18701877
18711878
18721879
1880
1881
1882
18731883
1874
1884
18751885
18761886
18771887
char *YosPattern = "Install%20OS%20X%20Yosemite";
char *ECPattern = "Install%20OS%20X%20El%20Capitan";
char *SierraPattern = "Install%20macOS%20Sierra";
char *HSierraPattern = "Install%20macOS%20High%20Sierra";
/*
* Only look for OS Version on HFS+
fakeOSVersionInt = 12;
valid = true;
}
else if(strstr(val, HSierraPattern))
{
fakeOSVersion = "10.13";
fakeOSVersionInt = 13;
valid = true;
}
else
{
valid = false;
case 12:
fakeOSVersion = "10.12";
break;
case 13:
fakeOSVersion = "10.13";
break;
default:
fakeOSVersion = "10.12";
fakeOSVersion = "10.13";
break;
}
branches/ErmaC/Enoch/i386/libsaio/smbios_decode.c
574574
575575
576576
577
578
579
580
581
582
583
577
578
579
580
581
582
583
584584
585585
586586
//-------------------------------------------------------------------------------------------------------------------------
// Apple Specific (Type 133)
//-------------------------------------------------------------------------------------------------------------------------
//void decodeOemPlatformFeature(SMBStructHeader *structHeader)
//{
//printHeader(structHeader);
//DBG("Apple specific Platform Feature\n");
//DBG("\t%s\n", ((SMBOemPlatformFeature *)structHeader)->PlatformFeature);
//DBG("\n");
//}
void decodeOemPlatformFeature(SMBStructHeader *structHeader)
{
printHeader(structHeader);
DBG("Apple specific Platform Feature\n");
DBG("\t%s\n", ((SMBOemPlatformFeature *)structHeader)->PlatformFeature);
DBG("\n");
}
//-------------------------------------------------------------------------------------------------------------------------
// Specific (Type 134)
branches/ErmaC/Enoch/i386/libsaio/smbios.h
134134
135135
136136
137
138
137
138
139139
140140
141141
kSMBTypeMemorySPD= 130, // MemorySPD (TYPE 130)
kSMBTypeOemProcessorType= 131, // Processor Type (Type 131)
kSMBTypeOemProcessorBusSpeed= 132, // Processor Bus Speed (Type 132)
kSMBTypeOemPlatformFeature= 133 // Platform Feature (Type 133)
//kSMBTypeOemSMCVersion= 134 // SMC Version (Type 134)
kSMBTypeOemPlatformFeature= 133, // Platform Feature (Type 133)
kSMBTypeOemSMCVersion= 134 // SMC Version (Type 134)
};
//----------------------------------------------------------------------------------------------------------
branches/ErmaC/Enoch/i386/libsaio/stringTable.c
681681
682682
683683
684
684685
685
686686
687687
688688
// Micky1979, the order is important
char *dirspec[] = {
"/com.apple.recovery.boot/com.apple.Boot.plist",// OS X Recovery
"/macOS Install Data/Locked Files/Boot Files/com.apple.Boot.plist",// macOS Upgrade (10.12)+
"/macOS Install Data/com.apple.Boot.plist",// macOS Upgrade (10.12)
"/macOS Install Data/Locked Files/Boot Files/com.apple.Boot.plist",// macOS Upgrade (10.12)
"/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
branches/ErmaC/Enoch/i386/boot2/drivers.c
15321532
15331533
15341534
1535
1536
1535
1536
1537
15371538
15381539
15391540
1540
1541
1541
1542
15421543
15431544
15441545
......
15981599
15991600
16001601
1601
1602
1603
1604
1605
16021606
1603
1607
16041608
16051609
16061610
case 4: kernelOSVer = 0xA0C0300; break;
case 5: kernelOSVer = 0xA0C0400; break;
case 6: kernelOSVer = 0xA0C0500; break;
//case 7: kernelOSVer = 0xA0C0600; break;
default:kernelOSVer = 0xA0C0500; break; //Last known kernel (add here updates)
case 7: kernelOSVer = 0xA0C0600; break;
//case 8: kernelOSVer = 0xA0C0700; break;
default:kernelOSVer = 0xA0C0600; break; //Last known kernel (add here updates)
}
break;
default:
kernelOSVer = 0xA0C0500;
break; //Last known kernel is Sierra 10.12.5
kernelOSVer = 0xA0C0600;
break; //Last known kernel is Sierra 10.12.6
}
}
else
case 0xA0C0300: gDarwinMajor = 16; gDarwinMinor = 4; gDarwinRev = 0; break; // 10.12.3
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 = x; gDarwinRev = x; break; // 10.12.6
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
// default = last known kernel
default: gDarwinMajor = 16; gDarwinMinor = 6; gDarwinRev = 0; break; // 10.12.5;
default: gDarwinMajor = 16; gDarwinMinor = 7; gDarwinRev = 0; break; // 10.12.6;
}
}
branches/ErmaC/Enoch/i386/boot2/boot.c
13021302
13031303
13041304
1305
1305
13061306
13071307
13081308
......
13171317
13181318
13191319
1320
1320
13211321
13221322
13231323
}
// OS X El Capitan 10.11
if ( MacOSVerCurrent >= MacOSVer2Int("10.11") ) // El Capitan and Sierra!
if ( MacOSVerCurrent >= MacOSVer2Int("10.11") ) // El Capitan, Sierra and High Sierra!
{
// ErmaC
verbose("\n");
if (isRecoveryHD || isInstaller || isOSXUpgrade || isMacOSXUpgrade)
{
// SIP can be controlled with or without FileNVRAM.kext (Pike R. Alpha)
bootArgs->flags|=(kBootArgsFlagCSRActiveConfig + kBootArgsFlagCSRConfigMode + kBootArgsFlagCSRBoot);
bootArgs->flags|=(kBootArgsFlagCSRActiveConfig + kBootArgsFlagCSRConfigMode + kBootArgsFlagCSRBoot + kBootArgsFlagInstallUI);
}
else
{
branches/ErmaC/Enoch/i386/boot2/boot.h
3030
3131
3232
33
3334
3435
3536
#include "libsaio.h"
// OS X Versions
#define HSIERRA checkOSVersion("10.13") // High Sierra
#define SIERRA checkOSVersion("10.12") // Sierra
#define ELCAPITAN checkOSVersion("10.11") // El Capitan
#define YOSEMITE checkOSVersion("10.10") // Yosemite
branches/ErmaC/Enoch/i386/boot2/kernel_patcher_internal.c
644644
645645
646646
647
647
648648
649
650
651
652
653
654
655
649656
650657
651658
......
905912
906913
907914
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
924931
925932
926933
927934
928935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
929959
930960
931961
......
13121342
13131343
13141344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
13151374
13161375
13171376
......
13431402
13441403
13451404
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
13461432
13471433
13481434
{
(*((UInt64 *)Ptr)) = 0x0000000000000000ULL;
verbose("\tKernel power management patch 10.12 DP1 found and patched\n");
return TRUE;
return true;
}
// PMheart: change for 10.13 DP1 17A264c
else if (0x00004000000000E2ULL == (*((UInt64 *)Ptr)))
{
(*((UInt64 *)Ptr)) = 0x0000000000000000ULL;
verbose("\tKernel power management patch 10.13 DP1 found and patched\n");
return true;
}
Ptr += 16;
}
verbose("\tKernel power management patch region not found!\n");
}
// 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))
&& (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;
DBG("\tFound Sierra Lapic panic at 0x%08X\n", (unsigned int)patchLocation);
break;
}
// sherlocks: 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;
DBG("\tFound High Sierra Lapic panic at 0x%08X\n", (unsigned int)patchLocation);
break;
}
}
if (!patchLocation)
Bytes = (UInt8 *)kernelData;
PatchApplied = false;
// High Sierra onward, need to use 10.12 instead of 10.13. kernel bug?
if (kernelOSVer >= MacOSVer2Int("10.12"))
{
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 + 8] == 0x7E
&& Bytes[Index + 9] == 0x05
&& Bytes[Index + 10] == 0x00
&& Bytes[Index + 11] == 0x00)
{
Bytes[Index + 5] = 0x90;
Bytes[Index + 6] = 0x90;
count++;
verbose("\tFound High Sierra EXT pattern: patched!\n");
PatchApplied = true;
break;
}
}
}
// Sierra onward
if (kernelOSVer >= MacOSVer2Int("10.12"))
{
PatchApplied = true;
break;
}
// High Sierra onward, need to use 10.12 instead of 10.13. kernel bug?
if ((kernelOSVer >= MacOSVer2Int("10.12"))
&& (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 SIP pattern: patched!\n");
PatchApplied = true;
break;
}
}
}
branches/ErmaC/Enoch/i386/boot2/gui.c
5151
5252
5353
54
55
5456
5557
5658
......
7274
7375
7476
77
78
7579
7680
7781
......
96100
97101
98102
103
104
99105
100106
101107
......
162168
163169
164170
171
172
165173
166174
167175
......
183191
184192
185193
194
195
186196
187197
188198
......
207217
208218
209219
220
221
210222
211223
212224
......
426438
427439
428440
441
442
429443
430444
431445
......
447461
448462
449463
464
465
450466
451467
452468
......
471487
472488
473489
490
491
474492
475493
476494
......
11381156
11391157
11401158
1159
1160
1161
1162
11411163
11421164
11431165
iDeviceGeneric_o,
iDeviceHFS,
iDeviceHFS_o,
iDeviceHFS_hsi,
iDeviceHFS_hsi_o,
iDeviceHFS_sie,
iDeviceHFS_sie_o,
iDeviceHFS_cap,
iDeviceHFSRAID,
iDeviceHFSRAID_o,
iDeviceHFSRAID_hsi,
iDeviceHFSRAID_hsi_o,
iDeviceHFSRAID_sie,
iDeviceHFSRAID_sie_o,
iDeviceHFSRAID_cap,
iDeviceHFSFUSION,
iDeviceHFSFUSION_o,
iDeviceHFSFUSION_hsi,
iDeviceHFSFUSION_hsi_o,
iDeviceHFSFUSION_sie,
iDeviceHFSFUSION_sie_o,
iDeviceHFSFUSION_cap,
{.name = "device_generic_o", .image = NULL},
{.name = "device_hfsplus", .image = NULL},
{.name = "device_hfsplus_o", .image = NULL},
{.name = "device_hfsplus_hsi", .image = NULL},
{.name = "device_hfsplus_hsi_o", .image = NULL},
{.name = "device_hfsplus_sie", .image = NULL},
{.name = "device_hfsplus_sie_o", .image = NULL},
{.name = "device_hfsplus_cap", .image = NULL},
{.name = "device_hfsraid", .image = NULL},
{.name = "device_hfsraid_o", .image = NULL},
{.name = "device_hfsraid_hsi", .image = NULL},
{.name = "device_hfsraid_hsi_o", .image = NULL},
{.name = "device_hfsraid_sie", .image = NULL},
{.name = "device_hfsraid_sie_o", .image = NULL},
{.name = "device_hfsraid_cap", .image = NULL},
{.name = "device_hfsfusion", .image = NULL},
{.name = "device_hfsfusion_o", .image = NULL},
{.name = "device_hfsfusion_hsi", .image = NULL},
{.name = "device_hfsfusion_hsi_o", .image = NULL},
{.name = "device_hfsfusion_sie", .image = NULL},
{.name = "device_hfsfusion_sie_o", .image = NULL},
{.name = "device_hfsfusion_cap", .image = NULL},
LOADPNG(device_hfsplus, iDeviceGeneric);
LOADPNG(device_hfsplus_o, iDeviceHFS);
LOADPNG(device_hfsplus_hsi, iDeviceHFS);
LOADPNG(device_hfsplus_hsi_o, iDeviceHFS_hsi);
LOADPNG(device_hfsplus_sie, iDeviceHFS);
LOADPNG(device_hfsplus_sie_o, iDeviceHFS_sie);
LOADPNG(device_hfsplus_cap, iDeviceHFS);
LOADPNG(device_hfsraid, iDeviceHFS);
LOADPNG(device_hfsraid_o, iDeviceHFSRAID);
LOADPNG(device_hfsraid_hsi, iDeviceHFSRAID);
LOADPNG(device_hfsraid_hsi_o, iDeviceHFSRAID_hsi);
LOADPNG(device_hfsraid_sie, iDeviceHFSRAID);
LOADPNG(device_hfsraid_sie_o, iDeviceHFSRAID_sie);
LOADPNG(device_hfsraid_cap, iDeviceHFSRAID);
LOADPNG(device_hfsfusion, iDeviceHFS);
LOADPNG(device_hfsfusion_o, iDeviceHFSFUSION);
LOADPNG(device_hfsfusion_hsi, iDeviceHFSFUSION);
LOADPNG(device_hfsfusion_hsi_o, iDeviceHFSFUSION_hsi);
LOADPNG(device_hfsfusion_sie, iDeviceHFSFUSION);
LOADPNG(device_hfsfusion_sie_o, iDeviceHFSFUSION_sie);
LOADPNG(device_hfsfusion_cap, iDeviceHFSFUSION);
devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID_sie : iDeviceHFS_sie); // Sierra
break;
}
if (device->OSVersion[4] == '3') { // 10.13
devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID_hsi : iDeviceHFS_hsi); // Sierra
break;
}
default:
devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID : iDeviceHFS);
break;

Archive Download the corresponding diff file

Revision: 2883