TianoCore EDK2 master
|
#include <IndustryStandard/PeImage.h>
Go to the source code of this file.
Data Structures | |
struct | PAGE_TABLE_LIB_PAGING_CONTEXT_IA32 |
struct | PAGE_TABLE_LIB_PAGING_CONTEXT_X64 |
union | PAGE_TABLE_LIB_PAGING_CONTEXT_DATA |
struct | PAGE_TABLE_LIB_PAGING_CONTEXT |
struct | PAGE_TABLE_POOL |
Macros | |
#define | PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_PSE BIT0 |
#define | PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_PAE BIT1 |
#define | PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_PAGE_1G_SUPPORT BIT2 |
#define | PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_5_LEVEL BIT3 |
#define | PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_WP_ENABLE BIT30 |
#define | PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_XD_ACTIVATED BIT31 |
#define | PAGE_TABLE_POOL_ALIGNMENT BASE_2MB |
#define | PAGE_TABLE_POOL_UNIT_SIZE SIZE_2MB |
#define | PAGE_TABLE_POOL_UNIT_PAGES EFI_SIZE_TO_PAGES (PAGE_TABLE_POOL_UNIT_SIZE) |
#define | PAGE_TABLE_POOL_ALIGN_MASK (~(EFI_PHYSICAL_ADDRESS)(PAGE_TABLE_POOL_ALIGNMENT - 1)) |
Typedefs | |
typedef VOID *(EFIAPI * | PAGE_TABLE_LIB_ALLOCATE_PAGES) (IN UINTN Pages) |
Functions | |
RETURN_STATUS EFIAPI | AssignMemoryPageAttributes (IN PAGE_TABLE_LIB_PAGING_CONTEXT *PagingContext OPTIONAL, IN PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes, IN PAGE_TABLE_LIB_ALLOCATE_PAGES AllocatePagesFunc OPTIONAL) |
VOID | InitializePageTableLib (VOID) |
VOID *EFIAPI | AllocatePageTableMemory (IN UINTN Pages) |
VOID | GetPagingDetails (IN PAGE_TABLE_LIB_PAGING_CONTEXT_DATA *PagingContextData, OUT UINTN **PageTableBase OPTIONAL, OUT UINT32 **Attributes OPTIONAL) |
Page table management header file.
Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file CpuPageTable.h.
#define PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_5_LEVEL BIT3 |
Definition at line 17 of file CpuPageTable.h.
#define PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_PAE BIT1 |
Definition at line 15 of file CpuPageTable.h.
#define PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_PAGE_1G_SUPPORT BIT2 |
Definition at line 16 of file CpuPageTable.h.
#define PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_PSE BIT0 |
Definition at line 14 of file CpuPageTable.h.
#define PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_WP_ENABLE BIT30 |
Definition at line 18 of file CpuPageTable.h.
#define PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_XD_ACTIVATED BIT31 |
Definition at line 19 of file CpuPageTable.h.
#define PAGE_TABLE_POOL_ALIGN_MASK (~(EFI_PHYSICAL_ADDRESS)(PAGE_TABLE_POOL_ALIGNMENT - 1)) |
Definition at line 51 of file CpuPageTable.h.
#define PAGE_TABLE_POOL_ALIGNMENT BASE_2MB |
Definition at line 48 of file CpuPageTable.h.
#define PAGE_TABLE_POOL_UNIT_PAGES EFI_SIZE_TO_PAGES (PAGE_TABLE_POOL_UNIT_SIZE) |
Definition at line 50 of file CpuPageTable.h.
#define PAGE_TABLE_POOL_UNIT_SIZE SIZE_2MB |
Definition at line 49 of file CpuPageTable.h.
Allocates one or more 4KB pages for page table.
Pages | The number of 4 KB pages to allocate. |
Definition at line 69 of file CpuPageTable.h.
This API provides a way to allocate memory for page table.
This API can be called more once to allocate memory for page tables.
Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
Pages | The number of 4 KB pages to allocate. |
This API provides a way to allocate memory for page table.
This API can be called more than once to allocate memory for page tables.
Allocates the number of 4KB pages and returns a pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary.
If Pages is 0, then NULL is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
Pages | The number of 4 KB pages to allocate. |
This API provides a way to allocate memory for page table.
Pages | The number of 4 KB pages to allocate. |
Definition at line 314 of file VirtualMemory.c.
RETURN_STATUS EFIAPI AssignMemoryPageAttributes | ( | IN PAGE_TABLE_LIB_PAGING_CONTEXT *PagingContext | OPTIONAL, |
IN PHYSICAL_ADDRESS | BaseAddress, | ||
IN UINT64 | Length, | ||
IN UINT64 | Attributes, | ||
IN PAGE_TABLE_LIB_ALLOCATE_PAGES AllocatePagesFunc | OPTIONAL | ||
) |
This function assigns the page attributes for the memory region specified by BaseAddress and Length from their current attributes to the attributes specified by Attributes.
Caller should make sure BaseAddress and Length is at page boundary.
Caller need guarantee the TPL <= TPL_NOTIFY, if there is split page request.
PagingContext | The paging context. NULL means get page table from current CPU context. |
BaseAddress | The physical address that is the start address of a memory region. |
Length | The size in bytes of the memory region. |
Attributes | The bit mask of attributes to set for the memory region. |
AllocatePagesFunc | If page split is needed, this function is used to allocate more pages. NULL mean page split is unsupported. |
RETURN_SUCCESS | The attributes were cleared for the memory region. |
RETURN_ACCESS_DENIED | The attributes for the memory resource range specified by BaseAddress and Length cannot be modified. |
RETURN_INVALID_PARAMETER | Length is zero. Attributes specified an illegal combination of attributes that cannot be set together. |
RETURN_OUT_OF_RESOURCES | There are not enough system resources to modify the attributes of the memory resource range. |
RETURN_UNSUPPORTED | The processor does not support one or more bytes of the memory resource range specified by BaseAddress and Length. The bit mask of attributes is not support for the memory resource range specified by BaseAddress and Length. |
This function assigns the page attributes for the memory region specified by BaseAddress and Length from their current attributes to the attributes specified by Attributes.
Caller should make sure BaseAddress and Length is at page boundary.
Caller need guarantee the TPL <= TPL_NOTIFY, if there is split page request.
[in] | PagingContext | The paging context. NULL means get page table from current CPU context. |
[in] | BaseAddress | The physical address that is the start address of a memory region. |
[in] | Length | The size in bytes of the memory region. |
[in] | Attributes | The bit mask of attributes to set for the memory region. |
[in] | AllocatePagesFunc | If page split is needed, this function is used to allocate more pages. NULL mean page split is unsupported. |
RETURN_SUCCESS | The attributes were cleared for the memory region. |
RETURN_ACCESS_DENIED | The attributes for the memory resource range specified by BaseAddress and Length cannot be modified. |
RETURN_INVALID_PARAMETER | Length is zero. Attributes specified an illegal combination of attributes that cannot be set together. |
RETURN_OUT_OF_RESOURCES | There are not enough system resources to modify the attributes of the memory resource range. |
RETURN_UNSUPPORTED | The processor does not support one or more bytes of the memory resource range specified by BaseAddress and Length. The bit mask of attributes is not support for the memory resource range specified by BaseAddress and Length. |
Definition at line 912 of file CpuPageTable.c.
VOID GetPagingDetails | ( | IN PAGE_TABLE_LIB_PAGING_CONTEXT_DATA * | PagingContextData, |
OUT UINTN **PageTableBase | OPTIONAL, | ||
OUT UINT32 **Attributes | OPTIONAL | ||
) |
Get paging details.
PagingContextData | The paging context. |
PageTableBase | Return PageTableBase field. |
Attributes | Return Attributes field. |
Definition at line 20 of file PagingAttribute.c.
VOID InitializePageTableLib | ( | VOID | ) |
Initialize the Page Table lib.
Definition at line 1401 of file CpuPageTable.c.