[edk2-devel] [Patch V2 10/14] UefiCpuPkg/CpuPageTableLib: Modify RandomTest to check IsModified
duntan
dun.tan at intel.com
Wed Mar 15 09:49:38 UTC 2023
Thanks for the comments. I'll split this patch and remove the unneeded 'if' condition check.
Thanks,
Dun
-----Original Message-----
From: Ni, Ray <ray.ni at intel.com>
Sent: Wednesday, March 15, 2023 2:09 PM
To: Tan, Dun <dun.tan at intel.com>; devel at edk2.groups.io
Cc: Dong, Eric <eric.dong at intel.com>; Kumar, Rahul R <rahul.r.kumar at intel.com>; Gerd Hoffmann <kraxel at redhat.com>; Liu, Zhiguang <zhiguang.liu at intel.com>
Subject: RE: [Patch V2 10/14] UefiCpuPkg/CpuPageTableLib: Modify RandomTest to check IsModified
>
> GenerateSingleRandomMapEntry (MaxAddress, MapEntrys);
> Status = PageTableParse (*PageTable, PagingMode, NULL, &MapCount);
>
> + if (MapCount != 0) {
> + //
> + // Allocate memory for Map
> + // Note the memory is only used in this one Single MapEntry Test
> + //
> + UT_ASSERT_EQUAL (Status, RETURN_BUFFER_TOO_SMALL);
> + Map = AllocatePages (EFI_SIZE_TO_PAGES (MapCount * sizeof
> (IA32_MAP_ENTRY)));
> + ASSERT (Map != NULL);
> + Status = PageTableParse (*PageTable, PagingMode, Map, &MapCount);
> + }
> +
> //
> // Check if the generated MapEntrys->Maps[MapsIndex] contains not-
> present range.
> //
> if (MapEntrys->Maps[MapsIndex].Length > 0) {
> if (MapCount != 0) {
> - UT_ASSERT_EQUAL (Status, RETURN_BUFFER_TOO_SMALL);
> - Map = AllocatePages (EFI_SIZE_TO_PAGES (MapCount * sizeof
> (IA32_MAP_ENTRY)));
> - ASSERT (Map != NULL);
> - Status = PageTableParse (*PageTable, PagingMode, Map, &MapCount);
> -
> if (Map[MapCount - 1].LinearAddress + Map[MapCount - 1].Length
> <
> MapEntrys->Maps[MapsIndex].LinearAddress + MapEntrys-
> >Maps[MapsIndex].Length) {
> IsNotPresent = TRUE;
1. can you split the Parse() API call into a standalone patch?
> + if (MapCount2 == 0) {
> + UT_ASSERT_EQUAL (IsModified, FALSE);
2. no need to treat "MapCount == 0" as special. CompareMem() should be able to accept 0-length bytes.
> + } else if (CompareMem (Map, Map2, MapCount2 * sizeof
> (IA32_MAP_ENTRY)) != 0) {
> + UT_ASSERT_EQUAL (IsModified, TRUE);
> + } else {
> + UT_ASSERT_EQUAL (IsModified, FALSE);
> + }
> }
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101220): https://edk2.groups.io/g/devel/message/101220
Mute This Topic: https://groups.io/mt/97469486/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list