TianoCore EDK2 master
Loading...
Searching...
No Matches
TestHelper.c File Reference

Go to the source code of this file.

Macros

#define IA32_PAE_RESERVED_MASK   0x7FF0000000000000ull
 

Functions

VOID InitGlobalData (UINTN MemorySpace)
 
UNIT_TEST_STATUS IsPageTableEntryValid (IN IA32_PAGING_ENTRY *PagingEntry, IN UINTN Level, IN UINTN MaxLeafLevel, IN UINT64 Address, IN PAGING_MODE PagingMode)
 
UNIT_TEST_STATUS IsPageTableValid (IN UINTN PageTable, IN PAGING_MODE PagingMode)
 
UINT64 GetEntryFromSubPageTable (IN IA32_PAGING_ENTRY *PagingEntry, IN OUT UINTN *Level, IN UINTN MaxLeafLevel, IN UINT64 Address)
 
UINT64 GetEntryFromPageTable (IN UINTN PageTable, IN PAGING_MODE PagingMode, IN UINT64 Address, OUT UINTN *Level)
 
UINT64 GetMaxAddress (IN PAGING_MODE Mode)
 

Variables

IA32_PAGING_ENTRY mValidMaskNoLeaf [6]
 
IA32_PAGING_ENTRY mValidMaskLeaf [6]
 
IA32_PAGING_ENTRY mValidMaskLeafFlag [6]
 

Detailed Description

helper file for Unit tests of the CpuPageTableLib instance of the CpuPageTableLib class

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

Definition in file TestHelper.c.

Macro Definition Documentation

◆ IA32_PAE_RESERVED_MASK

#define IA32_PAE_RESERVED_MASK   0x7FF0000000000000ull

Definition at line 12 of file TestHelper.c.

Function Documentation

◆ GetEntryFromPageTable()

UINT64 GetEntryFromPageTable ( IN UINTN  PageTable,
IN PAGING_MODE  PagingMode,
IN UINT64  Address,
OUT UINTN Level 
)

Get the leaf entry for a given linear address from a page table

Parameters
[in]PageTableThe pointer to the page table.
[in]PagingModeThe paging mode.
[in]LinearAddressThe linear address.
[out]Levelleaf entry's level.
Return values
Leafentry.

Definition at line 267 of file TestHelper.c.

◆ GetEntryFromSubPageTable()

UINT64 GetEntryFromSubPageTable ( IN IA32_PAGING_ENTRY PagingEntry,
IN OUT UINTN Level,
IN UINTN  MaxLeafLevel,
IN UINT64  Address 
)

Get the leaf entry for a given linear address from one entry in page table

Parameters
[in]PagingEntryThe entry in page table which covers the linear address
[in,out]LevelOn input, is the level of PagingEntry. On outout, is the level of the leaf entry
[in]MaxLeafLevelMax leaf entry level.
[in]LinearAddressThe linear address.
Return values
Leafentry.

Definition at line 224 of file TestHelper.c.

◆ GetMaxAddress()

UINT64 GetMaxAddress ( IN PAGING_MODE  Mode)

Get max physical adrress supported by specific page mode

Parameters
[in]ModeThe paging mode.
Return values
maxaddress.

Definition at line 306 of file TestHelper.c.

◆ InitGlobalData()

VOID InitGlobalData ( UINTN  MemorySpace)

Init global data.

Parameters
[in]MemorySpaceMemory space

Definition at line 31 of file TestHelper.c.

◆ IsPageTableEntryValid()

UNIT_TEST_STATUS IsPageTableEntryValid ( IN IA32_PAGING_ENTRY PagingEntry,
IN UINTN  Level,
IN UINTN  MaxLeafLevel,
IN UINT64  Address,
IN PAGING_MODE  PagingMode 
)

Check if the Page table entry is valid

Parameters
[in]PagingEntryThe entry in page table to verify
[in]Levelthe level of PagingEntry.
[in]MaxLeafLevelMax leaf entry level.
[in]LinearAddressThe linear address verified.
[in]PagingModeThe paging mode.
Return values
Leafentry.

Definition at line 104 of file TestHelper.c.

◆ IsPageTableValid()

UNIT_TEST_STATUS IsPageTableValid ( IN UINTN  PageTable,
IN PAGING_MODE  PagingMode 
)

Check if the Page table is valid

Parameters
[in]PageTableThe pointer to the page table.
[in]PagingModeThe paging mode.
Return values
UNIT_TEST_PASSEDIt is a valid Page Table

Definition at line 170 of file TestHelper.c.

Variable Documentation

◆ mValidMaskLeaf

IA32_PAGING_ENTRY mValidMaskLeaf[6]

Definition at line 22 of file TestHelper.c.

◆ mValidMaskLeafFlag

IA32_PAGING_ENTRY mValidMaskLeafFlag[6]

Definition at line 23 of file TestHelper.c.

◆ mValidMaskNoLeaf

IA32_PAGING_ENTRY mValidMaskNoLeaf[6]

Definition at line 21 of file TestHelper.c.