diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h index 7f1b81a180..a35a4bf282 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain.h +++ b/MdeModulePkg/Core/Dxe/DxeMain.h @@ -274,7 +274,7 @@ extern EFI_SECURITY_ARCH_PROTOCOL *gSecurity; extern EFI_SECURITY2_ARCH_PROTOCOL *gSecurity2; extern EFI_BDS_ARCH_PROTOCOL *gBds; extern EFI_SMM_BASE2_PROTOCOL *gSmmBase2; -extern EFI_MEMORY_ATTRIBUTE_PROTOCOL *MemoryAttributeProtocol; // MU_CHANGE +extern EFI_MEMORY_ATTRIBUTE_PROTOCOL *mMemoryAttributeProtocol; // MU_CHANGE extern volatile EFI_TPL gEfiCurrentTpl; // MS_CHANGE diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c index c5012924f3..7dd6bf0267 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Page.c +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c @@ -1570,8 +1570,8 @@ CoreInternalFreePages ( // MU_CHANGE Start: Unprotect page(s) before free if the memory will be cleared on free UINT64 Attributes; - if (DebugClearMemoryEnabled () && (MemoryAttributeProtocol != NULL)) { - Status = MemoryAttributeProtocol->GetMemoryAttributes (MemoryAttributeProtocol, Memory, EFI_PAGES_TO_SIZE (NumberOfPages), &Attributes); + if (DebugClearMemoryEnabled () && (mMemoryAttributeProtocol != NULL)) { + Status = mMemoryAttributeProtocol->GetMemoryAttributes (mMemoryAttributeProtocol, Memory, EFI_PAGES_TO_SIZE (NumberOfPages), &Attributes); if ((Attributes & EFI_MEMORY_RO) || (Attributes & EFI_MEMORY_RP) || (Status == EFI_NO_MAPPING)) { Status = ClearAccessAttributesFromMemoryRange (Memory, EFI_PAGES_TO_SIZE (NumberOfPages)); diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c index da5179a79a..53100e2a6e 100644 --- a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c +++ b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c @@ -1580,8 +1580,8 @@ ApplyMemoryProtectionPolicy ( // To catch the edge case where the attributes are not consistent across the range, get the // attributes from the page table to see if they are consistent. If they are not consistent, // GetMemoryAttributes() will return an error. - if (MemoryAttributeProtocol != NULL) { - if (!EFI_ERROR (MemoryAttributeProtocol->GetMemoryAttributes (MemoryAttributeProtocol, Memory, Length, &OldAttributes)) && + if (mMemoryAttributeProtocol != NULL) { + if (!EFI_ERROR (mMemoryAttributeProtocol->GetMemoryAttributes (mMemoryAttributeProtocol, Memory, Length, &OldAttributes)) && (OldAttributes == NewAttributes)) { return EFI_SUCCESS; diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryProtectionSupport.c b/MdeModulePkg/Core/Dxe/Misc/MemoryProtectionSupport.c index a383db1a8c..d282c5399c 100644 --- a/MdeModulePkg/Core/Dxe/Misc/MemoryProtectionSupport.c +++ b/MdeModulePkg/Core/Dxe/Misc/MemoryProtectionSupport.c @@ -26,7 +26,7 @@ MEMORY_PROTECTION_SPECIAL_REGION_PRIVATE_LIST_HEAD mSpecialMemoryRegionsPrivate }; BOOLEAN mEnhancedMemoryProtectionActive = TRUE; -EFI_MEMORY_ATTRIBUTE_PROTOCOL *MemoryAttributeProtocol = NULL; +EFI_MEMORY_ATTRIBUTE_PROTOCOL *mMemoryAttributeProtocol = NULL; UINT8 *mBitmapGlobal = NULL; LIST_ENTRY **mArrayOfListEntryPointers = NULL; @@ -3434,7 +3434,7 @@ MemoryAttributeProtocolNotify ( { EFI_STATUS Status; - Status = gBS->LocateProtocol (&gEfiMemoryAttributeProtocolGuid, NULL, (VOID **)&MemoryAttributeProtocol); + Status = gBS->LocateProtocol (&gEfiMemoryAttributeProtocolGuid, NULL, (VOID **)&mMemoryAttributeProtocol); if (EFI_ERROR (Status)) { DEBUG (( @@ -3529,8 +3529,8 @@ UninstallMemoryAttributeProtocol ( UINTN Index; EFI_HANDLE *HandleBuffer; - if (MemoryAttributeProtocol == NULL) { - Status = gBS->LocateProtocol (&gEfiMemoryAttributeProtocolGuid, NULL, (VOID **)&MemoryAttributeProtocol); + if (mMemoryAttributeProtocol == NULL) { + Status = gBS->LocateProtocol (&gEfiMemoryAttributeProtocolGuid, NULL, (VOID **)&mMemoryAttributeProtocol); if (EFI_ERROR (Status)) { return; } @@ -3549,7 +3549,7 @@ UninstallMemoryAttributeProtocol ( Status = gBS->UninstallProtocolInterface ( HandleBuffer[Index], &gEfiMemoryAttributeProtocolGuid, - MemoryAttributeProtocol + mMemoryAttributeProtocol ); ASSERT_EFI_ERROR (Status); }