X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FCore%2FDxe%2FMem%2FImem.h;h=e58a5d62babbd18eda6e6440ca5ade1be6b71a64;hp=a76ae2fe67acf8deae42bee5739453ee6863d18a;hb=05cfd73f011f67541cf4add560ab213daa8a99ed;hpb=d2f87ac0576af7f8b67e2f0179c0c5786c6271b7 diff --git a/MdeModulePkg/Core/Dxe/Mem/Imem.h b/MdeModulePkg/Core/Dxe/Mem/Imem.h index a76ae2fe67..e58a5d62ba 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Imem.h +++ b/MdeModulePkg/Core/Dxe/Mem/Imem.h @@ -1,7 +1,7 @@ /** @file Data structure and functions to allocate and free memory space. -Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -19,7 +19,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // +---------------------------------------------------+ // | 0..(EfiMaxMemoryType - 1) - Normal memory type | // +---------------------------------------------------+ -// | EfiMaxMemoryType..0x6FFFFFFF - Ilegal | +// | EfiMaxMemoryType..0x6FFFFFFF - Invalid | // +---------------------------------------------------+ // | 0x70000000..0x7FFFFFFF - OEM reserved | // +---------------------------------------------------+ @@ -61,6 +61,7 @@ typedef struct { @param PoolType The type of memory for the new pool pages @param NumberOfPages No of pages to allocate @param Alignment Bits to align. + @param NeedGuard Flag to indicate Guard page is needed or not @return The allocated memory, or NULL @@ -69,7 +70,8 @@ VOID * CoreAllocatePoolPages ( IN EFI_MEMORY_TYPE PoolType, IN UINTN NumberOfPages, - IN UINTN Alignment + IN UINTN Alignment, + IN BOOLEAN NeedGuard ); @@ -95,6 +97,7 @@ CoreFreePoolPages ( @param PoolType Type of pool to allocate @param Size The amount of pool to allocate + @param NeedGuard Flag to indicate Guard page is needed or not @return The allocate pool, or NULL @@ -102,7 +105,8 @@ CoreFreePoolPages ( VOID * CoreAllocatePoolI ( IN EFI_MEMORY_TYPE PoolType, - IN UINTN Size + IN UINTN Size, + IN BOOLEAN NeedGuard ); @@ -112,6 +116,7 @@ CoreAllocatePoolI ( Caller must have the memory lock held @param Buffer The allocated pool entry to free + @param PoolType Pointer to pool type @retval EFI_INVALID_PARAMETER Buffer not valid @retval EFI_SUCCESS Buffer successfully freed. @@ -119,7 +124,8 @@ CoreAllocatePoolI ( **/ EFI_STATUS CoreFreePoolI ( - IN VOID *Buffer + IN VOID *Buffer, + OUT EFI_MEMORY_TYPE *PoolType OPTIONAL ); @@ -143,6 +149,34 @@ CoreReleaseMemoryLock ( VOID ); +/** + Allocates pages from the memory map. + + @param Type The type of allocation to perform + @param MemoryType The type of memory to turn the allocated pages + into + @param NumberOfPages The number of pages to allocate + @param Memory A pointer to receive the base allocated memory + address + @param NeedGuard Flag to indicate Guard page is needed or not + + @return Status. On success, Memory is filled in with the base address allocated + @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in + spec. + @retval EFI_NOT_FOUND Could not allocate pages match the requirement. + @retval EFI_OUT_OF_RESOURCES No enough pages to allocate. + @retval EFI_SUCCESS Pages successfully allocated. + +**/ +EFI_STATUS +EFIAPI +CoreInternalAllocatePages ( + IN EFI_ALLOCATE_TYPE Type, + IN EFI_MEMORY_TYPE MemoryType, + IN UINTN NumberOfPages, + IN OUT EFI_PHYSICAL_ADDRESS *Memory, + IN BOOLEAN NeedGuard + ); // // Internal Global data