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

Method PatchKext

rEFIt_UEFI/Platform/kext_patcher.cpp:1234–1315  ·  view source on GitHub ↗

PatchKext is called for every kext from prelinked kernel (kernelcache) or from DevTree (booting with drivers). Add kext detection code here and call kext specific patch function.

Source from the content-addressed store, hash-verified

1232// Add kext detection code here and call kext specific patch function.
1233//
1234VOID LOADER_ENTRY::PatchKext(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize)
1235{
1236 if (KernelAndKextPatches.KPATIConnectorsController.notEmpty()) {
1237 //
1238 // ATIConnectors
1239 //
1240 if (!ATIConnectorsPatchInited) {
1241 ATIConnectorsPatchInit();
1242 }
1243 if ( AsciiStrStr(InfoPlist, ATIKextBundleId[0]) != NULL // ATI boundle id
1244 || AsciiStrStr(InfoPlist, ATIKextBundleId[1]) != NULL // AMD boundle id
1245 || AsciiStrStr(InfoPlist, "com.apple.kext.ATIFramebuffer") != NULL // SnowLeo
1246 || AsciiStrStr(InfoPlist, "com.apple.kext.AMDFramebuffer") != NULL //Maverics
1247 ) {
1248 ATIConnectorsPatch(Driver, DriverSize, InfoPlist, InfoPlistSize);
1249 return;
1250 }
1251 }
1252
1253 ExtractKextBundleIdentifier(InfoPlist);
1254
1255 if (KernelAndKextPatches.KPAppleIntelCPUPM &&
1256 (AsciiStrStr(InfoPlist,
1257 "<string>com.apple.driver.AppleIntelCPUPowerManagement</string>") != NULL)) {
1258 //
1259 // AppleIntelCPUPM
1260 //
1261 AppleIntelCPUPMPatch(Driver, DriverSize, InfoPlist, InfoPlistSize);
1262 } else if (KernelAndKextPatches.KPAppleRTC &&
1263 (AsciiStrStr(InfoPlist, "com.apple.driver.AppleRTC") != NULL)) {
1264 //
1265 // AppleRTC
1266 //
1267 AppleRTCPatch(Driver, DriverSize, InfoPlist, InfoPlistSize);
1268 } else if (KernelAndKextPatches.KPDELLSMBIOS &&
1269 (AsciiStrStr(InfoPlist, "com.apple.driver.AppleSMBIOS") != NULL)) {
1270 //
1271 // DellSMBIOSPatch
1272 //
1273 DBG_RT("Remap SMBIOS Table require, AppleSMBIOS...\n");
1274 DellSMBIOSPatch(Driver, DriverSize, InfoPlist, InfoPlistSize);
1275 } else if (KernelAndKextPatches.KPDELLSMBIOS &&
1276 (AsciiStrStr(InfoPlist, "com.apple.driver.AppleACPIPlatform") != NULL)) {
1277 //
1278 // DellSMBIOS
1279 //
1280 // AppleACPIPlatform
1281 //
1282 DellSMBIOSPatch(Driver, DriverSize, InfoPlist, InfoPlistSize);
1283 } else if (gBDWEIOPCIFixRequire && (AsciiStrStr(InfoPlist, "com.apple.iokit.IOPCIFamily") != NULL)) {
1284 //
1285 // Broadwell-E IOPCIFamily Patch
1286 //
1287 BDWE_IOPCIPatch(Driver, DriverSize, InfoPlist, InfoPlistSize);
1288 } else if (gSNBEAICPUFixRequire && (AsciiStrStr(InfoPlist, "com.apple.driver.AppleIntelCPUPowerManagement") != NULL)) {
1289 //
1290 // SandyBridge-E AppleIntelCPUPowerManagement Patch implemented by syscl
1291 //

Callers

nothing calls this directly

Calls 6

AsciiStrCmpFunction · 0.85
notEmptyMethod · 0.45
sizeMethod · 0.45
containsMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected