OcAppleBootCompatLib: Update memory attributes before StartImage as well

This commit is contained in:
vit9696 2020-04-03 14:43:09 +03:00
parent ffb49563cd
commit bb8bd5dedb

View File

@ -447,6 +447,8 @@ OcStartImage (
BOOT_COMPAT_CONTEXT *BootCompat;
OC_FWRT_CONFIG Config;
UINTN DataSize;
EFI_PHYSICAL_ADDRESS Address;
UINTN Pages;
BootCompat = GetBootCompatContext ();
AppleLoadedImage = OcGetAppleBootLoadedImage (ImageHandle);
@ -462,6 +464,14 @@ OcStartImage (
gBS->CalculateCrc32 (gBS, gBS->Hdr.HeaderSize, &gBS->Hdr.CRC32);
}
if (BootCompat->Settings.SyncRuntimePermissions && BootCompat->ServiceState.FwRuntime != NULL) {
Status = BootCompat->ServiceState.FwRuntime->GetExecArea (&Address, &Pages);
if (!EFI_ERROR (Status)) {
OcUpdateAttributes (Address, EfiRuntimeServicesCode, EFI_MEMORY_RO, EFI_MEMORY_XP);
}
}
//
// Clear monitoring vars
//