mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-27 12:15:19 +01:00
use const arrays
Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
parent
9b673232f7
commit
1c637c0515
@ -1353,36 +1353,36 @@ BOOLEAN LOADER_ENTRY::HaswellLowEndXCPM(VOID *kernelData, BOOLEAN use_xcpm_idle)
|
||||
if (use_xcpm_idle) {
|
||||
DBG("HWPEnable - ON.\n");
|
||||
comment = "_xcpm_idle";
|
||||
STATIC UINT8 find[] = { 0xB9, 0xE2, 0x00, 0x00, 0x00, 0x0F, 0x30 };
|
||||
STATIC UINT8 repl[] = { 0xB9, 0xE2, 0x00, 0x00, 0x00, 0x90, 0x90 };
|
||||
const UINT8 find[] = { 0xB9, 0xE2, 0x00, 0x00, 0x00, 0x0F, 0x30 };
|
||||
const UINT8 repl[] = { 0xB9, 0xE2, 0x00, 0x00, 0x00, 0x90, 0x90 };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
}
|
||||
|
||||
comment = "_xcpm_bootstrap";
|
||||
if (os_version <= AsciiOSVersionToUint64("10.12.5")) {
|
||||
// 10.12 - 10.12.5
|
||||
STATIC UINT8 find[] = { 0x83, 0xC3, 0xC4, 0x83, 0xFB, 0x22 };
|
||||
STATIC UINT8 repl[] = { 0x83, 0xC3, 0xC6, 0x83, 0xFB, 0x22 };
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xC4, 0x83, 0xFB, 0x22 };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xC6, 0x83, 0xFB, 0x22 };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.13")) {
|
||||
// 10.12.6
|
||||
STATIC UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x83, 0xF8, 0x22 };
|
||||
STATIC UINT8 repl[] = { 0x8D, 0x43, 0xC6, 0x83, 0xF8, 0x22 };
|
||||
const UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x83, 0xF8, 0x22 };
|
||||
const UINT8 repl[] = { 0x8D, 0x43, 0xC6, 0x83, 0xF8, 0x22 };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.15")) {
|
||||
// 10.13/10.14
|
||||
STATIC UINT8 find[] = { 0x89, 0xD8, 0x04, 0xC4, 0x3C, 0x22 };
|
||||
STATIC UINT8 repl[] = { 0x89, 0xD8, 0x04, 0xC6, 0x3C, 0x22 };
|
||||
const UINT8 find[] = { 0x89, 0xD8, 0x04, 0xC4, 0x3C, 0x22 };
|
||||
const UINT8 repl[] = { 0x89, 0xD8, 0x04, 0xC6, 0x3C, 0x22 };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
// PMheart: attempt to add 10.15 compatibility
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.15.4")) {
|
||||
STATIC UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x3C, 0x22 };
|
||||
STATIC UINT8 repl[] = { 0x8D, 0x43, 0xC6, 0x3C, 0x22 };
|
||||
const UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x3C, 0x22 };
|
||||
const UINT8 repl[] = { 0x8D, 0x43, 0xC6, 0x3C, 0x22 };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.16")) {
|
||||
// vector sigma: 10.15.5 Beta 2 build 19F62f and 10.15.4 build 19E287
|
||||
STATIC UINT8 find[] = { 0x3B, 0x7E, 0x2E, 0x80, 0xC3, 0xC4, 0x80, 0xFB, 0x42 };
|
||||
STATIC UINT8 repl[] = { 0x00, 0x7E, 0x2E, 0x80, 0xC3, 0xC6, 0x80, 0xFB, 0x42 };
|
||||
const UINT8 find[] = { 0x3B, 0x7E, 0x2E, 0x80, 0xC3, 0xC4, 0x80, 0xFB, 0x42 };
|
||||
const UINT8 repl[] = { 0x00, 0x7E, 0x2E, 0x80, 0xC3, 0xC6, 0x80, 0xFB, 0x42 };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
}
|
||||
|
||||
@ -1390,8 +1390,8 @@ BOOLEAN LOADER_ENTRY::HaswellLowEndXCPM(VOID *kernelData, BOOLEAN use_xcpm_idle)
|
||||
// PMheart: bytes seem stable as of 10.12
|
||||
if (os_version >= AsciiOSVersionToUint64("10.12")) {
|
||||
// 10.12+
|
||||
STATIC UINT8 find[] = { 0xB9, 0xA0, 0x01, 0x00, 0x00, 0x0F, 0x32 };
|
||||
STATIC UINT8 repl[] = { 0xB9, 0xA0, 0x01, 0x00, 0x00, 0x31, 0xC0 };
|
||||
const UINT8 find[] = { 0xB9, 0xA0, 0x01, 0x00, 0x00, 0x0F, 0x32 };
|
||||
const UINT8 repl[] = { 0xB9, 0xA0, 0x01, 0x00, 0x00, 0x31, 0xC0 };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
}
|
||||
|
||||
@ -1457,29 +1457,29 @@ BOOLEAN LOADER_ENTRY::KernelIvyBridgeXCPM(VOID *kernelData, BOOLEAN use_xcpm_idl
|
||||
comment = "_xcpm_bootstrap";
|
||||
if (os_version <= AsciiOSVersionToUint64("10.12.5")) {
|
||||
// 10.12 - 10.12.5
|
||||
STATIC UINT8 find[] = { 0x83, 0xC3, 0xC4, 0x83, 0xFB, 0x22 };
|
||||
STATIC UINT8 repl[] = { 0x83, 0xC3, 0xC6, 0x83, 0xFB, 0x22 };
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xC4, 0x83, 0xFB, 0x22 };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xC6, 0x83, 0xFB, 0x22 };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.13")) {
|
||||
// 10.12.6
|
||||
STATIC UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x83, 0xF8, 0x22 };
|
||||
STATIC UINT8 repl[] = { 0x8D, 0x43, 0xC6, 0x83, 0xF8, 0x22 };
|
||||
const UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x83, 0xF8, 0x22 };
|
||||
const UINT8 repl[] = { 0x8D, 0x43, 0xC6, 0x83, 0xF8, 0x22 };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
// PMheart: attempt to add 10.14 compatibility
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.15")) {
|
||||
// 10.13/10.14
|
||||
STATIC UINT8 find[] = { 0x89, 0xD8, 0x04, 0xC4, 0x3C, 0x22 };
|
||||
STATIC UINT8 repl[] = { 0x89, 0xD8, 0x04, 0xC6, 0x3C, 0x22 };
|
||||
const UINT8 find[] = { 0x89, 0xD8, 0x04, 0xC4, 0x3C, 0x22 };
|
||||
const UINT8 repl[] = { 0x89, 0xD8, 0x04, 0xC6, 0x3C, 0x22 };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
// PMheart: attempt to add 10.15 compatibility
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.15.4")) {
|
||||
STATIC UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x3C, 0x22 };
|
||||
STATIC UINT8 repl[] = { 0x8D, 0x43, 0xC6, 0x3C, 0x22 };
|
||||
const UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x3C, 0x22 };
|
||||
const UINT8 repl[] = { 0x8D, 0x43, 0xC6, 0x3C, 0x22 };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.16")) {
|
||||
// vector sigma: 10.15.5 Beta 2 build 19F62f and 10.15.4 build 19E287
|
||||
STATIC UINT8 find[] = { 0x3B, 0x7E, 0x2E, 0x80, 0xC3, 0xC4, 0x80, 0xFB, 0x42 };
|
||||
STATIC UINT8 repl[] = { 0x00, 0x7E, 0x2E, 0x80, 0xC3, 0xC6, 0x80, 0xFB, 0x42 };
|
||||
const UINT8 find[] = { 0x3B, 0x7E, 0x2E, 0x80, 0xC3, 0xC4, 0x80, 0xFB, 0x42 };
|
||||
const UINT8 repl[] = { 0x00, 0x7E, 0x2E, 0x80, 0xC3, 0xC6, 0x80, 0xFB, 0x42 };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
}
|
||||
|
||||
@ -1519,13 +1519,13 @@ BOOLEAN LOADER_ENTRY::KernelIvyE5XCPM(VOID *kernelData, BOOLEAN use_xcpm_idle)
|
||||
comment = "_cpuid_set_info";
|
||||
if (os_version <= AsciiOSVersionToUint64("10.8.5")) {
|
||||
// 10.8.5
|
||||
STATIC UINT8 find[] = { 0x83, 0xF8, 0x3C, 0x74, 0x2D };
|
||||
STATIC UINT8 repl[] = { 0x83, 0xF8, 0x3E, 0x74, 0x2D };
|
||||
const UINT8 find[] = { 0x83, 0xF8, 0x3C, 0x74, 0x2D };
|
||||
const UINT8 repl[] = { 0x83, 0xF8, 0x3E, 0x74, 0x2D };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
} else if (os_version == AsciiOSVersionToUint64("10.9") || os_version == AsciiOSVersionToUint64("10.9.1")) {
|
||||
// 10.9.0 - 10.9.1
|
||||
STATIC UINT8 find[] = { 0x83, 0xF8, 0x3C, 0x75, 0x07 };
|
||||
STATIC UINT8 repl[] = { 0x83, 0xF8, 0x3E, 0x75, 0x07 };
|
||||
const UINT8 find[] = { 0x83, 0xF8, 0x3C, 0x75, 0x07 };
|
||||
const UINT8 repl[] = { 0x83, 0xF8, 0x3E, 0x75, 0x07 };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
} // 10.9.2+: native support reached, no need to patch
|
||||
|
||||
@ -1534,13 +1534,13 @@ BOOLEAN LOADER_ENTRY::KernelIvyE5XCPM(VOID *kernelData, BOOLEAN use_xcpm_idle)
|
||||
comment = "_xcpm_pkg_scope_msrs";
|
||||
if (os_version <= AsciiOSVersionToUint64("10.8.5")) {
|
||||
// 10.8.5
|
||||
STATIC UINT8 find[] = {
|
||||
const UINT8 find[] = {
|
||||
0x48, 0x8D, 0x3D, 0x02, 0x71, 0x55, 0x00, 0xBE,
|
||||
0x07, 0x00, 0x00, 0x00, 0xEB, 0x1F, 0x48, 0x8D,
|
||||
0x3D, 0xF4, 0x70, 0x55, 0x00, 0xBE, 0x07, 0x00,
|
||||
0x00, 0x00, 0x31, 0xD2, 0xE8, 0x28, 0x02, 0x00, 0x00
|
||||
};
|
||||
STATIC UINT8 repl[] = {
|
||||
const UINT8 repl[] = {
|
||||
0x48, 0x8D, 0x3D, 0x02, 0x71, 0x55, 0x00, 0xBE,
|
||||
0x07, 0x00, 0x00, 0x00, 0x90, 0x90, 0x48, 0x8D,
|
||||
0x3D, 0xF4, 0x70, 0x55, 0x00, 0xBE, 0x07, 0x00,
|
||||
@ -1549,8 +1549,8 @@ BOOLEAN LOADER_ENTRY::KernelIvyE5XCPM(VOID *kernelData, BOOLEAN use_xcpm_idle)
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.10")) {
|
||||
// 10.9.x
|
||||
STATIC UINT8 find[] = { 0xBE, 0x07, 0x00, 0x00, 0x00, 0x74, 0x13, 0x31, 0xD2, 0xE8, 0x5F, 0x02, 0x00, 0x00 };
|
||||
STATIC UINT8 repl[] = { 0xBE, 0x07, 0x00, 0x00, 0x00, 0x90, 0x90, 0x31, 0xD2, 0x90, 0x90, 0x90, 0x90, 0x90 };
|
||||
const UINT8 find[] = { 0xBE, 0x07, 0x00, 0x00, 0x00, 0x74, 0x13, 0x31, 0xD2, 0xE8, 0x5F, 0x02, 0x00, 0x00 };
|
||||
const UINT8 repl[] = { 0xBE, 0x07, 0x00, 0x00, 0x00, 0x90, 0x90, 0x31, 0xD2, 0x90, 0x90, 0x90, 0x90, 0x90 };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
} else {
|
||||
// 10.10+
|
||||
@ -1570,7 +1570,7 @@ BOOLEAN LOADER_ENTRY::KernelIvyE5XCPM(VOID *kernelData, BOOLEAN use_xcpm_idle)
|
||||
}
|
||||
DBG("Applied _xcpm_pkg_scope_msr patch\n");
|
||||
} else {
|
||||
DBG("_xcpm_pkg_scope_msr not found, patch aborted\n");
|
||||
// DBG("_xcpm_pkg_scope_msr not found, patch aborted\n");
|
||||
DBG("KernelIvyE5XCPM() <===FALSE\n");
|
||||
return FALSE;
|
||||
}
|
||||
@ -1580,59 +1580,59 @@ BOOLEAN LOADER_ENTRY::KernelIvyE5XCPM(VOID *kernelData, BOOLEAN use_xcpm_idle)
|
||||
comment = "_xcpm_bootstrap";
|
||||
if (os_version <= AsciiOSVersionToUint64("10.8.5")) {
|
||||
// 10.8.5
|
||||
STATIC UINT8 find[] = { 0x83, 0xFB, 0x3C, 0x75, 0x54 };
|
||||
STATIC UINT8 repl[] = { 0x83, 0xFB, 0x3E, 0x75, 0x54 };
|
||||
const UINT8 find[] = { 0x83, 0xFB, 0x3C, 0x75, 0x54 };
|
||||
const UINT8 repl[] = { 0x83, 0xFB, 0x3E, 0x75, 0x54 };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.10")) {
|
||||
// 10.9.x
|
||||
STATIC UINT8 find[] = { 0x83, 0xFB, 0x3C, 0x75, 0x68 };
|
||||
STATIC UINT8 repl[] = { 0x83, 0xFB, 0x3E, 0x75, 0x68 };
|
||||
const UINT8 find[] = { 0x83, 0xFB, 0x3C, 0x75, 0x68 };
|
||||
const UINT8 repl[] = { 0x83, 0xFB, 0x3E, 0x75, 0x68 };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
} else if (os_version <= AsciiOSVersionToUint64("10.10.2")) {
|
||||
// 10.10 - 10.10.2
|
||||
STATIC UINT8 find[] = { 0x83, 0xFB, 0x3C, 0x75, 0x63 };
|
||||
STATIC UINT8 repl[] = { 0x83, 0xFB, 0x3E, 0x75, 0x63 };
|
||||
const UINT8 find[] = { 0x83, 0xFB, 0x3C, 0x75, 0x63 };
|
||||
const UINT8 repl[] = { 0x83, 0xFB, 0x3E, 0x75, 0x63 };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
} else if (os_version <= AsciiOSVersionToUint64("10.10.5")) {
|
||||
// 10.10.3 - 10.10.5
|
||||
STATIC UINT8 find[] = { 0x83, 0xC3, 0xC6, 0x83, 0xFB, 0x0D };
|
||||
STATIC UINT8 repl[] = { 0x83, 0xC3, 0xC4, 0x83, 0xFB, 0x0D };
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xC6, 0x83, 0xFB, 0x0D };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xC4, 0x83, 0xFB, 0x0D };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
} else if (os_version <= AsciiOSVersionToUint64("10.11")) {
|
||||
// 10.11 DB/PB - 10.11.0
|
||||
STATIC UINT8 find[] = { 0x83, 0xC3, 0xC6, 0x83, 0xFB, 0x0D };
|
||||
STATIC UINT8 repl[] = { 0x83, 0xC3, 0xC4, 0x83, 0xFB, 0x0D };
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xC6, 0x83, 0xFB, 0x0D };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xC4, 0x83, 0xFB, 0x0D };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
} else if (os_version <= AsciiOSVersionToUint64("10.11.6")) {
|
||||
// 10.11.1 - 10.11.6
|
||||
STATIC UINT8 find[] = { 0x83, 0xC3, 0xBB, 0x83, 0xFB, 0x09 };
|
||||
STATIC UINT8 repl[] = { 0x83, 0xC3, 0xB9, 0x83, 0xFB, 0x09 };
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xBB, 0x83, 0xFB, 0x09 };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xB9, 0x83, 0xFB, 0x09 };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
} else if (os_version <= AsciiOSVersionToUint64("10.12.5")) {
|
||||
// 10.12 - 10.12.5
|
||||
STATIC UINT8 find[] = { 0x83, 0xC3, 0xC4, 0x83, 0xFB, 0x22 };
|
||||
STATIC UINT8 repl[] = { 0x83, 0xC3, 0xC2, 0x83, 0xFB, 0x22 };
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xC4, 0x83, 0xFB, 0x22 };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xC2, 0x83, 0xFB, 0x22 };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.13")) {
|
||||
// 10.12.6
|
||||
STATIC UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x83, 0xF8, 0x22 };
|
||||
STATIC UINT8 repl[] = { 0x8D, 0x43, 0xC2, 0x83, 0xF8, 0x22 };
|
||||
const UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x83, 0xF8, 0x22 };
|
||||
const UINT8 repl[] = { 0x8D, 0x43, 0xC2, 0x83, 0xF8, 0x22 };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
// PMheart: attempt to add 10.14 compatibility
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.15")) {
|
||||
// 10.13/10.14
|
||||
STATIC UINT8 find[] = { 0x89, 0xD8, 0x04, 0xC4, 0x3C, 0x22 };
|
||||
STATIC UINT8 repl[] = { 0x89, 0xD8, 0x04, 0xC1, 0x3C, 0x22 };
|
||||
const UINT8 find[] = { 0x89, 0xD8, 0x04, 0xC4, 0x3C, 0x22 };
|
||||
const UINT8 repl[] = { 0x89, 0xD8, 0x04, 0xC1, 0x3C, 0x22 };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
// PMheart: attempt to add 10.15 compatibility
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.15.4")) {
|
||||
STATIC UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x3C, 0x22 };
|
||||
STATIC UINT8 repl[] = { 0x8D, 0x43, 0xC1, 0x3C, 0x22 };
|
||||
const UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x3C, 0x22 };
|
||||
const UINT8 repl[] = { 0x8D, 0x43, 0xC1, 0x3C, 0x22 };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.16")) {
|
||||
// vector sigma: 10.15.5 Beta 2 build 19F62f and 10.15.4 build 19E287
|
||||
STATIC UINT8 find[] = { 0x3B, 0x7E, 0x2E, 0x80, 0xC3, 0xC4, 0x80, 0xFB, 0x42 };
|
||||
STATIC UINT8 repl[] = { 0x00, 0x7E, 0x2E, 0x80, 0xC3, 0xC1, 0x80, 0xFB, 0x42 };
|
||||
const UINT8 find[] = { 0x3B, 0x7E, 0x2E, 0x80, 0xC3, 0xC4, 0x80, 0xFB, 0x42 };
|
||||
const UINT8 repl[] = { 0x00, 0x7E, 0x2E, 0x80, 0xC3, 0xC1, 0x80, 0xFB, 0x42 };
|
||||
applyKernPatch(kern, find, sizeof(find), repl, comment);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user