OcAppleBootCompatLib: Add comments about MAT issues
@@ -55,6 +55,13 @@ FixRuntimeAttributes (
}
if (BootCompat->Settings.SyncRuntimePermissions && BootCompat->ServiceState.FwRuntime != NULL) {
+ //
+ // Some firmwares do not update MAT after loading runtime drivers after EndOfDxe.
+ // Since the memory used to allocate runtime driver resides in BINs, MAT has whatever
+ // permissions designated for unused memory. Mark unused memory containing our driver
+ // as executable here.
+ // REF: https://github.com/acidanthera/bugtracker/issues/491#issuecomment-606835337
+ //
Status = BootCompat->ServiceState.FwRuntime->GetExecArea (&Address, &Pages);
if (!EFI_ERROR (Status)) {
@@ -438,6 +445,10 @@ OcGetMemoryMap (
}
if (BootCompat->Settings.SyncRuntimePermissions && BootCompat->ServiceState.FwRuntime != NULL) {
+ //
+ // Some firmwares mark runtime drivers loaded after EndOfDxe as EfiRuntimeServicesData:
+ // REF: https://github.com/acidanthera/bugtracker/issues/791#issuecomment-607935508
+ //
Status2 = BootCompat->ServiceState.FwRuntime->GetExecArea (&Address, &Pages);
if (!EFI_ERROR (Status2)) {
