TianoCore EDK2 master
Loading...
Searching...
No Matches
PageTables.h File Reference

Go to the source code of this file.

Data Structures

union  IA32_GDT
 
struct  X64_IDT_GATE_DESCRIPTOR
 
union  PAGE_MAP_AND_DIRECTORY_POINTER
 
union  PAGE_TABLE_4K_ENTRY
 
union  PAGE_TABLE_ENTRY
 
union  PAGE_TABLE_1G_ENTRY
 
struct  PAGE_TABLE_POOL
 

Macros

#define SYS_CODE64_SEL   0x38
 
#define CR0_WP   BIT16
 
#define IA32_PG_P   BIT0
 
#define IA32_PG_RW   BIT1
 
#define IA32_PG_PS   BIT7
 
#define PAGING_PAE_INDEX_MASK   0x1FF
 
#define PAGING_4K_ADDRESS_MASK_64   0x000FFFFFFFFFF000ull
 
#define PAGING_2M_ADDRESS_MASK_64   0x000FFFFFFFE00000ull
 
#define PAGING_1G_ADDRESS_MASK_64   0x000FFFFFC0000000ull
 
#define PAGING_L1_ADDRESS_SHIFT   12
 
#define PAGING_L2_ADDRESS_SHIFT   21
 
#define PAGING_L3_ADDRESS_SHIFT   30
 
#define PAGING_L4_ADDRESS_SHIFT   39
 
#define PAGING_PML4E_NUMBER   4
 
#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))
 

Functions

UINTN CreateIdentityMappingPageTables (IN EFI_PHYSICAL_ADDRESS StackBase, IN UINTN StackSize)
 
VOID ClearFirst4KPage (IN VOID *HobStart)
 
BOOLEAN IsNullDetectionEnabled (VOID)
 

Detailed Description

x64 Long Mode Virtual Memory Management Definitions

References: 1) IA-32 Intel(R) Architecture Software Developer's Manual Volume 1:Basic Architecture, Intel 2) IA-32 Intel(R) Architecture Software Developer's Manual Volume 2:Instruction Set Reference, Intel 3) IA-32 Intel(R) Architecture Software Developer's Manual Volume 3:System Programmer's Guide, Intel 4) AMD64 Architecture Programmer's Manual Volume 2: System Programming

Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.
Copyright (c) 2017, AMD Incorporated. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file PageTables.h.

Macro Definition Documentation

◆ CR0_WP

#define CR0_WP   BIT16

Definition at line 144 of file PageTables.h.

◆ IA32_PG_P

#define IA32_PG_P   BIT0

Definition at line 146 of file PageTables.h.

◆ IA32_PG_PS

#define IA32_PG_PS   BIT7

Definition at line 148 of file PageTables.h.

◆ IA32_PG_RW

#define IA32_PG_RW   BIT1

Definition at line 147 of file PageTables.h.

◆ PAGE_TABLE_POOL_ALIGN_MASK

#define PAGE_TABLE_POOL_ALIGN_MASK    (~(EFI_PHYSICAL_ADDRESS)(PAGE_TABLE_POOL_ALIGNMENT - 1))

Definition at line 166 of file PageTables.h.

◆ PAGE_TABLE_POOL_ALIGNMENT

#define PAGE_TABLE_POOL_ALIGNMENT   BASE_2MB

Definition at line 163 of file PageTables.h.

◆ PAGE_TABLE_POOL_UNIT_PAGES

#define PAGE_TABLE_POOL_UNIT_PAGES   EFI_SIZE_TO_PAGES (PAGE_TABLE_POOL_UNIT_SIZE)

Definition at line 165 of file PageTables.h.

◆ PAGE_TABLE_POOL_UNIT_SIZE

#define PAGE_TABLE_POOL_UNIT_SIZE   SIZE_2MB

Definition at line 164 of file PageTables.h.

◆ PAGING_1G_ADDRESS_MASK_64

#define PAGING_1G_ADDRESS_MASK_64   0x000FFFFFC0000000ull

Definition at line 154 of file PageTables.h.

◆ PAGING_2M_ADDRESS_MASK_64

#define PAGING_2M_ADDRESS_MASK_64   0x000FFFFFFFE00000ull

Definition at line 153 of file PageTables.h.

◆ PAGING_4K_ADDRESS_MASK_64

#define PAGING_4K_ADDRESS_MASK_64   0x000FFFFFFFFFF000ull

Definition at line 152 of file PageTables.h.

◆ PAGING_L1_ADDRESS_SHIFT

#define PAGING_L1_ADDRESS_SHIFT   12

Definition at line 156 of file PageTables.h.

◆ PAGING_L2_ADDRESS_SHIFT

#define PAGING_L2_ADDRESS_SHIFT   21

Definition at line 157 of file PageTables.h.

◆ PAGING_L3_ADDRESS_SHIFT

#define PAGING_L3_ADDRESS_SHIFT   30

Definition at line 158 of file PageTables.h.

◆ PAGING_L4_ADDRESS_SHIFT

#define PAGING_L4_ADDRESS_SHIFT   39

Definition at line 159 of file PageTables.h.

◆ PAGING_PAE_INDEX_MASK

#define PAGING_PAE_INDEX_MASK   0x1FF

Definition at line 150 of file PageTables.h.

◆ PAGING_PML4E_NUMBER

#define PAGING_PML4E_NUMBER   4

Definition at line 161 of file PageTables.h.

◆ SYS_CODE64_SEL

#define SYS_CODE64_SEL   0x38

Definition at line 20 of file PageTables.h.

Function Documentation

◆ ClearFirst4KPage()

VOID ClearFirst4KPage ( IN VOID *  HobStart)

Clear legacy memory located at the first 4K-page.

This function traverses the whole HOB list to check if memory from 0 to 4095 exists and has not been allocated, and then clear it if so.

Parameters
HobStartThe start of HobList passed to DxeCore.

Clear legacy memory located at the first 4K-page, if available.

This function traverses the whole HOB list to check if memory from 0 to 4095 exists and has not been allocated, and then clear it if so.

Parameters
HobStartThe start of HobList passed to DxeCore.

Definition at line 44 of file VirtualMemory.c.

◆ CreateIdentityMappingPageTables()

UINTN CreateIdentityMappingPageTables ( IN EFI_PHYSICAL_ADDRESS  StackBase,
IN UINTN  StackSize 
)

Allocates and fills in the Page Directory and Page Table Entries to establish a 1:1 Virtual to Physical mapping.

Parameters
[in]StackBaseStack base address.
[in]StackSizeStack size.
Returns
The address of 4 level page map.

Definition at line 691 of file VirtualMemory.c.

◆ IsNullDetectionEnabled()

BOOLEAN IsNullDetectionEnabled ( VOID  )

Return configure status of NULL pointer detection feature.

Returns
TRUE NULL pointer detection feature is enabled
FALSE NULL pointer detection feature is disabled

Definition at line 108 of file VirtualMemory.c.