qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 2/2] Fix g2h() for 32-bit targets on 64-bit hosts
Date: Wed, 03 Aug 2016 19:50:30 +1000	[thread overview]
Message-ID: <1470217830.12584.70.camel@kernel.crashing.org> (raw)
In-Reply-To: <CAFEAcA9LK_Ew=oxmJM9qoF_Ar6YrPJvxdPgzrmpgFmmr-wBQ5A@mail.gmail.com>

On Wed, 2016-08-03 at 09:40 +0100, Peter Maydell wrote:
> > index 6eb5fe8..0164535 100644
> > --- a/include/exec/cpu_ldst.h
> > +++ b/include/exec/cpu_ldst.h
> > @@ -49,7 +49,7 @@
> >
> >  #if defined(CONFIG_USER_ONLY)
> >  /* All direct uses of g2h and h2g need to go away for usermode softmmu.  */
> > -#define g2h(x) ((void *)((unsigned long)(target_ulong)(x) + guest_base))
> > +#define g2h(x) ((void *)(guest_base + (unsigned long)(target_ulong)(x)))
> 
> I'm confused. Is this just swapping the order of the operands to '+'?
> I wouldn't expect that to make any difference because typecast has
> higher precedence than '+'...

The typecast to target_ulong which is 32-bits :-)

> > I run 32-bit (ARM) programs on x86-64 a lot so I would be surprised
> if g2h() was broken like this.

I had a pretty clear breakage case, and this along with patch 1 fixed
it.

Cheers,
Ben.

  reply	other threads:[~2016-08-03  9:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-03  3:15 [Qemu-devel] [PATCH 2/2] Fix g2h() for 32-bit targets on 64-bit hosts Benjamin Herrenschmidt
2016-08-03  8:40 ` Peter Maydell
2016-08-03  9:50   ` Benjamin Herrenschmidt [this message]
2016-08-03 10:18     ` Benjamin Herrenschmidt
2016-08-03 10:48       ` Peter Maydell
2016-08-03 10:51         ` Benjamin Herrenschmidt

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=1470217830.12584.70.camel@kernel.crashing.org \
    --to=benh@kernel.crashing.org \
    --cc=peter.maydell@linaro.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).