X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FCore%2FDxe%2FMem%2FPool.c;h=5248ee2e6c0221cc2fbd713078b2a4a621c03da0;hp=ebb2fceedd8050c7202a20791b8ee278ece4ab91;hb=d4731a98a3a5ddc2fed73d2998884f2cbee44ba9;hpb=f31c36c2938d5857008d674e913e3fc0783fab49 diff --git a/MdeModulePkg/Core/Dxe/Mem/Pool.c b/MdeModulePkg/Core/Dxe/Mem/Pool.c index ebb2fceedd..5248ee2e6c 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Pool.c +++ b/MdeModulePkg/Core/Dxe/Mem/Pool.c @@ -310,6 +310,10 @@ CoreAllocatePoolPagesI ( Buffer = CoreAllocatePoolPages (PoolType, NoPages, Granularity); CoreReleaseMemoryLock (); + if (Buffer != NULL) { + ApplyMemoryProtectionPolicy (EfiConventionalMemory, PoolType, + (EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, EFI_PAGES_TO_SIZE (NoPages)); + } return Buffer; } @@ -348,9 +352,9 @@ CoreAllocatePoolI ( PoolType == EfiRuntimeServicesCode || PoolType == EfiRuntimeServicesData) { - Granularity = EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT; + Granularity = RUNTIME_PAGE_ALLOCATION_GRANULARITY; } else { - Granularity = DEFAULT_PAGE_ALLOCATION; + Granularity = DEFAULT_PAGE_ALLOCATION_GRANULARITY; } // @@ -560,6 +564,9 @@ CoreFreePoolPagesI ( CoreAcquireMemoryLock (); CoreFreePoolPages (Memory, NoPages); CoreReleaseMemoryLock (); + + ApplyMemoryProtectionPolicy (PoolType, EfiConventionalMemory, + (EFI_PHYSICAL_ADDRESS)(UINTN)Memory, EFI_PAGES_TO_SIZE (NoPages)); } /** @@ -636,9 +643,9 @@ CoreFreePoolI ( Head->Type == EfiRuntimeServicesCode || Head->Type == EfiRuntimeServicesData) { - Granularity = EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT; + Granularity = RUNTIME_PAGE_ALLOCATION_GRANULARITY; } else { - Granularity = DEFAULT_PAGE_ALLOCATION; + Granularity = DEFAULT_PAGE_ALLOCATION_GRANULARITY; } if (PoolType != NULL) {