linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: Replace hardcoded offset by BREAK_INSTR_SIZE
@ 2010-07-28  9:18 Michal Simek
  2010-07-28 11:16 ` Jason Wessel
  2010-07-30 12:26 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Michal Simek @ 2010-07-28  9:18 UTC (permalink / raw)
  Cc: linuxppc-dev, Michal Simek, Jason Wessel

kgdb_handle_breakpoint checks the first arch_kgdb_breakpoint
which is not known by gdb that's why is necessary jump over
it. The jump lenght is equal to BREAK_INSTR_SIZE that's
why is cleaner to use defined macro instead of hardcoded
non-described offset.

Signed-off-by: Michal Simek <monstr@monstr.eu>
CC: Jason Wessel <jason.wessel@windriver.com>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: linuxppc-dev@ozlabs.org
---
 arch/powerpc/kernel/kgdb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
index 82a7b22..7f61a3a 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -129,7 +129,7 @@ static int kgdb_handle_breakpoint(struct pt_regs *regs)
 		return 0;
 
 	if (*(u32 *) (regs->nip) == *(u32 *) (&arch_kgdb_ops.gdb_bpt_instr))
-		regs->nip += 4;
+		regs->nip += BREAK_INSTR_SIZE;
 
 	return 1;
 }
-- 
1.5.5.6

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

* Re: [PATCH] powerpc: Replace hardcoded offset by BREAK_INSTR_SIZE
  2010-07-28  9:18 [PATCH] powerpc: Replace hardcoded offset by BREAK_INSTR_SIZE Michal Simek
@ 2010-07-28 11:16 ` Jason Wessel
  2010-07-30 12:26 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Wessel @ 2010-07-28 11:16 UTC (permalink / raw)
  To: Michal Simek; +Cc: KGDB Mailing List, linuxppc-dev

On 07/28/2010 04:18 AM, Michal Simek wrote:
> kgdb_handle_breakpoint checks the first arch_kgdb_breakpoint
> which is not known by gdb that's why is necessary jump over
> it. The jump lenght is equal to BREAK_INSTR_SIZE that's
> why is cleaner to use defined macro instead of hardcoded
> non-described offset.
>
>   
Seems fine to me.  I'll add this to the kgdb merge queue for 2.6.36.

Jason.

> Signed-off-by: Michal Simek <monstr@monstr.eu>
> CC: Jason Wessel <jason.wessel@windriver.com>
> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> CC: linuxppc-dev@ozlabs.org
> ---
>  arch/powerpc/kernel/kgdb.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
> index 82a7b22..7f61a3a 100644
> --- a/arch/powerpc/kernel/kgdb.c
> +++ b/arch/powerpc/kernel/kgdb.c
> @@ -129,7 +129,7 @@ static int kgdb_handle_breakpoint(struct pt_regs *regs)
>  		return 0;
>  
>  	if (*(u32 *) (regs->nip) == *(u32 *) (&arch_kgdb_ops.gdb_bpt_instr))
> -		regs->nip += 4;
> +		regs->nip += BREAK_INSTR_SIZE;
>  
>  	return 1;
>  }
>   

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

* Re: [PATCH] powerpc: Replace hardcoded offset by BREAK_INSTR_SIZE
  2010-07-28  9:18 [PATCH] powerpc: Replace hardcoded offset by BREAK_INSTR_SIZE Michal Simek
  2010-07-28 11:16 ` Jason Wessel
@ 2010-07-30 12:26 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2010-07-30 12:26 UTC (permalink / raw)
  To: Michal Simek; +Cc: linuxppc-dev, Jason Wessel

[-- Attachment #1: Type: text/plain, Size: 1204 bytes --]

On Wed, 2010-07-28 at 11:18 +0200, Michal Simek wrote:
> kgdb_handle_breakpoint checks the first arch_kgdb_breakpoint
> which is not known by gdb that's why is necessary jump over
> it. The jump lenght is equal to BREAK_INSTR_SIZE that's
> why is cleaner to use defined macro instead of hardcoded
> non-described offset.
> 
> Signed-off-by: Michal Simek <monstr@monstr.eu>
> CC: Jason Wessel <jason.wessel@windriver.com>
> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> CC: linuxppc-dev@ozlabs.org
> ---
>  arch/powerpc/kernel/kgdb.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
> index 82a7b22..7f61a3a 100644
> --- a/arch/powerpc/kernel/kgdb.c
> +++ b/arch/powerpc/kernel/kgdb.c
> @@ -129,7 +129,7 @@ static int kgdb_handle_breakpoint(struct pt_regs *regs)
>  		return 0;
>  
>  	if (*(u32 *) (regs->nip) == *(u32 *) (&arch_kgdb_ops.gdb_bpt_instr))
> -		regs->nip += 4;
> +		regs->nip += BREAK_INSTR_SIZE;

Except to powerpc fokls, who intuitively know what nip + 4 means, but
will have to lookup what BREAK_INSTR_SIZE is to be sure. But I'm being
nit-picky :)

cheers


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

end of thread, other threads:[~2010-07-30 12:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-28  9:18 [PATCH] powerpc: Replace hardcoded offset by BREAK_INSTR_SIZE Michal Simek
2010-07-28 11:16 ` Jason Wessel
2010-07-30 12:26 ` 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).