From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: shenglei.zhang@intel.com) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by groups.io with SMTP; Wed, 04 Sep 2019 23:19:36 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Sep 2019 23:19:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,469,1559545200"; d="scan'208";a="187872153" Received: from shenglei-dev.ccr.corp.intel.com ([10.239.158.52]) by orsmga006.jf.intel.com with ESMTP; 04 Sep 2019 23:19:34 -0700 From: "Zhang, Shenglei" To: devel@edk2.groups.io Cc: Michael Kubacki , Chasel Chiu , Nate DeSimone , Liming Gao Subject: [PATCH v2] MinPlatformPkg/SecFspWrapperPlatformSecLib: Change TopOfTemporaryRam type Date: Thu, 5 Sep 2019 14:19:32 +0800 Message-Id: <20190905061932.28428-1-shenglei.zhang@intel.com> X-Mailer: git-send-email 2.18.0.windows.1 Update the type of TopOfTemporaryRam from UINT32 to UINTN. This change is intended to support X64 build scenarios. The original code(line 64) may cast the overfloewed result produced by "(TopOfTemporaryRam - sizeof (UINT32))"from 32bit to 64bit. Cc: Michael Kubacki Cc: Chasel Chiu Cc: Nate DeSimone Cc: Liming Gao Signed-off-by: Shenglei Zhang --- v2: As TopOfTemporaryRam is defined as UINTN in v2, remove all the related casting operations which exist in v1 patch. .../SecFspWrapperPlatformSecLib/SecGetPerformance.c | 8 ++++---- .../SecFspWrapperPlatformSecLib/SecPlatformInformation.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecGetPerformance.c b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecGetPerformance.c index c4eeb2b1..8535ae04 100644 --- a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecGetPerformance.c +++ b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecGetPerformance.c @@ -41,7 +41,7 @@ SecGetPerformance ( { UINT32 Size; UINT32 Count; - UINT32 TopOfTemporaryRam; + UINTN TopOfTemporaryRam; UINT64 Ticker; VOID *TopOfTemporaryRamPpi; EFI_STATUS Status; @@ -77,12 +77,12 @@ SecGetPerformance ( // | TSC[31:00] | // |--------------| // - TopOfTemporaryRam = (UINT32)(UINTN)TopOfTemporaryRamPpi - sizeof(UINT32); + TopOfTemporaryRam = (UINTN)TopOfTemporaryRamPpi - sizeof(UINT32); TopOfTemporaryRam -= sizeof(UINT32) * 2; - Count = *(UINT32 *) (UINTN) (TopOfTemporaryRam - sizeof (UINT32)); + Count = *(UINT32 *)(TopOfTemporaryRam - sizeof (UINT32)); Size = Count * sizeof (UINT32); - Ticker = *(UINT64 *) (UINTN) (TopOfTemporaryRam - sizeof (UINT32) - Size - sizeof (UINT32) * 2); + Ticker = *(UINT64 *) (TopOfTemporaryRam - sizeof (UINT32) - Size - sizeof (UINT32) * 2); Performance->ResetEnd = GetTimeInNanoSecond (Ticker); return EFI_SUCCESS; diff --git a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecPlatformInformation.c b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecPlatformInformation.c index 5b94ed2b..ade36ab5 100644 --- a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecPlatformInformation.c +++ b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecPlatformInformation.c @@ -36,7 +36,7 @@ SecPlatformInformation ( UINT32 *Bist; UINT32 Size; UINT32 Count; - UINT32 TopOfTemporaryRam; + UINTN TopOfTemporaryRam; VOID *TopOfTemporaryRamPpi; EFI_STATUS Status; @@ -59,9 +59,9 @@ SecPlatformInformation ( // This routine copies the BIST information to the buffer pointed by // PlatformInformationRecord for output. // - TopOfTemporaryRam = (UINT32)(UINTN)TopOfTemporaryRamPpi - sizeof (UINT32); + TopOfTemporaryRam = (UINTN)TopOfTemporaryRamPpi - sizeof (UINT32); TopOfTemporaryRam -= sizeof(UINT32) * 2; - Count = *((UINT32 *)(UINTN) (TopOfTemporaryRam - sizeof (UINT32))); + Count = *((UINT32 *)(TopOfTemporaryRam - sizeof (UINT32))); Size = Count * sizeof (IA32_HANDOFF_STATUS); if ((*StructureSize) < (UINT64) Size) { -- 2.18.0.windows.1