From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by mx.groups.io with SMTP id smtpd.web11.10721.1615752408534532483 for ; Sun, 14 Mar 2021 13:06:48 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=u6dsXFWi; spf=pass (domain: linaro.org, ip: 209.85.221.52, mailfrom: etienne.carriere@linaro.org) Received: by mail-wr1-f52.google.com with SMTP id x13so4654105wrs.9 for ; Sun, 14 Mar 2021 13:06:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=kLd5RRXKuddvIikYaHLsYxDW0KM924XgBsg8JIjcu74=; b=u6dsXFWi4CbVHVx4SXeMdYLFuti7C0Olmt3KfjGvvJGhFp3iquWacYxwu69crgIk8H x6bqeAGgVX64GX3CinIh1wqPxdW9KXbg4DdWEsxsibA3LHliEcbxiuXTFnN9g0AvCTBI 3X3ZQv+eCyVQADYObF7edMeasG3Ynz01HomzLUNJ8w0KhSBIDd1NVbVEWSbwadsIPUWS iedkC3sq92zRzYA8AHA+xXxs6ywM7MfPLjp1pdrsw1XiI3jbMnN2LBrL/LCU2triCYeU mCj3YhOJBLk1SXjo3rVw35OIyGwmpNYLB6cRlO9buT69N2b+3Yilw2OyT1si7pEiKmB8 n7CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=kLd5RRXKuddvIikYaHLsYxDW0KM924XgBsg8JIjcu74=; b=q4YRKJV620BBfNxyvl4pfYPASdCUCQUi0vGm0QanHXDwYblQu0UixtEhasQQ+Toq0q 3KyL1NWe5Xx+kfsH6a9hzJvGeQs6PRbCDt1vxXJvBMP5NOSWF1/vA2BkIbIpxdtkjyHs SxPF3SAzBKijX9mugVeUMn959EWvcnyHhlcUbRtYASwdxG2TZvf9PStK1DPK0xJs6PpZ nSOYvPgdDbWQ7u2YroJjcI4B2KUx+1ZI0fT0OvdB+eqGzX0iBo4z8FGoNT67B/gabT5Q E1yaV5PamVJer7T9KZxrIdgGBHWYFpRRW72m1wRcIhrK843Cyy/91MygcsZjmy3Wi7Sh Q2SQ== X-Gm-Message-State: AOAM532RpWqv7Crne2hjutBhXyXoFd50ICaFojwY5JCbTt9ElVEJgAve k5QqsC4SO6oHtt2JEQcxaeaVUkIpyCJs7aYu X-Google-Smtp-Source: ABdhPJydFyXDK39iCTeXLwKOp5ii2Ityum+gPTwQ+HDHsIaIq2XORObZzQBpxjyEnoqL/zcoEI4GlQ== X-Received: by 2002:a5d:4c85:: with SMTP id z5mr23562612wrs.208.1615752407055; Sun, 14 Mar 2021 13:06:47 -0700 (PDT) Return-Path: Received: from lmecxl0524.lme.st.com (2a01cb058b85080038d9665c555bdad2.ipv6.abo.wanadoo.fr. [2a01:cb05:8b85:800:38d9:665c:555b:dad2]) by smtp.gmail.com with ESMTPSA id b65sm10176045wmh.4.2021.03.14.13.06.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 13:06:46 -0700 (PDT) From: "Etienne Carriere" To: devel@edk2.groups.io Cc: Etienne Carriere Subject: [PATCH 4/5] StandaloneMmPkg: fix pointer/int casts against 32bit architectures Date: Sun, 14 Mar 2021 21:06:27 +0100 Message-Id: <88b209b1b510d51a559b1b453546f8659144379a.1615752383.git.etienne.carriere@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <5a0fdcf767151d786afd8d14bff57cf6fdb8fefc.1615752383.git.etienne.carriere@linaro.org> References: <5a0fdcf767151d786afd8d14bff57cf6fdb8fefc.1615752383.git.etienne.carriere@linaro.org> In-Reply-To: <5a0fdcf767151d786afd8d14bff57cf6fdb8fefc.1615752383.git.etienne.carriere@linaro.org> References: <5a0fdcf767151d786afd8d14bff57cf6fdb8fefc.1615752383.git.etienne.carriere@linaro.org> 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 --- .../StandaloneMmCpu/AArch64/StandaloneMmCpu.c | 8 ++++---- .../AArch64/CreateHobList.c | 14 +++++++------- .../AArch64/StandaloneMmCoreEntryPoint.c | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.c b/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.c index 6884095c49..d4590bcd19 100644 --- a/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.c +++ b/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.c @@ -164,8 +164,8 @@ StandaloneMmCpuInitialize ( // Share the entry point of the CPU driver DEBUG ((DEBUG_INFO, "Sharing Cpu Driver EP *0x%lx = 0x%lx\n", - (UINT64) CpuDriverEntryPointDesc->ArmTfCpuDriverEpPtr, - (UINT64) PiMmStandaloneArmTfCpuDriverEntry)); + (UINTN) CpuDriverEntryPointDesc->ArmTfCpuDriverEpPtr, + (UINTN) PiMmStandaloneArmTfCpuDriverEntry)); *(CpuDriverEntryPointDesc->ArmTfCpuDriverEpPtr) = PiMmStandaloneArmTfCpuDriverEntry; // Find the descriptor that contains the whereabouts of the buffer for @@ -180,8 +180,8 @@ StandaloneMmCpuInitialize ( return Status; } - DEBUG ((DEBUG_INFO, "mNsCommBuffer.PhysicalStart - 0x%lx\n", (UINT64) NsCommBufMmramRange->PhysicalStart)); - DEBUG ((DEBUG_INFO, "mNsCommBuffer.PhysicalSize - 0x%lx\n", (UINT64) NsCommBufMmramRange->PhysicalSize)); + DEBUG ((DEBUG_INFO, "mNsCommBuffer.PhysicalStart - 0x%lx\n", (UINTN) NsCommBufMmramRange->PhysicalStart)); + DEBUG ((DEBUG_INFO, "mNsCommBuffer.PhysicalSize - 0x%lx\n", (UINTN) NsCommBufMmramRange->PhysicalSize)); CopyMem (&mNsCommBuffer, NsCommBufMmramRange, sizeof(EFI_MMRAM_DESCRIPTOR)); DEBUG ((DEBUG_INFO, "mNsCommBuffer: 0x%016lx - 0x%lx\n", mNsCommBuffer.CpuStart, mNsCommBuffer.PhysicalSize)); diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/CreateHobList.c b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/CreateHobList.c index e8fb96bd6e..4d4cf3d5ff 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/CreateHobList.c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/CreateHobList.c @@ -72,14 +72,14 @@ CreateHobListFromBootInfo ( // Create a hoblist with a PHIT and EOH HobStart = HobConstructor ( - (VOID *) PayloadBootInfo->SpMemBase, + (VOID *) (UINTN) PayloadBootInfo->SpMemBase, (UINTN) PayloadBootInfo->SpMemLimit - PayloadBootInfo->SpMemBase, - (VOID *) PayloadBootInfo->SpHeapBase, - (VOID *) (PayloadBootInfo->SpHeapBase + PayloadBootInfo->SpHeapSize) + (VOID *) (UINTN) PayloadBootInfo->SpHeapBase, + (VOID *) (UINTN) (PayloadBootInfo->SpHeapBase + PayloadBootInfo->SpHeapSize) ); // Check that the Hoblist starts at the bottom of the Heap - ASSERT (HobStart == (VOID *) PayloadBootInfo->SpHeapBase); + ASSERT (HobStart == (VOID *) (UINTN) PayloadBootInfo->SpHeapBase); // Build a Boot Firmware Volume HOB BuildFvHob (PayloadBootInfo->SpImageBase, PayloadBootInfo->SpImageSize); @@ -190,9 +190,9 @@ CreateHobListFromBootInfo ( MmramRanges[3].RegionState = EFI_CACHEABLE | EFI_ALLOCATED; // Base and size of heap memory shared by all cpus - MmramRanges[4].PhysicalStart = (EFI_PHYSICAL_ADDRESS) HobStart; - MmramRanges[4].CpuStart = (EFI_PHYSICAL_ADDRESS) HobStart; - MmramRanges[4].PhysicalSize = HobStart->EfiFreeMemoryBottom - (EFI_PHYSICAL_ADDRESS) HobStart; + MmramRanges[4].PhysicalStart = (EFI_PHYSICAL_ADDRESS) (UINTN) HobStart; + MmramRanges[4].CpuStart = (EFI_PHYSICAL_ADDRESS) (UINTN) HobStart; + MmramRanges[4].PhysicalSize = HobStart->EfiFreeMemoryBottom - (EFI_PHYSICAL_ADDRESS) (UINTN) HobStart; MmramRanges[4].RegionState = EFI_CACHEABLE | EFI_ALLOCATED; // Base and size of heap memory shared by all cpus diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCoreEntryPoint.c b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCoreEntryPoint.c index 6c50f470aa..b445d6942e 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCoreEntryPoint.c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCoreEntryPoint.c @@ -328,7 +328,7 @@ _ModuleEntryPoint ( // Locate PE/COFF File information for the Standalone MM core module Status = LocateStandaloneMmCorePeCoffData ( - (EFI_FIRMWARE_VOLUME_HEADER *) PayloadBootInfo->SpImageBase, + (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PayloadBootInfo->SpImageBase, &TeData, &TeDataSize ); -- 2.17.1