linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1][PPC] Test value, not 1 in print_insn_spu(), arch/powerpc/xmon/spu-dis.c
@ 2008-01-28 14:10 Roel Kluin
  2008-01-29 13:24 ` Michael Ellerman
  0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2008-01-28 14:10 UTC (permalink / raw)
  To: jwboyer, michael; +Cc: linuxppc-dev

untested, please confirm:
The '|| 1' does nothing, should this be corrected like my patch does?
--
Test value, not 1.

Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
---
diff --git a/arch/powerpc/xmon/spu-dis.c b/arch/powerpc/xmon/spu-dis.c
index e5f8983..74d45fb 100644
--- a/arch/powerpc/xmon/spu-dis.c
+++ b/arch/powerpc/xmon/spu-dis.c
@@ -222,7 +222,7 @@ print_insn_spu (unsigned long insn, unsigned long memaddr)
 	      break;
 	    case A_U18:
 	      value = DECODE_INSN_U18 (insn);
-	      if (value == 0 || 1)
+	      if (value == 0 || value == 1)
 		{
 		  hex_value = value;
 		  printf("%u", value);

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

* Re: [PATCH 1/1][PPC] Test value, not 1 in print_insn_spu(), arch/powerpc/xmon/spu-dis.c
  2008-01-28 14:10 [PATCH 1/1][PPC] Test value, not 1 in print_insn_spu(), arch/powerpc/xmon/spu-dis.c Roel Kluin
@ 2008-01-29 13:24 ` Michael Ellerman
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2008-01-29 13:24 UTC (permalink / raw)
  To: Roel Kluin; +Cc: linuxppc-dev

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

On Mon, 2008-01-28 at 15:10 +0100, Roel Kluin wrote:
> untested, please confirm:
> The '|| 1' does nothing, should this be corrected like my patch does?
> --
> Test value, not 1.
> 
> Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
> ---
> diff --git a/arch/powerpc/xmon/spu-dis.c b/arch/powerpc/xmon/spu-dis.c
> index e5f8983..74d45fb 100644
> --- a/arch/powerpc/xmon/spu-dis.c
> +++ b/arch/powerpc/xmon/spu-dis.c
> @@ -222,7 +222,7 @@ print_insn_spu (unsigned long insn, unsigned long memaddr)
>  	      break;
>  	    case A_U18:
>  	      value = DECODE_INSN_U18 (insn);
> -	      if (value == 0 || 1)
> +	      if (value == 0 || value == 1)
>  		{
>  		  hex_value = value;
>  		  printf("%u", value);

The original binutils code looks like:

            case A_U18:
              value = DECODE_INSN_U18 (insn);
              if (value == 0 || !(*info->symbol_at_address_func)(0, info))
                {
                  hex_value = value;
                  (*info->fprintf_func) (info->stream, "%u", value);
                }
              else
                (*info->print_address_func) (value, info);
              break;

We don't have a symbol_at_address_func() so we always guess there isn't
a symbol at the address, as if the function had returned 0. Which gives
us:
              if (value == 0 || !0)
or
              if (value == 0 || 1)

The reason I left it like that rather than removing the if, was to
minimise the diff between the kernel version of spu-dis.c and the
binutils version.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

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

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

end of thread, other threads:[~2008-01-29 13:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-28 14:10 [PATCH 1/1][PPC] Test value, not 1 in print_insn_spu(), arch/powerpc/xmon/spu-dis.c Roel Kluin
2008-01-29 13:24 ` 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).