public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Fan, Jeff" <jeff.fan@intel.com>
To: "afish@apple.com" <afish@apple.com>,
	Laszlo Ersek <lersek@redhat.com>,
	"Tian, Feng" <feng.tian@intel.com>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "edk2-devel@lists.01.org" <edk2-devel@ml01.01.org>
Subject: Re: [PATCH] UefiCpuPkg/SecCore: Use %x to print stack information
Date: Wed, 16 Nov 2016 01:01:57 +0000	[thread overview]
Message-ID: <542CF652F8836A4AB8DBFAAD40ED192A4A2DE2BE@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <D87FC9B6-271F-4133-A0C7-8B5CD6285738@apple.com>

Andrew,

Yes.  %P is more correct for VOID * type print. We cannot use UINT32 here because 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 information


On Nov 15, 2016, at 8:59 AM, Laszlo Ersek <lersek@redhat.com<mailto:lersek@redhat.com>> wrote:

On 11/15/16 09:32, Jeff Fan wrote:

SecCoreData->StackBase is VOID * type and SecCoreData->StackSize is UINTN type.
We should use %x to dump their value instead of %lx.

Cast pointer type to UINTN before print it.

Cc: Feng Tian <feng.tian@intel.com<mailto:feng.tian@intel.com>>
Cc: Michael D Kinney <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com<mailto:jeff.fan@intel.com>>
---
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/PrintLib.h#L80


    - x


      - The argument is an unsigned hexadecimal number.  The characters used are 0..9 and


        A..F.  If the flag 'L' is not specified, then the argument is assumed


        to be size int.  This does not follow ANSI C.




Thanks,

Andrew Fish


Thanks
Laszlo
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
https://lists.01.org/mailman/listinfo/edk2-devel



      parent reply	other threads:[~2016-11-16  1:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-15  8:32 [PATCH] UefiCpuPkg/SecCore: Use %x to print stack information Jeff Fan
2016-11-15  8:37 ` Tian, Feng
2016-11-15 16:59 ` Laszlo Ersek
2016-11-15 17:47   ` Andrew Fish
2016-11-15 18:11     ` Laszlo Ersek
2016-11-15 18:33       ` Andrew Fish
2016-11-16  1:01     ` Fan, Jeff [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=542CF652F8836A4AB8DBFAAD40ED192A4A2DE2BE@shsmsx102.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox