qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fabrice Bellard <fabrice@bellard.org>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [patch] Bugfix for 64-bit targets
Date: Sun, 15 Aug 2004 16:57:14 +0200	[thread overview]
Message-ID: <411F79CA.8050600@bellard.org> (raw)
In-Reply-To: <200408110122.50589.paul@codesourcery.com>

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

      reply	other threads:[~2004-08-15 15:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-11  0:22 [Qemu-devel] [patch] Bugfix for 64-bit targets Paul Brook
2004-08-15 14:57 ` Fabrice Bellard [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=411F79CA.8050600@bellard.org \
    --to=fabrice@bellard.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).