From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 89E8181E95 for ; Tue, 15 Nov 2016 17:01:58 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 15 Nov 2016 17:02:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,497,1473145200"; d="scan'208,217";a="1085776205" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga002.fm.intel.com with ESMTP; 15 Nov 2016 17:02:02 -0800 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 15 Nov 2016 17:02:02 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 15 Nov 2016 17:02:01 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.239]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.96]) with mapi id 14.03.0248.002; Wed, 16 Nov 2016 09:01:57 +0800 From: "Fan, Jeff" To: "afish@apple.com" , Laszlo Ersek , "Tian, Feng" , "Kinney, Michael D" CC: "edk2-devel@lists.01.org" Thread-Topic: [edk2] [PATCH] UefiCpuPkg/SecCore: Use %x to print stack information Thread-Index: AQHSPxrtVgYAnnzwVUa5AstM6mUf+6DZvu4AgAANXQCAAPbU0A== Date: Wed, 16 Nov 2016 01:01:57 +0000 Message-ID: <542CF652F8836A4AB8DBFAAD40ED192A4A2DE2BE@shsmsx102.ccr.corp.intel.com> References: <20161115083213.7700-1-jeff.fan@intel.com> In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiM2NkOTFkNWMtNTlmYi00MTBiLWEyYzctYTgyNDFmYzQwMTdjIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6Im91ZXEyQzRqNXBsSytGcXJUOXdQN3RJV2s0dzducGwyTUVSa055K29OWlE9In0= x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: Re: [PATCH] UefiCpuPkg/SecCore: Use %x to print stack information X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Nov 2016 01:01:58 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Andrew, Yes. %P is more correct for VOID * type print. We cannot use UINT32 here b= ecause SEC could support x64 arch. Thanks! Jeff From: afish@apple.com [mailto:afish@apple.com] Sent: Wednesday, November 16, 2016 1:47 AM To: Laszlo Ersek; Fan, Jeff; Tian, Feng; Kinney, Michael D Cc: edk2-devel@lists.01.org Subject: Re: [edk2] [PATCH] UefiCpuPkg/SecCore: Use %x to print stack infor= mation On Nov 15, 2016, at 8:59 AM, Laszlo Ersek > wrote: On 11/15/16 09:32, Jeff Fan wrote: SecCoreData->StackBase is VOID * type and SecCoreData->StackSize is UINTN t= ype. We should use %x to dump their value instead of %lx. Cast pointer type to UINTN before print it. Cc: Feng Tian > Cc: Michael D Kinney > Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan > --- UefiCpuPkg/SecCore/SecMain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UefiCpuPkg/SecCore/SecMain.c b/UefiCpuPkg/SecCore/SecMain.c index 2ebbc22..4d08f48 100644 --- a/UefiCpuPkg/SecCore/SecMain.c +++ b/UefiCpuPkg/SecCore/SecMain.c @@ -239,9 +239,9 @@ SecStartupPhase2( DEBUG (( DEBUG_INFO, - "%a() Stack Base: 0x%lx, Stack Size: 0x%lx\n", + "%a() Stack Base: 0x%x, Stack Size: 0x%x\n", __FUNCTION__, - SecCoreData->StackBase, + (UINTN) SecCoreData->StackBase, SecCoreData->StackSize )); Not disagreeing, just mentioning for completeness: we can also use %p for printing (VOID*) directly. %x is sizeof(int) not sizeof(UINTN)? So it seems %p would be more correct? = Or we should just use UINT32 if that is what is intended. https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Library/PrintL= ib.h#L80 - x - The argument is an unsigned hexadecimal number. The characters use= d are 0..9 and A..F. If the flag 'L' is not specified, then the argument is assum= ed to be size int. This does not follow ANSI C. Thanks, Andrew Fish Thanks Laszlo _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel