X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FCore%2FDxe%2FMem%2FPage.c;fp=MdeModulePkg%2FCore%2FDxe%2FMem%2FPage.c;h=8d5d03a6d90a8d13e5c520dfcd5f18e1a3ddd5e2;hp=db32d0f940de983898fc5a7a2d22a2eff8c58ea8;hb=425d25699be83c35e12df8470b827d7fbcef3bce;hpb=d40695ad82a6a9990d4e73bc9cc3de123eda7a90 diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c index db32d0f940..8d5d03a6d9 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Page.c +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c @@ -900,42 +900,17 @@ CoreConvertPagesEx ( // CoreAddRange (MemType, Start, RangeEnd, Attribute); if (ChangingType && (MemType == EfiConventionalMemory)) { + // + // Avoid calling DEBUG_CLEAR_MEMORY() for an address of 0 because this + // macro will ASSERT() if address is 0. Instead, CoreAddRange() guarantees + // that the page starting at address 0 is always filled with zeros. + // if (Start == 0) { - // - // Avoid calling DEBUG_CLEAR_MEMORY() for an address of 0 because this - // macro will ASSERT() if address is 0. Instead, CoreAddRange() - // guarantees that the page starting at address 0 is always filled - // with zeros. - // if (RangeEnd > EFI_PAGE_SIZE) { DEBUG_CLEAR_MEMORY ((VOID *)(UINTN) EFI_PAGE_SIZE, (UINTN) (RangeEnd - EFI_PAGE_SIZE + 1)); } } else { - // - // If Heap Guard is enabled, the page at the top and/or bottom of - // this memory block to free might be inaccessible. Skipping them - // to avoid page fault exception. - // - UINT64 StartToClear; - UINT64 EndToClear; - - StartToClear = Start; - EndToClear = RangeEnd + 1; - if (PcdGet8 (PcdHeapGuardPropertyMask) & (BIT1|BIT0)) { - if (IsGuardPage(StartToClear)) { - StartToClear += EFI_PAGE_SIZE; - } - if (IsGuardPage (EndToClear - 1)) { - EndToClear -= EFI_PAGE_SIZE; - } - } - - if (EndToClear > StartToClear) { - DEBUG_CLEAR_MEMORY( - (VOID *)(UINTN)StartToClear, - (UINTN)(EndToClear - StartToClear) - ); - } + DEBUG_CLEAR_MEMORY ((VOID *)(UINTN) Start, (UINTN) (RangeEnd - Start + 1)); } } @@ -1513,9 +1488,6 @@ CoreInternalFreePages ( Done: CoreReleaseMemoryLock (); - if (IsGuarded) { - UnsetGuardForMemory(Memory, NumberOfPages); - } return Status; }