mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-12 09:54:36 +01:00
Merge branch 'master' of https://github.com/CloverHackyColor/CloverBootloader
This commit is contained in:
commit
b0444eac74
@ -456,10 +456,18 @@ VOID PatchAllTables()
|
||||
DBG(" disabled\n");
|
||||
continue;
|
||||
}
|
||||
Len = FixAny((UINT8*)NewTable, Len,
|
||||
(const UINT8*)gSettings.PatchDsdtFind[i], gSettings.LenToFind[i],
|
||||
(const UINT8*)gSettings.PatchDsdtReplace[i], gSettings.LenToReplace[i]);
|
||||
//DBG(" OK\n");
|
||||
if (!gSettings.PatchDsdtTgt[i]) {
|
||||
Len = FixAny((UINT8*)NewTable, Len,
|
||||
(const UINT8*)gSettings.PatchDsdtFind[i], gSettings.LenToFind[i],
|
||||
(const UINT8*)gSettings.PatchDsdtReplace[i], gSettings.LenToReplace[i]);
|
||||
//DBG(" OK\n");
|
||||
}else{
|
||||
//DBG("Patching: renaming in bridge\n");
|
||||
Len = FixRenameByBridge2((UINT8*)NewTable, Len,
|
||||
gSettings.PatchDsdtTgt[i],
|
||||
(const UINT8*)gSettings.PatchDsdtFind[i], gSettings.LenToFind[i],
|
||||
(const UINT8*)gSettings.PatchDsdtReplace[i], gSettings.LenToReplace[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// fixup length and checksum
|
||||
|
@ -1790,13 +1790,12 @@ UINT32 FixAny (UINT8* dsdt, UINT32 len, const UINT8* ToFind, UINT32 LenTF, const
|
||||
}
|
||||
|
||||
//new method. by goodwin_c
|
||||
UINT32 FixRenameByBridge2 (UINT8* dsdt, UINT32 len, CHAR8* TgtBrgName, const UINT8* ToFind, UINT32 LenTF, UINT8* ToReplace, UINT32 LenTR)
|
||||
UINT32 FixRenameByBridge2 (UINT8* dsdt, UINT32 len, CHAR8* TgtBrgName, const UINT8* ToFind, UINT32 LenTF, const UINT8* ToReplace, UINT32 LenTR)
|
||||
{
|
||||
INT32 adr;
|
||||
BOOLEAN found = FALSE;
|
||||
UINT32 i, k;
|
||||
UINT32 BrdADR = 0, BridgeSize;
|
||||
UINT32 PCIADR, PCISIZE = 0;
|
||||
|
||||
if (!ToFind || !LenTF || !LenTR) {
|
||||
DBG(" invalid patches!\n");
|
||||
@ -1814,12 +1813,6 @@ UINT32 FixRenameByBridge2 (UINT8* dsdt, UINT32 len, CHAR8* TgtBrgName, const UIN
|
||||
return len;
|
||||
}
|
||||
|
||||
PCIADR = GetPciDevice(dsdt, len);
|
||||
if (PCIADR) {
|
||||
PCISIZE = get_size(dsdt, PCIADR);
|
||||
}
|
||||
if (!PCISIZE) return len; //what is the bad DSDT ?!
|
||||
|
||||
DBG("Start ByBridge Rename Fix\n");
|
||||
for (i=0x20; len >= 10 && i < len - 10; i++) {
|
||||
if (CmpDev(dsdt, i, (UINT8*)TgtBrgName)) {
|
||||
@ -5352,10 +5345,8 @@ VOID FixBiosDsdt(UINT8* temp, EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, C
|
||||
// DBG("Patching: renaming in bridge\n");
|
||||
DsdtLen = FixRenameByBridge2(temp, DsdtLen,
|
||||
gSettings.PatchDsdtTgt[i],
|
||||
(const UINT8*)gSettings.PatchDsdtFind[i],
|
||||
gSettings.LenToFind[i],
|
||||
gSettings.PatchDsdtReplace[i],
|
||||
gSettings.LenToReplace[i]);
|
||||
(const UINT8*)gSettings.PatchDsdtFind[i], gSettings.LenToFind[i],
|
||||
(const UINT8*)gSettings.PatchDsdtReplace[i], gSettings.LenToReplace[i]);
|
||||
|
||||
}
|
||||
} else {
|
||||
|
@ -92,5 +92,17 @@ FixAny (
|
||||
);
|
||||
|
||||
|
||||
UINT32
|
||||
FixRenameByBridge2 (
|
||||
UINT8* dsdt,
|
||||
UINT32 len,
|
||||
CHAR8* TgtBrgName,
|
||||
const UINT8* ToFind,
|
||||
UINT32 LenTF,
|
||||
const UINT8* ToReplace,
|
||||
UINT32 LenTR
|
||||
);
|
||||
|
||||
|
||||
|
||||
#endif /* PLATFORM_FIXBIOSDSDT_H_ */
|
||||
|
@ -85,7 +85,7 @@ EFI_STATUS LOADER_ENTRY::getVTable()
|
||||
//00FFFFFF FF0FFFFF 00000000 FFFFFFFF
|
||||
|
||||
// INT32 Tabble = FindBin(KernelData, 0x5000000, vtableSur, 8);
|
||||
INT32 NTabble = FindBin(KernelData, 0x5000000, (const UINT8 *)ctor_used, (UINT32)strlen(ctor_used));
|
||||
INT32 NTabble = FindBin(KernelData, 0x2000000, (const UINT8 *)ctor_used, (UINT32)strlen(ctor_used));
|
||||
if (NTabble < 0) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
@ -1087,7 +1087,7 @@ VOID EFIAPI LOADER_ENTRY::KernelBooterExtensionsPatch()
|
||||
//ffffff80009a227b
|
||||
UINTN taskLocation = searchProc("IOTaskHasEntitlement");
|
||||
procLocation = searchProc("loadExecutable");
|
||||
patchLocation2 = FindMemMask(&KernelData[procLocation], 0x1000, find3, sizeof(find3), mask3, sizeof(mask3));
|
||||
patchLocation2 = FindMemMask(&KernelData[procLocation], 0x500, find3, sizeof(find3), mask3, sizeof(mask3));
|
||||
DBG("IOTaskHasEntitlement at 0x%llx, loadExecutable at 0x%llx\n", taskLocation, procLocation);
|
||||
if (patchLocation2 != KERNEL_MAX_SIZE) {
|
||||
DBG_RT("=> patch SIP applied\n");
|
||||
@ -1099,7 +1099,7 @@ VOID EFIAPI LOADER_ENTRY::KernelBooterExtensionsPatch()
|
||||
KernelData[patchLocation2 + 4] = 0x12;
|
||||
}
|
||||
} else {
|
||||
patchLocation2 = FindRelative32(KernelData, procLocation, 0x1000, taskLocation);
|
||||
patchLocation2 = FindRelative32(KernelData, procLocation, 0x500, taskLocation);
|
||||
if (patchLocation2 != 0) {
|
||||
DBG_RT("=> patch2 SIP applied\n");
|
||||
KernelData[patchLocation2] = 0xEB;
|
||||
|
Loading…
Reference in New Issue
Block a user