qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [patch] Bugfix for 64-bit targets
@ 2004-08-11  0:22 Paul Brook
  2004-08-15 14:57 ` Fabrice Bellard
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Brook @ 2004-08-11  0:22 UTC (permalink / raw)
  To: qemu-devel

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

The attached patch fixes a bug in arm target emulation on hosts where 
sizeof(int) > 4. On these targets the offset wouldn't be properly sign 
extended.

Paul

[-- Attachment #2: patch.qemu_bl64 --]
[-- Type: text/x-diff, Size: 993 bytes --]

Index: translate.c
===================================================================
RCS file: /cvsroot/qemu/qemu/target-arm/translate.c,v
retrieving revision 1.10
diff -u -p -r1.10 translate.c
--- translate.c	22 Jun 2004 10:55:49 -0000	1.10
+++ translate.c	11 Aug 2004 00:17:59 -0000
@@ -690,15 +867,15 @@ static void disas_arm_insn(DisasContext 
         case 0xa:
         case 0xb:
             {
-                int offset;
+                int32_t offset;
                 
                 /* branch (and link) */
-                val = (int)s->pc;
+                val = (int32_t)s->pc;
                 if (insn & (1 << 24)) {
                     gen_op_movl_T0_im(val);
                     gen_op_movl_reg_TN[0][14]();
                 }
-                offset = (((int)insn << 8) >> 8);
+                offset = (((int32_t)insn << 8) >> 8);
                 val += (offset << 2) + 4;
                 gen_op_jmp((long)s->tb, val);
                 s->is_jmp = DISAS_TB_JUMP;

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

* Re: [Qemu-devel] [patch] Bugfix for 64-bit targets
  2004-08-11  0:22 [Qemu-devel] [patch] Bugfix for 64-bit targets Paul Brook
@ 2004-08-15 14:57 ` Fabrice Bellard
  0 siblings, 0 replies; 2+ messages in thread
From: Fabrice Bellard @ 2004-08-15 14:57 UTC (permalink / raw)
  To: qemu-devel

Hi,

I am afraid to say that sizeof(int) = 4 is hardcoded in QEMU. QEMU 
assumes that sizeof(long) = sizeof(void *) = 4 or 8 bytes depending on 
the host.

Fabrice.

Paul Brook wrote:
> The attached patch fixes a bug in arm target emulation on hosts where 
> sizeof(int) > 4. On these targets the offset wouldn't be properly sign 
> extended.
> 
> Paul
> 
> 
> ------------------------------------------------------------------------
> 
> Index: translate.c
> ===================================================================
> RCS file: /cvsroot/qemu/qemu/target-arm/translate.c,v
> retrieving revision 1.10
> diff -u -p -r1.10 translate.c
> --- translate.c	22 Jun 2004 10:55:49 -0000	1.10
> +++ translate.c	11 Aug 2004 00:17:59 -0000
> @@ -690,15 +867,15 @@ static void disas_arm_insn(DisasContext 
>          case 0xa:
>          case 0xb:
>              {
> -                int offset;
> +                int32_t offset;
>                  
>                  /* branch (and link) */
> -                val = (int)s->pc;
> +                val = (int32_t)s->pc;
>                  if (insn & (1 << 24)) {
>                      gen_op_movl_T0_im(val);
>                      gen_op_movl_reg_TN[0][14]();
>                  }
> -                offset = (((int)insn << 8) >> 8);
> +                offset = (((int32_t)insn << 8) >> 8);
>                  val += (offset << 2) + 4;
>                  gen_op_jmp((long)s->tb, val);
>                  s->is_jmp = DISAS_TB_JUMP;
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel

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

end of thread, other threads:[~2004-08-15 15:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-11  0:22 [Qemu-devel] [patch] Bugfix for 64-bit targets Paul Brook
2004-08-15 14:57 ` Fabrice Bellard

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