Reviewed-by: Ray Ni <ray...@intel.com>

-----Original Message-----
From: Kinney, Michael D <michael.d.kin...@intel.com> 
Sent: Thursday, November 4, 2021 7:00 AM
To: devel@edk2.groups.io
Cc: Dong, Eric <eric.d...@intel.com>; Ni, Ray <ray...@intel.com>; Kumar, Rahul1 
<rahul1.ku...@intel.com>; Philippe Mathieu-Daude <phi...@redhat.com>
Subject: [Patch V2 5/7] UefiCpuPkg/MtrrLib/UnitTest: Fix 32-bit GCC build issues

When using UT_ASSERT_EQUAL() on a pointer value, it must be cast to UINTN.  
This follows the samples provided with the UnitTestFrameworkPkg.

Cc: Eric Dong <eric.d...@intel.com>
Cc: Ray Ni <ray...@intel.com>
Cc: Rahul Kumar <rahul1.ku...@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
Reviewed-by: Philippe Mathieu-Daude <phi...@redhat.com>
---
 UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c 
b/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
index 30ee1dc32522..e84b9390601d 100644
--- a/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
+++ b/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
@@ -599,7 +599,7 @@ UnitTestMtrrGetFixedMtrr (
     }
 
     Result = MtrrGetFixedMtrr (&FixedSettings);
-    UT_ASSERT_EQUAL (Result, &FixedSettings);
+    UT_ASSERT_EQUAL ((UINTN)Result, (UINTN)&FixedSettings);
     UT_ASSERT_MEM_EQUAL (&FixedSettings, &ExpectedFixedSettings, sizeof 
(FixedSettings));
   }
 
@@ -612,7 +612,7 @@ UnitTestMtrrGetFixedMtrr (
   ZeroMem (&FixedSettings, sizeof (FixedSettings));
   ZeroMem (&ExpectedFixedSettings, sizeof (ExpectedFixedSettings));
   Result = MtrrGetFixedMtrr (&FixedSettings);
-  UT_ASSERT_EQUAL (Result, &FixedSettings);
+  UT_ASSERT_EQUAL ((UINTN)Result, (UINTN)&FixedSettings);
   UT_ASSERT_MEM_EQUAL (&ExpectedFixedSettings, &FixedSettings, sizeof 
(ExpectedFixedSettings));
 
   return UNIT_TEST_PASSED;
@@ -653,7 +653,7 @@ UnitTestMtrrGetAllMtrrs (
     AsmWriteMsr64 (MSR_IA32_MTRR_PHYSMASK0 + (Index << 1), 
VariableMtrr[Index].Mask);
   }
   Result = MtrrGetAllMtrrs (&Mtrrs);
-  UT_ASSERT_EQUAL (Result, &Mtrrs);
+  UT_ASSERT_EQUAL ((UINTN)Result, (UINTN)&Mtrrs);
   UT_ASSERT_MEM_EQUAL (Mtrrs.Variables.Mtrr, VariableMtrr, sizeof 
(MTRR_VARIABLE_SETTING) * SystemParameter.VariableMtrrCount);
 
   //
@@ -665,7 +665,7 @@ UnitTestMtrrGetAllMtrrs (
   SystemParameter.MtrrSupported = FALSE;
   InitializeMtrrRegs (&SystemParameter);
   Result = MtrrGetAllMtrrs (&Mtrrs);
-  UT_ASSERT_EQUAL (Result, &Mtrrs);
+  UT_ASSERT_EQUAL ((UINTN)Result, (UINTN)&Mtrrs);
   UT_ASSERT_MEM_EQUAL (&ExpectedMtrrs, &Mtrrs, sizeof (ExpectedMtrrs));
 
   //
@@ -718,7 +718,7 @@ UnitTestMtrrSetAllMtrrs (
     GenerateRandomMtrrPair (SystemParameter.PhysicalAddressBits, 
GenerateRandomCacheType (), &Mtrrs.Variables.Mtrr[Index], NULL);
   }
   Result = MtrrSetAllMtrrs (&Mtrrs);
-  UT_ASSERT_EQUAL (Result, &Mtrrs);
+  UT_ASSERT_EQUAL ((UINTN)Result, (UINTN)&Mtrrs);
 
   UT_ASSERT_EQUAL (AsmReadMsr64 (MSR_IA32_MTRR_DEF_TYPE), Mtrrs.MtrrDefType);
   for (Index = 0; Index < SystemParameter.VariableMtrrCount; Index++) {
--
2.32.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#83311): https://edk2.groups.io/g/devel/message/83311
Mute This Topic: https://groups.io/mt/86804627/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to