From 15e635d1b5f58461a5d8a03fba026e620b46e59e Mon Sep 17 00:00:00 2001 From: Michael D Kinney Date: Tue, 2 Nov 2021 09:08:18 -0700 Subject: 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 Cc: Ray Ni Cc: Rahul Kumar Signed-off-by: Michael D Kinney Reviewed-by: Philippe Mathieu-Daude Reviewed-by: Ray Ni --- 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 30ee1dc325..e84b939060 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++) { -- cgit v1.2.3