[edk2-devel] [Patch V5 11/22] UefiCpuPkg/CpuPageTableLib: Add LastMapEntry pointer

duntan posted 22 patches 1 year, 5 months ago
There is a newer version of this series
[edk2-devel] [Patch V5 11/22] UefiCpuPkg/CpuPageTableLib: Add LastMapEntry pointer
Posted by duntan 1 year, 5 months ago
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>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
---
 UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.c | 18 ++++++++++--------
 1 file 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
                );
   }
 
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101736): https://edk2.groups.io/g/devel/message/101736
Mute This Topic: https://groups.io/mt/97818233/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [Patch V5 11/22] UefiCpuPkg/CpuPageTableLib: Add LastMapEntry pointer
Posted by Ni, Ray 1 year, 5 months ago
Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: Tan, Dun <dun.tan@intel.com>
> Sent: Friday, March 24, 2023 2:00 PM
> To: devel@edk2.groups.io
> Cc: Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Kumar,
> Rahul R <rahul.r.kumar@intel.com>; Gerd Hoffmann <kraxel@redhat.com>
> Subject: [Patch V5 11/22] 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>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.c | 18
> ++++++++++--------
>  1 file 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
>                 );
>    }
> 
> --
> 2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101753): https://edk2.groups.io/g/devel/message/101753
Mute This Topic: https://groups.io/mt/97818233/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076/xyzzy [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-