]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/CpuDxe/CpuPageTable.h
UefiCpuPkg/CpuDxe: Enable protection for newly added page table
[mirror_edk2.git] / UefiCpuPkg / CpuDxe / CpuPageTable.h
index eaff595b4c903d89879ab33ab7ac57c217c786c8..48da9cdde7dd30e3b1e20fb630681ecf519a5529 100644 (file)
@@ -50,6 +50,19 @@ typedef struct {
   PAGE_TABLE_LIB_PAGING_CONTEXT_DATA     ContextData;\r
 } PAGE_TABLE_LIB_PAGING_CONTEXT;\r
 \r
+#define PAGE_TABLE_POOL_ALIGNMENT   BASE_2MB\r
+#define PAGE_TABLE_POOL_UNIT_SIZE   SIZE_2MB\r
+#define PAGE_TABLE_POOL_UNIT_PAGES  EFI_SIZE_TO_PAGES (PAGE_TABLE_POOL_UNIT_SIZE)\r
+#define PAGE_TABLE_POOL_ALIGN_MASK  \\r
+  (~(EFI_PHYSICAL_ADDRESS)(PAGE_TABLE_POOL_ALIGNMENT - 1))\r
+\r
+typedef struct {\r
+  VOID            *NextPool;\r
+  UINTN           Offset;\r
+  UINTN           FreePages;\r
+} PAGE_TABLE_POOL;\r
+\r
+\r
 /**\r
   Allocates one or more 4KB pages for page table.\r
 \r
@@ -110,4 +123,25 @@ InitializePageTableLib (
   VOID\r
   );\r
 \r
+/**\r
+  This API provides a way to allocate memory for page table.\r
+\r
+  This API can be called more once to allocate memory for page tables.\r
+\r
+  Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the\r
+  allocated buffer.  The buffer returned is aligned on a 4KB boundary.  If Pages is 0, then NULL\r
+  is returned.  If there is not enough memory remaining to satisfy the request, then NULL is\r
+  returned.\r
+\r
+  @param  Pages                 The number of 4 KB pages to allocate.\r
+\r
+  @return A pointer to the allocated buffer or NULL if allocation fails.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+AllocatePageTableMemory (\r
+  IN UINTN           Pages\r
+  );\r
+\r
 #endif\r