* [PATCH] powerpc: fix xmon disassembler for little-endian
@ 2013-12-02 9:10 Philippe Bergheaud
2013-12-02 14:05 ` Tom Musta
0 siblings, 1 reply; 5+ messages in thread
From: Philippe Bergheaud @ 2013-12-02 9:10 UTC (permalink / raw)
To: Linuxppc-dev; +Cc: Philippe Bergheaud
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') \
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] powerpc: fix xmon disassembler for little-endian
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
0 siblings, 1 reply; 5+ messages in thread
From: Tom Musta @ 2013-12-02 14:05 UTC (permalink / raw)
To: linuxppc-dev
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)
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] powerpc: fix xmon disassembler for little-endian
2013-12-02 14:05 ` Tom Musta
@ 2013-12-04 13:45 ` Philippe Bergheaud
2013-12-05 4:39 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 5+ messages in thread
From: Philippe Bergheaud @ 2013-12-04 13:45 UTC (permalink / raw)
To: Tom Musta; +Cc: linuxppc-dev
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] powerpc: fix xmon disassembler for little-endian
2013-12-04 13:45 ` Philippe Bergheaud
@ 2013-12-05 4:39 ` Benjamin Herrenschmidt
2013-12-05 8:50 ` Philippe Bergheaud
0 siblings, 1 reply; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2013-12-05 4:39 UTC (permalink / raw)
To: Philippe Bergheaud; +Cc: Tom Musta, linuxppc-dev
On Wed, 2013-12-04 at 14:45 +0100, Philippe Bergheaud wrote:
> >>+#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.
Well, xmon has to be robust ... as long as you are *certain* that even
with crap entry state it won't try to access unaligned boundaries then
go for it but we aren't looking at performance here.
Cheers,
Ben.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] powerpc: fix xmon disassembler for little-endian
2013-12-05 4:39 ` Benjamin Herrenschmidt
@ 2013-12-05 8:50 ` Philippe Bergheaud
0 siblings, 0 replies; 5+ messages in thread
From: Philippe Bergheaud @ 2013-12-05 8:50 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Tom Musta, linuxppc-dev
Benjamin Herrenschmidt wrote:
> On Wed, 2013-12-04 at 14:45 +0100, Philippe Bergheaud wrote:
>
>
>>>>+#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.
>
>
> Well, xmon has to be robust ... as long as you are *certain* that even
> with crap entry state it won't try to access unaligned boundaries then
> go for it but we aren't looking at performance here.
Thank you Tom and Ben. We are definitely not looking at performance here.
I prefer to stay on the safe side, and leave the original patch untouched.
Philippe
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-12-05 8:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2013-12-05 4:39 ` Benjamin Herrenschmidt
2013-12-05 8:50 ` Philippe Bergheaud
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).