summaryrefslogtreecommitdiffstats
path: root/UefiCpuPkg
diff options
context:
space:
mode:
authorDun Tan <dun.tan@intel.com>2023-03-24 12:12:44 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-03-27 08:21:58 +0000
commitecfe6382c1f79a3bf0b9591eb3a34695fd3993e0 (patch)
tree0c8d1e33ef70047cb55ecb5a525159faa248da80 /UefiCpuPkg
parent661a669c8177d02cf89d03325fd4cb1392af2c99 (diff)
downloadedk2-ecfe6382c1f79a3bf0b9591eb3a34695fd3993e0.tar.gz
edk2-ecfe6382c1f79a3bf0b9591eb3a34695fd3993e0.tar.bz2
edk2-ecfe6382c1f79a3bf0b9591eb3a34695fd3993e0.zip
UefiCpuPkg/CpuPageTableLib: Add LastMapEntry pointer
Add LastMapEntry pointer to replace MapEntrys->Maps[MapsIndex] in SingleMapEntryTest () of RandomTest. 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> Cc: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'UefiCpuPkg')
-rw-r--r--UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.c b/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.c
index 52eb9daa10..612fddcee0 100644
--- a/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.c
+++ b/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.c
@@ -621,10 +621,12 @@ SingleMapEntryTest (
UINTN Level;
UINT64 Value;
UNIT_TEST_STATUS TestStatus;
+ MAP_ENTRY *LastMapEntry;
MapsIndex = MapEntrys->Count;
GenerateSingleRandomMapEntry (MaxAddress, MapEntrys);
+ LastMapEntry = &MapEntrys->Maps[MapsIndex];
PageTableBufferSize = 0;
Status = PageTableMap (
@@ -632,10 +634,10 @@ SingleMapEntryTest (
PagingMode,
NULL,
&PageTableBufferSize,
- MapEntrys->Maps[MapsIndex].LinearAddress,
- MapEntrys->Maps[MapsIndex].Length,
- &MapEntrys->Maps[MapsIndex].Attribute,
- &MapEntrys->Maps[MapsIndex].Mask
+ LastMapEntry->LinearAddress,
+ LastMapEntry->Length,
+ &LastMapEntry->Attribute,
+ &LastMapEntry->Mask
);
if (PageTableBufferSize != 0) {
UT_ASSERT_EQUAL (Status, RETURN_BUFFER_TOO_SMALL);
@@ -651,10 +653,10 @@ SingleMapEntryTest (
PagingMode,
Buffer,
&PageTableBufferSize,
- MapEntrys->Maps[MapsIndex].LinearAddress,
- MapEntrys->Maps[MapsIndex].Length,
- &MapEntrys->Maps[MapsIndex].Attribute,
- &MapEntrys->Maps[MapsIndex].Mask
+ LastMapEntry->LinearAddress,
+ LastMapEntry->Length,
+ &LastMapEntry->Attribute,
+ &LastMapEntry->Mask
);
}