From nobody Sun Apr 28 12:18:32 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1495514064761270.04654828058653; Mon, 22 May 2017 21:34:24 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 4895121A134B8; Mon, 22 May 2017 21:34:21 -0700 (PDT) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2216F21A09104 for ; Mon, 22 May 2017 21:34:19 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 May 2017 21:34:13 -0700 Received: from shwdeopenpsi068.ccr.corp.intel.com ([10.239.9.20]) by orsmga002.jf.intel.com with ESMTP; 22 May 2017 21:34:12 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,380,1491289200"; d="scan'208";a="90542137" From: Star Zeng To: edk2-devel@lists.01.org Date: Tue, 23 May 2017 12:34:09 +0800 Message-Id: <1495514049-71204-1-git-send-email-star.zeng@intel.com> X-Mailer: git-send-email 2.7.0.windows.1 Subject: [edk2] [PATCH] MdeModulePkg SmiHandlerProfile: Fix no PDB case handling incorrectly X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jiewen Yao , Star Zeng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D569 The PdbStringOffset should be set to 0 for no PDB case, then SmiHandlerProfileInfo can use it to know whether there is PCD info or not. Cc: Jiewen Yao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng Reviewed-by: Jiewen.yao@intel.com --- .../Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c | 10 ++++++= ---- MdeModulePkg/Core/PiSmmCore/SmiHandlerProfile.c | 8 ++++++= -- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfi= leInfo.c b/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfile= Info.c index 2419cd2959a9..338671374c72 100644 --- a/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c +++ b/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c @@ -266,8 +266,8 @@ GetDriverNameString ( // // Method 1: Get the name string from image PDB // - if (ImageStruct->Header.Length > sizeof (SMM_CORE_IMAGE_DATABASE_STRUCTU= RE)) { - GetShortPdbFileName ((CHAR8 *) (ImageStruct + 1), mNameString); + if (ImageStruct->PdbStringOffset !=3D 0) { + GetShortPdbFileName ((CHAR8 *) ((UINTN) ImageStruct + ImageStruct->Pdb= StringOffset), mNameString); return mNameString; } =20 @@ -355,8 +355,10 @@ DumpSmmLoadedImage( Print(L" FvFile=3D\"%g\"", &ImageStruct->FileGuid); Print(L" RefId=3D\"0x%x\"", ImageStruct->ImageRef); Print(L">\n"); - PdbString =3D (CHAR8 *)((UINTN)ImageStruct + ImageStruct->PdbStringO= ffset); - Print(L" %a\n", PdbString); + if (ImageStruct->PdbStringOffset !=3D 0) { + PdbString =3D (CHAR8 *)((UINTN)ImageStruct + ImageStruct->PdbStrin= gOffset); + Print(L" %a\n", PdbString); + } Print(L" \n"); } =20 diff --git a/MdeModulePkg/Core/PiSmmCore/SmiHandlerProfile.c b/MdeModulePkg= /Core/PiSmmCore/SmiHandlerProfile.c index 63dcf6e3a1e7..49eba945fd9a 100644 --- a/MdeModulePkg/Core/PiSmmCore/SmiHandlerProfile.c +++ b/MdeModulePkg/Core/PiSmmCore/SmiHandlerProfile.c @@ -651,8 +651,12 @@ GetSmmImageDatabaseData ( ImageStruct->EntryPoint =3D mImageStruct[Index].EntryPoint; ImageStruct->ImageBase =3D mImageStruct[Index].ImageBase; ImageStruct->ImageSize =3D mImageStruct[Index].ImageSize; - ImageStruct->PdbStringOffset =3D sizeof(SMM_CORE_IMAGE_DATABASE_STRUCT= URE); - CopyMem ((VOID *)((UINTN)ImageStruct + ImageStruct->PdbStringOffset), = mImageStruct[Index].PdbString, mImageStruct[Index].PdbStringSize); + if (mImageStruct[Index].PdbStringSize !=3D 0) { + ImageStruct->PdbStringOffset =3D sizeof(SMM_CORE_IMAGE_DATABASE_STRU= CTURE); + CopyMem ((VOID *)((UINTN)ImageStruct + ImageStruct->PdbStringOffset)= , mImageStruct[Index].PdbString, mImageStruct[Index].PdbStringSize); + } else { + ImageStruct->PdbStringOffset =3D 0; + } ImageStruct =3D (SMM_CORE_IMAGE_DATABASE_STRUCTURE *)((UINTN)ImageStru= ct + ImageStruct->Header.Length); Size +=3D sizeof(SMM_CORE_IMAGE_DATABASE_STRUCTURE) + mImageStruct[Ind= ex].PdbStringSize; } --=20 2.7.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel