TianoCore EDK2 master
Loading...
Searching...
No Matches
CpuPageTable.h
Go to the documentation of this file.
1
9#ifndef _PAGE_TABLE_LIB_H_
10#define _PAGE_TABLE_LIB_H_
11
13
14#define PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_PSE BIT0
15#define PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_PAE BIT1
16#define PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_PAGE_1G_SUPPORT BIT2
17#define PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_5_LEVEL BIT3
18#define PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_WP_ENABLE BIT30
19#define PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_XD_ACTIVATED BIT31
20// Other bits are reserved for future use
21typedef struct {
22 UINT32 PageTableBase;
23 UINT32 Reserved;
24 UINT32 Attributes;
26
27typedef struct {
28 UINT64 PageTableBase;
29 UINT32 Attributes;
31
32typedef union {
36
37typedef struct {
38 //
39 // PE32+ Machine type for EFI images
40 //
41 // #define IMAGE_FILE_MACHINE_I386 0x014c
42 // #define IMAGE_FILE_MACHINE_X64 0x8664
43 //
44 UINT16 MachineType;
47
48#define PAGE_TABLE_POOL_ALIGNMENT BASE_2MB
49#define PAGE_TABLE_POOL_UNIT_SIZE SIZE_2MB
50#define PAGE_TABLE_POOL_UNIT_PAGES EFI_SIZE_TO_PAGES (PAGE_TABLE_POOL_UNIT_SIZE)
51#define PAGE_TABLE_POOL_ALIGN_MASK \
52 (~(EFI_PHYSICAL_ADDRESS)(PAGE_TABLE_POOL_ALIGNMENT - 1))
53
54typedef struct {
55 VOID *NextPool;
56 UINTN Offset;
59
68typedef
69VOID *
71 IN UINTN Pages
72 );
73
102RETURN_STATUS
103EFIAPI
105 IN PAGE_TABLE_LIB_PAGING_CONTEXT *PagingContext OPTIONAL,
106 IN PHYSICAL_ADDRESS BaseAddress,
107 IN UINT64 Length,
108 IN UINT64 Attributes,
109 IN PAGE_TABLE_LIB_ALLOCATE_PAGES AllocatePagesFunc OPTIONAL
110 );
111
115VOID
117 VOID
118 );
119
135VOID *
136EFIAPI
138 IN UINTN Pages
139 );
140
149VOID
151 IN PAGE_TABLE_LIB_PAGING_CONTEXT_DATA *PagingContextData,
152 OUT UINTN **PageTableBase OPTIONAL,
153 OUT UINT32 **Attributes OPTIONAL
154 );
155
156#endif
UINT64 UINTN
VOID *EFIAPI AllocatePageTableMemory(IN UINTN Pages)
VOID InitializePageTableLib(VOID)
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)
Definition: CpuPageTable.c:912
VOID GetPagingDetails(IN PAGE_TABLE_LIB_PAGING_CONTEXT_DATA *PagingContextData, OUT UINTN **PageTableBase OPTIONAL, OUT UINT32 **Attributes OPTIONAL)
VOID *(EFIAPI * PAGE_TABLE_LIB_ALLOCATE_PAGES)(IN UINTN Pages)
Definition: CpuPageTable.h:70
VOID EFIAPI FreePages(IN VOID *Buffer, IN UINTN Pages)
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284