mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2025-01-11 19:22:14 +01:00
testing KernelPm patch
Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
parent
cf41491adc
commit
f0c8a7c96f
@ -751,6 +751,8 @@ VOID LOADER_ENTRY::KernelCPUIDPatch(UINT8* kernelData)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define NEW_PM 0
|
||||||
|
|
||||||
BOOLEAN LOADER_ENTRY::KernelPatchPm(VOID *kernelData)
|
BOOLEAN LOADER_ENTRY::KernelPatchPm(VOID *kernelData)
|
||||||
{
|
{
|
||||||
DBG_RT("Patching kernel power management...\n");
|
DBG_RT("Patching kernel power management...\n");
|
||||||
@ -767,7 +769,7 @@ BOOLEAN LOADER_ENTRY::KernelPatchPm(VOID *kernelData)
|
|||||||
const UINT8 patchJmp[] = {0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90};
|
const UINT8 patchJmp[] = {0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90};
|
||||||
DBG_RT("==> xcpm_idle at %llx\n", procLocation);
|
DBG_RT("==> xcpm_idle at %llx\n", procLocation);
|
||||||
INTN Num = SearchAndReplace(&Kernel[procLocation], 0x400, findJmp, sizeof(findJmp), patchJmp, 0);
|
INTN Num = SearchAndReplace(&Kernel[procLocation], 0x400, findJmp, sizeof(findJmp), patchJmp, 0);
|
||||||
|
DBG_RT("==> found %lld patterns\n", Num);
|
||||||
//2. procedure xcpm_init
|
//2. procedure xcpm_init
|
||||||
// indirect call to _xcpm_core_scope_msrs and _xcpm_SMT_scope_msrs
|
// indirect call to _xcpm_core_scope_msrs and _xcpm_SMT_scope_msrs
|
||||||
// 488D3DDA317600 lea rdi, qword [ds:_xcpm_SMT_scope_msrs]
|
// 488D3DDA317600 lea rdi, qword [ds:_xcpm_SMT_scope_msrs]
|
||||||
@ -796,7 +798,7 @@ BOOLEAN LOADER_ENTRY::KernelPatchPm(VOID *kernelData)
|
|||||||
UINTN symbol2 = searchProc(Kernel, "_xcpm_SMT_scope_msrs", &procLen);
|
UINTN symbol2 = searchProc(Kernel, "_xcpm_SMT_scope_msrs", &procLen);
|
||||||
patchLocation1 = FindRelative32(Kernel, procLocation, 0x200, symbol2);
|
patchLocation1 = FindRelative32(Kernel, procLocation, 0x200, symbol2);
|
||||||
if (patchLocation1 != 0) {
|
if (patchLocation1 != 0) {
|
||||||
DBG_RT("=> _xcpm_SMT_scope_msrs found at %llx\n", patchLocation2);
|
DBG_RT("=> _xcpm_SMT_scope_msrs found at %llx\n", patchLocation1);
|
||||||
if (Kernel[patchLocation1 + 7] == 0xE8) {
|
if (Kernel[patchLocation1 + 7] == 0xE8) {
|
||||||
DBG_RT("=> patch applied\n");
|
DBG_RT("=> patch applied\n");
|
||||||
Kernel[patchLocation1] = 0xEB;
|
Kernel[patchLocation1] = 0xEB;
|
||||||
|
Loading…
Reference in New Issue
Block a user