TianoCore EDK2 master
|
Go to the source code of this file.
Functions | |
BOOLEAN EFIAPI | RandomBytesUsingArray (OUT UINT8 *Output, IN UINTN Size) |
BOOLEAN EFIAPI | LocalRandomBytes (OUT UINT8 *Output, IN UINTN Size) |
UINT32 | Random32 (UINT32 Start, UINT32 Limit) |
UINT64 | Random64 (UINT64 Start, UINT64 Limit) |
BOOLEAN | RandomBoolean (UINT8 Probability) |
VOID | SetRandomStack (VOID) |
UNIT_TEST_STATUS | ValidateAndRandomeModifyPageTablePageTableEntry (IN IA32_PAGING_ENTRY *PagingEntry, IN UINTN Level, IN UINTN MaxLeafLevel, IN UINT64 Address) |
UNIT_TEST_STATUS | ValidateAndRandomeModifyPageTable (IN UINTN PageTable, IN PAGING_MODE PagingMode) |
VOID | RemoveLastMapEntry (IN OUT MAP_ENTRYS *MapEntrys) |
VOID | GenerateSingleRandomMapEntry (IN UINT64 MaxAddress, IN OUT MAP_ENTRYS *MapEntrys) |
BOOLEAN | CompareEntrysforOnePoint (IN UINT64 Address, IN MAP_ENTRYS *MapEntrys, IN IA32_MAP_ENTRY *Map, IN UINTN MapCount, IN IA32_MAP_ENTRY *InitMap, IN UINTN InitMapCount) |
VOID | AppendKeyPointToBuffer (IN OUT UINT64 *Buffer, IN OUT UINTN *Count, IN UINT64 Address) |
VOID | GetKeyPointList (IN MAP_ENTRYS *MapEntrys, IN IA32_MAP_ENTRY *Map, IN UINTN MapCount, IN OUT UINT64 *Buffer, IN OUT UINTN *Count) |
UNIT_TEST_STATUS | SingleMapEntryTest (IN OUT UINTN *PageTable, IN PAGING_MODE PagingMode, IN UINT64 MaxAddress, IN MAP_ENTRYS *MapEntrys, IN ALLOCATE_PAGE_RECORDS *PagesRecord, IN IA32_MAP_ENTRY *InitMap, IN UINTN InitMapCount) |
VOID *EFIAPI | RecordAllocatePages (IN ALLOCATE_PAGE_RECORDS *PagesRecord, IN UINTN Pages) |
UNIT_TEST_STATUS | MultipleMapEntryTest (IN UINTN ExpctedEntryNumber, IN PAGING_MODE PagingMode) |
UNIT_TEST_STATUS EFIAPI | TestCaseforRandomTest (IN UNIT_TEST_CONTEXT Context) |
Variables | |
UINTN | RandomNumber = 0 |
IA32_PAGING_ENTRY | mValidMaskNoLeaf [6] |
IA32_PAGING_ENTRY | mValidMaskLeaf [6] |
IA32_PAGING_ENTRY | mValidMaskLeafFlag [6] |
UINTN | mRandomOption |
IA32_MAP_ATTRIBUTE | mSupportedBit |
UINTN | mNumberCount |
UINT8 | mNumbers [] |
UINTN | mNumberIndex |
UINT64 | AlignedTable [] |
Random test case 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 RandomTest.c.
Append key point of a given address to Buffer if buffer is NULL, only count needed count
[in,out] | Buffer | Buffer to contains all key point. |
[in,out] | Count | Count of the key point. |
[in] | Address | given address |
Definition at line 554 of file RandomTest.c.
BOOLEAN CompareEntrysforOnePoint | ( | IN UINT64 | Address, |
IN MAP_ENTRYS * | MapEntrys, | ||
IN IA32_MAP_ENTRY * | Map, | ||
IN UINTN | MapCount, | ||
IN IA32_MAP_ENTRY * | InitMap, | ||
IN UINTN | InitMapCount | ||
) |
Compare the attribute for one point. MapEntrys records every memory ranges that is used as input Map and MapCount are gotten from Page table Compare if this point have same attribute.
[in] | Address | Address of one Point. |
[in] | MapEntrys | Record every memory ranges that is used as input |
[in] | Map | Pointer to an array that describes multiple linear address ranges. |
[in] | MapCount | Pointer to a UINTN that hold the number of entries in the Map. |
[in] | InitMap | Pointer to an array that describes init map entries. |
[in] | InitMapCount | Pointer to a UINTN that hold the number of init map entries. |
TRUE | At least one byte of data is available to be read |
FALSE | No data is available to be read |
Definition at line 418 of file RandomTest.c.
VOID GenerateSingleRandomMapEntry | ( | IN UINT64 | MaxAddress, |
IN OUT MAP_ENTRYS * | MapEntrys | ||
) |
Generate single random map entry. The map entry can be the input of function PageTableMap the LinearAddress and length is aligned to aligned table.
MaxAddress | Max Address. |
MapEntrys | Output MapEntrys contains all parameter as input of function PageTableMap |
Definition at line 329 of file RandomTest.c.
VOID GetKeyPointList | ( | IN MAP_ENTRYS * | MapEntrys, |
IN IA32_MAP_ENTRY * | Map, | ||
IN UINTN | MapCount, | ||
IN OUT UINT64 * | Buffer, | ||
IN OUT UINTN * | Count | ||
) |
Get all key points from a buffer if buffer is NULL, only count needed count
[in] | MapEntrys | Record every memory ranges that is used as input |
[in] | Map | Pointer to an array that describes multiple linear address ranges. |
[in] | MapCount | Pointer to a UINTN that hold the actual number of entries in the Map. |
[in,out] | Buffer | Buffer to contains all key point. |
[in,out] | Count | Count of the key point. |
Definition at line 583 of file RandomTest.c.
Generates a pseudorandom byte stream of the specified size.
Return FALSE to indicate this interface is not supported.
[out] | Output | Pointer to buffer to receive random value. |
[in] | Size | Size of random bytes to generate. |
TRUE | Pseudorandom byte stream generated successfully. |
FALSE | Pseudorandom number generator fails |
Definition at line 72 of file RandomTest.c.
UNIT_TEST_STATUS MultipleMapEntryTest | ( | IN UINTN | ExpctedEntryNumber, |
IN PAGING_MODE | PagingMode | ||
) |
The function is a whole Random test, it will call SingleMapEntryTest for ExpctedEntryNumber times
[in] | ExpctedEntryNumber | The count of random entry |
[in] | PagingMode | The paging mode. |
UNIT_TEST_PASSED | The test is successful. |
Definition at line 916 of file RandomTest.c.
UINT32 Random32 | ( | UINT32 | Start, |
UINT32 | Limit | ||
) |
Return a 32bit random number.
Start | Start of the random number range. |
Limit | Limit of the random number range, and return value can be Limit. |
Definition at line 92 of file RandomTest.c.
UINT64 Random64 | ( | UINT64 | Start, |
UINT64 | Limit | ||
) |
Return a 64bit random number.
Start | Start of the random number range. |
Limit | Limit of the random number range, and return value can be Limit. |
Definition at line 111 of file RandomTest.c.
BOOLEAN RandomBoolean | ( | UINT8 | Probability | ) |
Returns true with the percentage of input Probability.
[in] | Probability | The percentage to return true. |
Definition at line 134 of file RandomTest.c.
Generates a pseudorandom byte stream of the specified size.
Return FALSE to indicate this interface is not supported.
[out] | Output | Pointer to buffer to receive random value. |
[in] | Size | Size of random bytes to generate. |
TRUE | Always return TRUE |
Definition at line 40 of file RandomTest.c.
VOID *EFIAPI RecordAllocatePages | ( | IN ALLOCATE_PAGE_RECORDS * | PagesRecord, |
IN UINTN | Pages | ||
) |
Allocate page and record the information in PagesRecord
[in] | PagesRecord | Point to a struct to record memory usage |
[in] | Pages | Page count needed to allocate |
Definition at line 887 of file RandomTest.c.
VOID RemoveLastMapEntry | ( | IN OUT MAP_ENTRYS * | MapEntrys | ) |
Remove the last MAP_ENTRY in MapEntrys.
MapEntrys | Pointer to MapEntrys buffer |
Definition at line 305 of file RandomTest.c.
VOID SetRandomStack | ( | VOID | ) |
Set 8K stack as random value.
Definition at line 145 of file RandomTest.c.
UNIT_TEST_STATUS SingleMapEntryTest | ( | IN OUT UINTN * | PageTable, |
IN PAGING_MODE | PagingMode, | ||
IN UINT64 | MaxAddress, | ||
IN MAP_ENTRYS * | MapEntrys, | ||
IN ALLOCATE_PAGE_RECORDS * | PagesRecord, | ||
IN IA32_MAP_ENTRY * | InitMap, | ||
IN UINTN | InitMapCount | ||
) |
Generate random one range with randome attribute, and add it into pagetable Compare the key point has same attribute
[in,out] | PageTable | The pointer to the page table to update, or pointer to NULL if a new page table is to be created. |
[in] | PagingMode | The paging mode. |
[in] | MaxAddress | Max Address. |
[in] | MapEntrys | Record every memory ranges that is used as input |
[in] | PagesRecord | Used to record memory usage for page table. |
[in] | InitMap | Pointer to an array that describes init map entries. |
[in] | InitMapCount | Pointer to a UINTN that hold the number of init map entries. |
UNIT_TEST_PASSED | The test is successful. |
Definition at line 652 of file RandomTest.c.
UNIT_TEST_STATUS EFIAPI TestCaseforRandomTest | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Random Test
[in] | Context | [Optional] An optional parameter that enables: 1) test-case reuse with varied parameters and 2) test-case re-entry for Target tests that need a reboot. This parameter is a VOID* and it is the responsibility of the test author to ensure that the contents are well understood by all test cases that may consume it. |
UNIT_TEST_PASSED | The Unit test has completed and the test case was successful. |
UNIT_TEST_ERROR_TEST_FAILED | A test case assertion has failed. |
Definition at line 1037 of file RandomTest.c.
UNIT_TEST_STATUS ValidateAndRandomeModifyPageTable | ( | IN UINTN | PageTable, |
IN PAGING_MODE | PagingMode | ||
) |
Check if the Page table is valid
[in] | PageTable | The pointer to the page table. |
[in] | PagingMode | The paging mode. |
UNIT_TEST_PASSED | It is a valid Page Table |
Definition at line 267 of file RandomTest.c.
UNIT_TEST_STATUS ValidateAndRandomeModifyPageTablePageTableEntry | ( | IN IA32_PAGING_ENTRY * | PagingEntry, |
IN UINTN | Level, | ||
IN UINTN | MaxLeafLevel, | ||
IN UINT64 | Address | ||
) |
Check if the Page table entry is valid
[in] | PagingEntry | The entry in page table to verify |
[in] | Level | the level of PagingEntry. |
[in] | MaxLeafLevel | Max leaf entry level. |
[in] | LinearAddress | The linear address verified. |
Leaf | entry. |
Definition at line 169 of file RandomTest.c.
UINT64 AlignedTable[] |
Definition at line 21 of file RandomTest.c.
|
extern |
Definition at line 7 of file RandomNumber.c.
UINTN mNumberIndex |
Definition at line 20 of file RandomTest.c.
|
extern |
Definition at line 8 of file RandomNumber.c.
UINTN mRandomOption |
Definition at line 16 of file RandomTest.c.
IA32_MAP_ATTRIBUTE mSupportedBit |
Definition at line 17 of file RandomTest.c.
|
extern |
Definition at line 22 of file TestHelper.c.
|
extern |
Definition at line 23 of file TestHelper.c.
|
extern |
Definition at line 21 of file TestHelper.c.
UINTN RandomNumber = 0 |
Definition at line 12 of file RandomTest.c.