mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-25 22:54:51 +02:00
UefiCpuPkg/CpuPageTableLib: Add RandomTest for PAE paging
Add RandomTest for PAE paging. Signed-off-by: Dun Tan <dun.tan@intel.com> Cc: Eric Dong <eric.dong@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Tested-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
aad9a30144
commit
aea5930c40
@ -13,6 +13,7 @@ static CPU_PAGE_TABLE_LIB_RANDOM_TEST_CONTEXT mTestContextPaging4Level = { P
|
|||||||
static CPU_PAGE_TABLE_LIB_RANDOM_TEST_CONTEXT mTestContextPaging4Level1GB = { Paging4Level1GB, 100, 20, USE_RANDOM_ARRAY };
|
static CPU_PAGE_TABLE_LIB_RANDOM_TEST_CONTEXT mTestContextPaging4Level1GB = { Paging4Level1GB, 100, 20, USE_RANDOM_ARRAY };
|
||||||
static CPU_PAGE_TABLE_LIB_RANDOM_TEST_CONTEXT mTestContextPaging5Level = { Paging5Level, 100, 20, USE_RANDOM_ARRAY };
|
static CPU_PAGE_TABLE_LIB_RANDOM_TEST_CONTEXT mTestContextPaging5Level = { Paging5Level, 100, 20, USE_RANDOM_ARRAY };
|
||||||
static CPU_PAGE_TABLE_LIB_RANDOM_TEST_CONTEXT mTestContextPaging5Level1GB = { Paging5Level1GB, 100, 20, USE_RANDOM_ARRAY };
|
static CPU_PAGE_TABLE_LIB_RANDOM_TEST_CONTEXT mTestContextPaging5Level1GB = { Paging5Level1GB, 100, 20, USE_RANDOM_ARRAY };
|
||||||
|
static CPU_PAGE_TABLE_LIB_RANDOM_TEST_CONTEXT mTestContextPagingPae = { PagingPae, 100, 20, USE_RANDOM_ARRAY };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check if the input parameters are not supported.
|
Check if the input parameters are not supported.
|
||||||
@ -884,6 +885,7 @@ UefiTestMain (
|
|||||||
AddTestCase (RandomTestCase, "Random Test for Paging4Level1G", "Random Test Case2", TestCaseforRandomTest, NULL, NULL, &mTestContextPaging4Level1GB);
|
AddTestCase (RandomTestCase, "Random Test for Paging4Level1G", "Random Test Case2", TestCaseforRandomTest, NULL, NULL, &mTestContextPaging4Level1GB);
|
||||||
AddTestCase (RandomTestCase, "Random Test for Paging5Level", "Random Test Case3", TestCaseforRandomTest, NULL, NULL, &mTestContextPaging5Level);
|
AddTestCase (RandomTestCase, "Random Test for Paging5Level", "Random Test Case3", TestCaseforRandomTest, NULL, NULL, &mTestContextPaging5Level);
|
||||||
AddTestCase (RandomTestCase, "Random Test for Paging5Level1G", "Random Test Case4", TestCaseforRandomTest, NULL, NULL, &mTestContextPaging5Level1GB);
|
AddTestCase (RandomTestCase, "Random Test for Paging5Level1G", "Random Test Case4", TestCaseforRandomTest, NULL, NULL, &mTestContextPaging5Level1GB);
|
||||||
|
AddTestCase (RandomTestCase, "Random Test for PagingPae", "Random Test Case5", TestCaseforRandomTest, NULL, NULL, &mTestContextPagingPae);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Execute the tests.
|
// Execute the tests.
|
||||||
|
@ -258,10 +258,9 @@ ValidateAndRandomeModifyPageTable (
|
|||||||
UNIT_TEST_STATUS Status;
|
UNIT_TEST_STATUS Status;
|
||||||
IA32_PAGING_ENTRY *PagingEntry;
|
IA32_PAGING_ENTRY *PagingEntry;
|
||||||
|
|
||||||
if ((PagingMode == Paging32bit) || (PagingMode == PagingPae) || (PagingMode >= PagingModeMax)) {
|
if ((PagingMode == Paging32bit) || (PagingMode >= PagingModeMax)) {
|
||||||
//
|
//
|
||||||
// 32bit paging is never supported.
|
// 32bit paging is never supported.
|
||||||
// PAE paging will be supported later.
|
|
||||||
//
|
//
|
||||||
return UNIT_TEST_ERROR_TEST_FAILED;
|
return UNIT_TEST_ERROR_TEST_FAILED;
|
||||||
}
|
}
|
||||||
|
@ -175,10 +175,9 @@ IsPageTableValid (
|
|||||||
return UNIT_TEST_PASSED;
|
return UNIT_TEST_PASSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((PagingMode == Paging32bit) || (PagingMode == PagingPae) || (PagingMode >= PagingModeMax)) {
|
if ((PagingMode == Paging32bit) || (PagingMode >= PagingModeMax)) {
|
||||||
//
|
//
|
||||||
// 32bit paging is never supported.
|
// 32bit paging is never supported.
|
||||||
// PAE paging will be supported later.
|
|
||||||
//
|
//
|
||||||
return UNIT_TEST_ERROR_TEST_FAILED;
|
return UNIT_TEST_ERROR_TEST_FAILED;
|
||||||
}
|
}
|
||||||
@ -187,7 +186,12 @@ IsPageTableValid (
|
|||||||
MaxLevel = (UINT8)(PagingMode >> 8);
|
MaxLevel = (UINT8)(PagingMode >> 8);
|
||||||
|
|
||||||
PagingEntry = (IA32_PAGING_ENTRY *)(UINTN)PageTable;
|
PagingEntry = (IA32_PAGING_ENTRY *)(UINTN)PageTable;
|
||||||
for (Index = 0; Index < 512; Index++) {
|
for (Index = 0; Index < ((PagingMode == PagingPae) ? 4 : 512); Index++) {
|
||||||
|
if (PagingMode == PagingPae) {
|
||||||
|
UT_ASSERT_EQUAL (PagingEntry[Index].PdptePae.Bits.MustBeZero, 0);
|
||||||
|
UT_ASSERT_EQUAL (PagingEntry[Index].PdptePae.Bits.MustBeZero2, 0);
|
||||||
|
}
|
||||||
|
|
||||||
Status = IsPageTableEntryValid (&PagingEntry[Index], MaxLevel, MaxLeafLevel, Index << (9 * MaxLevel + 3));
|
Status = IsPageTableEntryValid (&PagingEntry[Index], MaxLevel, MaxLeafLevel, Index << (9 * MaxLevel + 3));
|
||||||
if (Status != UNIT_TEST_PASSED) {
|
if (Status != UNIT_TEST_PASSED) {
|
||||||
return Status;
|
return Status;
|
||||||
@ -264,7 +268,7 @@ GetEntryFromPageTable (
|
|||||||
UINT64 Index;
|
UINT64 Index;
|
||||||
IA32_PAGING_ENTRY *PagingEntry;
|
IA32_PAGING_ENTRY *PagingEntry;
|
||||||
|
|
||||||
if ((PagingMode == Paging32bit) || (PagingMode == PagingPae) || (PagingMode >= PagingModeMax)) {
|
if ((PagingMode == Paging32bit) || (PagingMode >= PagingModeMax)) {
|
||||||
//
|
//
|
||||||
// 32bit paging is never supported.
|
// 32bit paging is never supported.
|
||||||
// PAE paging will be supported later.
|
// PAE paging will be supported later.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user