]> git.proxmox.com Git - mirror_edk2.git/commitdiff
StandaloneMmPkg: fix pointer/int casts against 32bit architectures
authorEtienne Carriere <etienne.carriere@linaro.org>
Mon, 9 Aug 2021 15:19:45 +0000 (17:19 +0200)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 11 Aug 2021 11:32:32 +0000 (11:32 +0000)
Use intermediate (UINTN) cast when casting int from/to pointer. This
is needed as UINT64 values cast from/to 32bit pointer for 32bit
architectures.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.c
StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/CreateHobList.c
StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCoreEntryPoint.c

index 6884095c49f27f32db3f42888f685fdc0c0e6a89..d4590bcd197a6c5529fe023b6619bacfa24dd2e5 100644 (file)
@@ -164,8 +164,8 @@ StandaloneMmCpuInitialize (
 \r
   // Share the entry point of the CPU driver\r
   DEBUG ((DEBUG_INFO, "Sharing Cpu Driver EP *0x%lx = 0x%lx\n",\r
-          (UINT64) CpuDriverEntryPointDesc->ArmTfCpuDriverEpPtr,\r
-          (UINT64) PiMmStandaloneArmTfCpuDriverEntry));\r
+          (UINTN) CpuDriverEntryPointDesc->ArmTfCpuDriverEpPtr,\r
+          (UINTN) PiMmStandaloneArmTfCpuDriverEntry));\r
   *(CpuDriverEntryPointDesc->ArmTfCpuDriverEpPtr) = PiMmStandaloneArmTfCpuDriverEntry;\r
 \r
   // Find the descriptor that contains the whereabouts of the buffer for\r
@@ -180,8 +180,8 @@ StandaloneMmCpuInitialize (
     return Status;\r
   }\r
 \r
-  DEBUG ((DEBUG_INFO, "mNsCommBuffer.PhysicalStart - 0x%lx\n", (UINT64) NsCommBufMmramRange->PhysicalStart));\r
-  DEBUG ((DEBUG_INFO, "mNsCommBuffer.PhysicalSize - 0x%lx\n", (UINT64) NsCommBufMmramRange->PhysicalSize));\r
+  DEBUG ((DEBUG_INFO, "mNsCommBuffer.PhysicalStart - 0x%lx\n", (UINTN) NsCommBufMmramRange->PhysicalStart));\r
+  DEBUG ((DEBUG_INFO, "mNsCommBuffer.PhysicalSize - 0x%lx\n", (UINTN) NsCommBufMmramRange->PhysicalSize));\r
 \r
   CopyMem (&mNsCommBuffer, NsCommBufMmramRange, sizeof(EFI_MMRAM_DESCRIPTOR));\r
   DEBUG ((DEBUG_INFO, "mNsCommBuffer: 0x%016lx - 0x%lx\n", mNsCommBuffer.CpuStart, mNsCommBuffer.PhysicalSize));\r
index e8fb96bd6ebf96c28227bbf34a53a2e0e64aaf2c..4d4cf3d5ff1353c2e2bf5501e0366313d92fb671 100644 (file)
@@ -72,14 +72,14 @@ CreateHobListFromBootInfo (
 \r
   // Create a hoblist with a PHIT and EOH\r
   HobStart = HobConstructor (\r
-               (VOID *) PayloadBootInfo->SpMemBase,\r
+               (VOID *) (UINTN) PayloadBootInfo->SpMemBase,\r
                (UINTN)  PayloadBootInfo->SpMemLimit - PayloadBootInfo->SpMemBase,\r
-               (VOID *) PayloadBootInfo->SpHeapBase,\r
-               (VOID *) (PayloadBootInfo->SpHeapBase + PayloadBootInfo->SpHeapSize)\r
+               (VOID *) (UINTN) PayloadBootInfo->SpHeapBase,\r
+               (VOID *) (UINTN) (PayloadBootInfo->SpHeapBase + PayloadBootInfo->SpHeapSize)\r
                );\r
 \r
   // Check that the Hoblist starts at the bottom of the Heap\r
-  ASSERT (HobStart == (VOID *) PayloadBootInfo->SpHeapBase);\r
+  ASSERT (HobStart == (VOID *) (UINTN) PayloadBootInfo->SpHeapBase);\r
 \r
   // Build a Boot Firmware Volume HOB\r
   BuildFvHob (PayloadBootInfo->SpImageBase, PayloadBootInfo->SpImageSize);\r
@@ -190,9 +190,9 @@ CreateHobListFromBootInfo (
   MmramRanges[3].RegionState   = EFI_CACHEABLE | EFI_ALLOCATED;\r
 \r
   // Base and size of heap memory shared by all cpus\r
-  MmramRanges[4].PhysicalStart = (EFI_PHYSICAL_ADDRESS) HobStart;\r
-  MmramRanges[4].CpuStart      = (EFI_PHYSICAL_ADDRESS) HobStart;\r
-  MmramRanges[4].PhysicalSize  = HobStart->EfiFreeMemoryBottom - (EFI_PHYSICAL_ADDRESS) HobStart;\r
+  MmramRanges[4].PhysicalStart = (EFI_PHYSICAL_ADDRESS) (UINTN) HobStart;\r
+  MmramRanges[4].CpuStart      = (EFI_PHYSICAL_ADDRESS) (UINTN) HobStart;\r
+  MmramRanges[4].PhysicalSize  = HobStart->EfiFreeMemoryBottom - (EFI_PHYSICAL_ADDRESS) (UINTN) HobStart;\r
   MmramRanges[4].RegionState   = EFI_CACHEABLE | EFI_ALLOCATED;\r
 \r
   // Base and size of heap memory shared by all cpus\r
index 6c50f470aa3589367e4f07da9fb441ca9b2c0e25..b445d6942e4f13b56a192fce3602b6cfb0dbed74 100644 (file)
@@ -328,7 +328,7 @@ _ModuleEntryPoint (
 \r
   // Locate PE/COFF File information for the Standalone MM core module\r
   Status = LocateStandaloneMmCorePeCoffData (\r
-             (EFI_FIRMWARE_VOLUME_HEADER *) PayloadBootInfo->SpImageBase,\r
+             (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PayloadBootInfo->SpImageBase,\r
              &TeData,\r
              &TeDataSize\r
              );\r