MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / FindMethod

Function FindMethod

rEFIt_UEFI/Platform/FixBiosDsdt.cpp:1360–1373  ·  view source on GitHub ↗

if (!FindMethod(dsdt, len, "DTGP")) return address of size field. Assume size not more then 0x0FFF = 4095 bytes assuming only short methods

Source from the content-addressed store, hash-verified

1358// return address of size field. Assume size not more then 0x0FFF = 4095 bytes
1359//assuming only short methods
1360UINT32 FindMethod (UINT8 *dsdt, UINT32 len, CONST CHAR8* Name)
1361{
1362 UINT32 i;
1363 for (i = 0; len >= 7 && i < len - 7; i++) {
1364 if (((dsdt[i] == 0x14) || (dsdt[i+1] == 0x14) || (i>0 && dsdt[i-1] == 0x14)) &&
1365 (dsdt[i+3] == Name[0]) && (dsdt[i+4] == Name[1]) &&
1366 (dsdt[i+5] == Name[2]) && (dsdt[i+6] == Name[3])
1367 ){
1368 if (i>0 && dsdt[i-1] == 0x14) return i;
1369 return (dsdt[i+1] == 0x14)?(i+2):(i+1); //pointer to size field
1370 }
1371 }
1372 return 0;
1373}
1374
1375//this procedure corrects size of outer method. Embedded methods is not proposed
1376// adr - a place of changes

Callers 14

FIXLPCBFunction · 0.85
FIXDisplayFunction · 0.85
AddHDMIFunction · 0.85
FIXNetworkFunction · 0.85
FIXAirportFunction · 0.85
FIXSBUSFunction · 0.85
FIXFirewireFunction · 0.85
AddHDEFFunction · 0.85
FIXUSBFunction · 0.85
FIXIDEFunction · 0.85
FIXSATAAHCIFunction · 0.85
FIXSATAFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected