UefiCpuPkg/CpuPageTableLib/TestCase: Refine test case for PAE paging.
Refine test case: 1. Check PAE paging reserved bits is zero. 2. Set stack as random value. Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
c83ffd2676
commit
02d6f39bd5
@ -138,6 +138,23 @@ RandomBoolean (
|
||||
return ((Probability > ((UINT8)Random64 (0, 100))) ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
Set 8K stack as random value.
|
||||
**/
|
||||
VOID
|
||||
SetRandomStack (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
UINT64 Buffer[SIZE_1KB];
|
||||
UINTN Index;
|
||||
|
||||
for (Index = 0; Index < SIZE_1KB; Index++) {
|
||||
Buffer[Index] = Random64 (0, MAX_UINT64);
|
||||
Buffer[Index] = Buffer[Index];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the Page table entry is valid
|
||||
|
||||
@ -670,6 +687,7 @@ SingleMapEntryTest (
|
||||
IsNotPresent = FALSE;
|
||||
IsModified = FALSE;
|
||||
|
||||
SetRandomStack ();
|
||||
GenerateSingleRandomMapEntry (MaxAddress, MapEntrys);
|
||||
LastMapEntry = &MapEntrys->Maps[MapsIndex];
|
||||
Status = PageTableParse (*PageTable, PagingMode, NULL, &MapCount);
|
||||
@ -1039,7 +1057,11 @@ TestCaseforRandomTest (
|
||||
mSupportedBit.Bits.Pat = 1;
|
||||
mSupportedBit.Bits.Global = 1;
|
||||
mSupportedBit.Bits.ProtectionKey = 0xF;
|
||||
mSupportedBit.Bits.Nx = 1;
|
||||
if (((CPU_PAGE_TABLE_LIB_RANDOM_TEST_CONTEXT *)Context)->PagingMode == PagingPae) {
|
||||
mSupportedBit.Bits.ProtectionKey = 0;
|
||||
}
|
||||
|
||||
mSupportedBit.Bits.Nx = 1;
|
||||
|
||||
mRandomOption = ((CPU_PAGE_TABLE_LIB_RANDOM_TEST_CONTEXT *)Context)->RandomOption;
|
||||
mNumberIndex = 0;
|
||||
|
Reference in New Issue
Block a user