qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target-sparc: Fix wrong printf argument
@ 2010-05-12 18:34 Stefan Weil
  2010-05-12 19:22 ` [Qemu-devel] " Blue Swirl
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Weil @ 2010-05-12 18:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Blue Swirl

cpu_get_ccr() returns a target_ulong, so a type cast is needed to avoid
wrong output on big endian hosts. We could also use TARGET_FMT_lx,
but that would print 8 instead of 2 digits.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 target-sparc/helper.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/target-sparc/helper.c b/target-sparc/helper.c
index 4642122..582de10 100644
--- a/target-sparc/helper.c
+++ b/target-sparc/helper.c
@@ -1490,7 +1490,7 @@ void cpu_dump_state(CPUState *env, FILE *f,
     }
 #ifdef TARGET_SPARC64
     cpu_fprintf(f, "pstate: %08x ccr: %02x (icc: ", env->pstate,
-                cpu_get_ccr(env));
+                (unsigned)cpu_get_ccr(env));
     cpu_print_cc(f, cpu_fprintf, cpu_get_ccr(env) << PSR_CARRY_SHIFT);
     cpu_fprintf(f, " xcc: ");
     cpu_print_cc(f, cpu_fprintf, cpu_get_ccr(env) << (PSR_CARRY_SHIFT - 4));
-- 
1.7.1

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

* [Qemu-devel] Re: [PATCH] target-sparc: Fix wrong printf argument
  2010-05-12 18:34 [Qemu-devel] [PATCH] target-sparc: Fix wrong printf argument Stefan Weil
@ 2010-05-12 19:22 ` Blue Swirl
  0 siblings, 0 replies; 2+ messages in thread
From: Blue Swirl @ 2010-05-12 19:22 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-devel

Thanks, applied.

Another solution would have been to change the return value to uint32_t.

On 5/12/10, Stefan Weil <weil@mail.berlios.de> wrote:
> cpu_get_ccr() returns a target_ulong, so a type cast is needed to avoid
>  wrong output on big endian hosts. We could also use TARGET_FMT_lx,
>  but that would print 8 instead of 2 digits.
>
>  Cc: Blue Swirl <blauwirbel@gmail.com>
>  Signed-off-by: Stefan Weil <weil@mail.berlios.de>
>  ---
>   target-sparc/helper.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
>  diff --git a/target-sparc/helper.c b/target-sparc/helper.c
>  index 4642122..582de10 100644
>  --- a/target-sparc/helper.c
>  +++ b/target-sparc/helper.c
>  @@ -1490,7 +1490,7 @@ void cpu_dump_state(CPUState *env, FILE *f,
>      }
>   #ifdef TARGET_SPARC64
>      cpu_fprintf(f, "pstate: %08x ccr: %02x (icc: ", env->pstate,
>  -                cpu_get_ccr(env));
>  +                (unsigned)cpu_get_ccr(env));
>      cpu_print_cc(f, cpu_fprintf, cpu_get_ccr(env) << PSR_CARRY_SHIFT);
>      cpu_fprintf(f, " xcc: ");
>      cpu_print_cc(f, cpu_fprintf, cpu_get_ccr(env) << (PSR_CARRY_SHIFT - 4));
>
> --
>  1.7.1
>
>

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

end of thread, other threads:[~2010-05-12 19:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-12 18:34 [Qemu-devel] [PATCH] target-sparc: Fix wrong printf argument Stefan Weil
2010-05-12 19:22 ` [Qemu-devel] " Blue Swirl

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