Skip to content

Commit

Permalink
Rename Memory Attribute Protocol Global
Browse files Browse the repository at this point in the history
Description

Renames MemoryAttributeProtocol global to mMemoryAttributeProtocol
to match convention.

- [ ] Impacts functionality?
  - **Functionality** - Does the change ultimately impact how firmware functions?
  - Examples: Add a new library, publish a new PPI, update an algorithm, ...
- [ ] Impacts security?
  - **Security** - Does the change have a direct security impact on an application,
    flow, or firmware?
  - Examples: Crypto algorithm change, buffer overflow fix, parameter
    validation improvement, ...
- [x] Breaking change?
  - **Breaking change** - Will anyone consuming this change experience a break
    in build or boot behavior?
  - Examples: Add a new library class, move a module to a different repo, call
    a function in a new library class in a pre-existing module, ...
- [ ] Includes tests?
  - **Tests** - Does the change include any explicit test code?
  - Examples: Unit tests, integration tests, robot tests, ...
- [ ] Includes documentation?
  - **Documentation** - Does the change contain explicit documentation additions
    outside direct code modifications (and comments)?
  - Examples: Update readme file, add feature readme file, link to documentation
    on an a separate Web page, ...

How This Was Tested

N/A

Integration Instructions

N/A
  • Loading branch information
TaylorBeebe committed Jan 19, 2024
1 parent ecff324 commit 6acfcf0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion MdeModulePkg/Core/Dxe/DxeMain.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions MdeModulePkg/Core/Dxe/Mem/Page.c
Original file line number Diff line number Diff line change
Expand Up @@ -1572,8 +1572,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));
Expand Down
4 changes: 2 additions & 2 deletions MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions MdeModulePkg/Core/Dxe/Misc/MemoryProtectionSupport.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 ((
Expand Down Expand Up @@ -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;
}
Expand All @@ -3549,7 +3549,7 @@ UninstallMemoryAttributeProtocol (
Status = gBS->UninstallProtocolInterface (
HandleBuffer[Index],
&gEfiMemoryAttributeProtocolGuid,
MemoryAttributeProtocol
mMemoryAttributeProtocol
);
ASSERT_EFI_ERROR (Status);
}
Expand Down

0 comments on commit 6acfcf0

Please sign in to comment.