TianoCore EDK2 master
Loading...
Searching...
No Matches
CpuPageTableParse.c File Reference
#include "CpuPageTable.h"

Go to the source code of this file.

Functions

UINT64 PageTableLibGetPleBMapAttribute (IN IA32_PAGE_LEAF_ENTRY_BIG_PAGESIZE *PleB, IN IA32_MAP_ATTRIBUTE *ParentMapAttribute)
 
UINT64 PageTableLibGetPte4KMapAttribute (IN IA32_PTE_4K *Pte4K, IN IA32_MAP_ATTRIBUTE *ParentMapAttribute)
 
UINT64 PageTableLibGetPnleMapAttribute (IN IA32_PAGE_NON_LEAF_ENTRY *Pnle, IN IA32_MAP_ATTRIBUTE *ParentMapAttribute)
 
BOOLEAN IsPle (IN IA32_PAGING_ENTRY *PagingEntry, IN UINTN Level)
 
VOID PageTableLibParsePnle (IN UINT64 PageTableBaseAddress, IN UINTN Level, IN UINTN MaxLevel, IN UINT64 RegionStart, IN IA32_MAP_ATTRIBUTE *ParentMapAttribute, IN OUT IA32_MAP_ENTRY *Map, IN OUT UINTN *MapCount, IN UINTN MapCapacity, IN IA32_MAP_ENTRY **LastEntry, IN IA32_MAP_ENTRY *OneEntry)
 
RETURN_STATUS EFIAPI PageTableParse (IN UINTN PageTable, IN PAGING_MODE PagingMode, OUT IA32_MAP_ENTRY *Map, IN OUT UINTN *MapCount)
 

Detailed Description

This library implements CpuPageTableLib that are generic for IA32 family CPU.

Copyright (c) 2022 - 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file CpuPageTableParse.c.

Function Documentation

◆ IsPle()

BOOLEAN IsPle ( IN IA32_PAGING_ENTRY PagingEntry,
IN UINTN  Level 
)

Return TRUE when the page table entry is a leaf entry that points to the physical address memory. Return FALSE when the page table entry is a non-leaf entry that points to the page table entries.

Parameters
[in]PagingEntryPointer to the page table entry.
[in]LevelPage level where the page table entry resides in.
Return values
TRUEIt's a leaf entry.
FALSEIt's a non-leaf entry.

Definition at line 122 of file CpuPageTableParse.c.

◆ PageTableLibGetPleBMapAttribute()

UINT64 PageTableLibGetPleBMapAttribute ( IN IA32_PAGE_LEAF_ENTRY_BIG_PAGESIZE PleB,
IN IA32_MAP_ATTRIBUTE ParentMapAttribute 
)

Return the attribute of a 2M/1G page table entry.

Parameters
[in]PleBPointer to a 2M/1G page table entry.
[in]ParentMapAttributePointer to the parent attribute.
Returns
Attribute of the 2M/1G page table entry.

Definition at line 20 of file CpuPageTableParse.c.

◆ PageTableLibGetPnleMapAttribute()

UINT64 PageTableLibGetPnleMapAttribute ( IN IA32_PAGE_NON_LEAF_ENTRY Pnle,
IN IA32_MAP_ATTRIBUTE ParentMapAttribute 
)

Return the attribute of a non-leaf page table entry.

Parameters
[in]PnlePointer to a non-leaf page table entry.
[in]ParentMapAttributePointer to the parent attribute.
Returns
Attribute of the non-leaf page table entry.

Definition at line 92 of file CpuPageTableParse.c.

◆ PageTableLibGetPte4KMapAttribute()

UINT64 PageTableLibGetPte4KMapAttribute ( IN IA32_PTE_4K Pte4K,
IN IA32_MAP_ATTRIBUTE ParentMapAttribute 
)

Return the attribute of a 4K page table entry.

Parameters
[in]Pte4KPointer to a 4K page table entry.
[in]ParentMapAttributePointer to the parent attribute.
Returns
Attribute of the 4K page table entry.

Definition at line 58 of file CpuPageTableParse.c.

◆ PageTableLibParsePnle()

VOID PageTableLibParsePnle ( IN UINT64  PageTableBaseAddress,
IN UINTN  Level,
IN UINTN  MaxLevel,
IN UINT64  RegionStart,
IN IA32_MAP_ATTRIBUTE ParentMapAttribute,
IN OUT IA32_MAP_ENTRY Map,
IN OUT UINTN MapCount,
IN UINTN  MapCapacity,
IN IA32_MAP_ENTRY **  LastEntry,
IN IA32_MAP_ENTRY OneEntry 
)

Recursively parse the non-leaf page table entries.

Parameters
[in]PageTableBaseAddressThe base address of the 512 non-leaf page table entries in the specified level.
[in]LevelPage level. Could be 5, 4, 3, 2, 1.
[in]RegionStartThe base linear address of the region covered by the non-leaf page table entries.
[in]ParentMapAttributeThe mapping attribute of the parent entries.
[in,out]MapPointer to an array that describes multiple linear address ranges.
[in,out]MapCountPointer to a UINTN that hold the actual number of entries in the Map.
[in]MapCapacityThe maximum number of entries the Map can hold.
[in]LastEntryPointer to last map entry.
[in]OneEntryPointer to a library internal storage that holds one map entry. It's used when Map array is used up.

Definition at line 158 of file CpuPageTableParse.c.

◆ PageTableParse()

RETURN_STATUS EFIAPI PageTableParse ( IN UINTN  PageTable,
IN PAGING_MODE  PagingMode,
OUT IA32_MAP_ENTRY Map,
IN OUT UINTN MapCount 
)

Parse page table.

Parameters
[in]PageTablePointer to the page table.
[in]PagingModeThe paging mode.
[out]MapReturn an array that describes multiple linear address ranges.
[in,out]MapCountOn input, the maximum number of entries that Map can hold. On output, the number of entries in Map.
Return values
RETURN_UNSUPPORTEDPageLevel is not 5 or 4.
RETURN_INVALID_PARAMETERMapCount is NULL.
RETURN_INVALID_PARAMETER*MapCount is not 0 but Map is NULL.
RETURN_BUFFER_TOO_SMALL*MapCount is too small.
RETURN_SUCCESSPage table is parsed successfully.

Definition at line 264 of file CpuPageTableParse.c.