qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/2] Fix g2h() for 32-bit targets on 64-bit host


From: Benjamin Herrenschmidt
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

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 via email to

[Prev in Thread] Current Thread [Next in Thread]