linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] powerpc: Make stack frame marker upper case
@ 2022-09-27 15:04 Michael Ellerman
  2022-09-27 15:04 ` [PATCH 2/2] powerpc: Reverse stack frame marker on little endian Michael Ellerman
  2022-10-04 13:26 ` [PATCH 1/2] powerpc: Make stack frame marker upper case Michael Ellerman
  0 siblings, 2 replies; 4+ messages in thread
From: Michael Ellerman @ 2022-09-27 15:04 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: npiggin

Now that the stack frame regs marker is only 32-bits it is not as
obvious in memory dumps and easier to miss, eg:

  c000000004733e40 0000000000000000 0000000000000000  |................|
  c000000004733e50 0000000000000000 0000000000000000  |................|
  c000000004733e60 0000000000000000 0000000000000000  |................|
  c000000004733e70 7367657200000000 0000000000000000  |sger............|
  c000000004733e80 a700000000000000 708897f7ff7f0000  |........p.......|
  c000000004733e90 0073428fff7f0000 208997f7ff7f0000  |.sB..... .......|
  c000000004733ea0 0100000000000000 ffffffffffffffff  |................|
  c000000004733eb0 0000000000000000 0000000000000000  |................|

So make it upper case to make it stand out a bit more:

  c000000004733e70 5347455200000000 0000000000000000  |SGER............|

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/include/asm/ptrace.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h
index 5b496e589d54..6c23d1d25dc7 100644
--- a/arch/powerpc/include/asm/ptrace.h
+++ b/arch/powerpc/include/asm/ptrace.h
@@ -99,7 +99,7 @@ struct pt_regs
 
 #define STACK_FRAME_WITH_PT_REGS (STACK_FRAME_OVERHEAD + sizeof(struct pt_regs))
 
-#define STACK_FRAME_REGS_MARKER	ASM_CONST(0x72656773)
+#define STACK_FRAME_REGS_MARKER	ASM_CONST(0x52454753)
 
 #ifdef __powerpc64__
 
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] powerpc: Reverse stack frame marker on little endian
  2022-09-27 15:04 [PATCH 1/2] powerpc: Make stack frame marker upper case Michael Ellerman
@ 2022-09-27 15:04 ` Michael Ellerman
  2022-09-28  3:13   ` Nicholas Piggin
  2022-10-04 13:26 ` [PATCH 1/2] powerpc: Make stack frame marker upper case Michael Ellerman
  1 sibling, 1 reply; 4+ messages in thread
From: Michael Ellerman @ 2022-09-27 15:04 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: npiggin

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>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] powerpc: Reverse stack frame marker on little endian
  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
  0 siblings, 0 replies; 4+ messages in thread
From: Nicholas Piggin @ 2022-09-28  3:13 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] powerpc: Make stack frame marker upper case
  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-10-04 13:26 ` Michael Ellerman
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2022-10-04 13:26 UTC (permalink / raw)
  To: linuxppc-dev, Michael Ellerman; +Cc: npiggin

On Wed, 28 Sep 2022 01:04:18 +1000, Michael Ellerman wrote:
> Now that the stack frame regs marker is only 32-bits it is not as
> obvious in memory dumps and easier to miss, eg:
> 
>   c000000004733e40 0000000000000000 0000000000000000  |................|
>   c000000004733e50 0000000000000000 0000000000000000  |................|
>   c000000004733e60 0000000000000000 0000000000000000  |................|
>   c000000004733e70 7367657200000000 0000000000000000  |sger............|
>   c000000004733e80 a700000000000000 708897f7ff7f0000  |........p.......|
>   c000000004733e90 0073428fff7f0000 208997f7ff7f0000  |.sB..... .......|
>   c000000004733ea0 0100000000000000 ffffffffffffffff  |................|
>   c000000004733eb0 0000000000000000 0000000000000000  |................|
> 
> [...]

Applied to powerpc/next.

[1/2] powerpc: Make stack frame marker upper case
      https://git.kernel.org/powerpc/c/bbd71709087a9d486d1da42399eec14e106072f2
[2/2] powerpc: Reverse stack frame marker on little endian
      https://git.kernel.org/powerpc/c/19c95df1277c48e3ef8cc7d9f1d315dce949f203

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-04 13:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2022-10-04 13:26 ` [PATCH 1/2] powerpc: Make stack frame marker upper case Michael Ellerman

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).