LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Nicholas Piggin" <npiggin@gmail.com>
To: "Michael Ellerman" <mpe@ellerman.id.au>, <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH 2/2] powerpc: Reverse stack frame marker on little endian
Date: Wed, 28 Sep 2022 13:13:14 +1000	[thread overview]
Message-ID: <CN7PG1IA5HUZ.MCPQ7S3QQKWO@bobo> (raw)
In-Reply-To: <20220927150419.1503001-2-mpe@ellerman.id.au>

On Wed Sep 28, 2022 at 1:04 AM AEST, Michael Ellerman wrote:
> On little endian the stack frame marker appears reserved when dumping
> memory sequentially, as is typical in xmon or gdb, eg:
>
>   c000000004733e40 0000000000000000 0000000000000000  |................|
>   c000000004733e50 0000000000000000 0000000000000000  |................|
>   c000000004733e60 0000000000000000 0000000000000000  |................|
>   c000000004733e70 5347455200000000 0000000000000000  |SGER............|
>   c000000004733e80 a700000000000000 708897f7ff7f0000  |........p.......|
>   c000000004733e90 0073428fff7f0000 208997f7ff7f0000  |.sB..... .......|
>   c000000004733ea0 0100000000000000 ffffffffffffffff  |................|
>   c000000004733eb0 0000000000000000 0000000000000000  |................|
>
> To make it easier to recognise, reverse the value on little endian, so
> it always appears as "REGS", eg:
>
>   c000000004733e70 5245475300000000 0000000000000000  |REGS............|
>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

Both look fine to me.

Acked-by: Nicholas Piggin <npiggin@gmail.com>

> ---
>  arch/powerpc/include/asm/ptrace.h | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h
> index 6c23d1d25dc7..2efec6d87049 100644
> --- a/arch/powerpc/include/asm/ptrace.h
> +++ b/arch/powerpc/include/asm/ptrace.h
> @@ -99,7 +99,12 @@ struct pt_regs
>  
>  #define STACK_FRAME_WITH_PT_REGS (STACK_FRAME_OVERHEAD + sizeof(struct pt_regs))
>  
> +// Always displays as "REGS" in memory dumps
> +#ifdef CONFIG_CPU_BIG_ENDIAN
>  #define STACK_FRAME_REGS_MARKER	ASM_CONST(0x52454753)
> +#else
> +#define STACK_FRAME_REGS_MARKER	ASM_CONST(0x53474552)
> +#endif
>  
>  #ifdef __powerpc64__
>  
> -- 
> 2.37.3


  reply	other threads:[~2022-09-28  3:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-27 15:04 [PATCH 1/2] powerpc: Make stack frame marker upper case Michael Ellerman
2022-09-27 15:04 ` [PATCH 2/2] powerpc: Reverse stack frame marker on little endian Michael Ellerman
2022-09-28  3:13   ` Nicholas Piggin [this message]
2022-10-04 13:26 ` [PATCH 1/2] powerpc: Make stack frame marker upper case Michael Ellerman

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=CN7PG1IA5HUZ.MCPQ7S3QQKWO@bobo \
    --to=npiggin@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    /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