]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/Mem/Imem.h
MdeModulePkg/DxeCore: Implement heap guard feature for UEFI
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / Mem / Imem.h
index fb53f95575f07b5109f2a6ead9ec330b4c62109a..8a6ae50b8863ce7c96a06c7e8089f3f88d3002b8 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Data structure and functions to allocate and free memory space.\r
 \r
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -61,6 +61,7 @@ typedef struct {
   @param  PoolType               The type of memory for the new pool pages\r
   @param  NumberOfPages          No of pages to allocate\r
   @param  Alignment              Bits to align.\r
+  @param  NeedGuard              Flag to indicate Guard page is needed or not
 \r
   @return The allocated memory, or NULL\r
 \r
@@ -69,7 +70,8 @@ VOID *
 CoreAllocatePoolPages (\r
   IN EFI_MEMORY_TYPE    PoolType,\r
   IN UINTN              NumberOfPages,\r
-  IN UINTN              Alignment\r
+  IN UINTN              Alignment,
+  IN BOOLEAN            NeedGuard
   );\r
 \r
 \r
@@ -95,6 +97,7 @@ CoreFreePoolPages (
 \r
   @param  PoolType               Type of pool to allocate\r
   @param  Size                   The amount of pool to allocate\r
+  @param  NeedGuard              Flag to indicate Guard page is needed or not
 \r
   @return The allocate pool, or NULL\r
 \r
@@ -102,7 +105,8 @@ CoreFreePoolPages (
 VOID *\r
 CoreAllocatePoolI (\r
   IN EFI_MEMORY_TYPE  PoolType,\r
-  IN UINTN            Size\r
+  IN UINTN            Size,
+  IN BOOLEAN          NeedGuard
   );\r
 \r
 \r
@@ -145,6 +149,34 @@ CoreReleaseMemoryLock (
   VOID\r
   );\r
 \r
+/**
+  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
+  );
 \r
 //\r
 // Internal Global data\r