linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Philippe Bergheaud <felix@linux.vnet.ibm.com>
To: Tom Musta <tommusta@gmail.com>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc: fix xmon disassembler for little-endian
Date: Wed, 04 Dec 2013 14:45:28 +0100	[thread overview]
Message-ID: <529F31F8.6040302@linux.vnet.ibm.com> (raw)
In-Reply-To: <529C9397.9050704@gmail.com>

Tom Musta wrote:
> On 12/2/2013 3:10 AM, Philippe Bergheaud wrote:
> 
>>This patch fixes the disassembler of the powerpc kernel debugger xmon,
>>for little-endian.
>>
>>Signed-off-by: Philippe Bergheaud <felix@linux.vnet.ibm.com>
>>---
>> arch/powerpc/xmon/xmon.c |    4 ++++
>> 1 file changed, 4 insertions(+)
>>
>>diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
>>index af9d346..6c27804 100644
>>--- a/arch/powerpc/xmon/xmon.c
>>+++ b/arch/powerpc/xmon/xmon.c
>>@@ -171,7 +171,11 @@ extern void xmon_leave(void);
>> #define REG		"%.8lx"
>> #endif
>> 
>>+#ifdef __LITTLE_ENDIAN__
>>+#define GETWORD(v)	(((v)[3] << 24) + ((v)[2] << 16) + ((v)[1] << 8) + (v)[0])
>>+#else
>> #define GETWORD(v)	(((v)[0] << 24) + ((v)[1] << 16) + ((v)[2] << 8) + (v)[3])
>>+#endif
>> 
>> #define isxdigit(c)	(('0' <= (c) && (c) <= '9') \
>> 			 || ('a' <= (c) && (c) <= 'f') \
>>
> 
> 
> Philippe:  Wouldn't it be better to just do a 32-bit load and let the endianness be worked out
> by the hardware?  i.e.
> 
> #define GETWORD(v) (*(u32 *)v)
Yes, your alternative is better.
Wouldn't it narrow the scope of the macro to aligned words on POWER7?
I think that all references to GETWORD operate on aligned words anyway.

Philippe

  reply	other threads:[~2013-12-04 13:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-02  9:10 [PATCH] powerpc: fix xmon disassembler for little-endian Philippe Bergheaud
2013-12-02 14:05 ` Tom Musta
2013-12-04 13:45   ` Philippe Bergheaud [this message]
2013-12-05  4:39     ` Benjamin Herrenschmidt
2013-12-05  8:50       ` Philippe Bergheaud

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-all 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=529F31F8.6040302@linux.vnet.ibm.com \
    --to=felix@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=tommusta@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).