From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M1LjI-0005m6-Ca for qemu-devel@nongnu.org; Tue, 05 May 2009 10:34:44 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M1LjD-0005hu-PV for qemu-devel@nongnu.org; Tue, 05 May 2009 10:34:43 -0400 Received: from [199.232.76.173] (port=50733 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M1LjD-0005hl-Ib for qemu-devel@nongnu.org; Tue, 05 May 2009 10:34:39 -0400 Received: from mx20.gnu.org ([199.232.41.8]:49590) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1M1LjD-0001qr-9w for qemu-devel@nongnu.org; Tue, 05 May 2009 10:34:39 -0400 Received: from mail.codesourcery.com ([65.74.133.4]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M1LjC-0004BI-7C for qemu-devel@nongnu.org; Tue, 05 May 2009 10:34:38 -0400 From: Paul Brook Subject: Re: [Qemu-devel] [PATCH] Revived GUEST_BASE support for usermode emulation targets [v3] Date: Tue, 5 May 2009 15:34:33 +0100 References: <1241028203-19687-1-git-send-email-riku.voipio@iki.fi> <200905051453.32092.paul@codesourcery.com> <20090505141817.GA31454@kos.to> In-Reply-To: <20090505141817.GA31454@kos.to> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200905051534.33577.paul@codesourcery.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: mika.westerberg@iki.fi, Riku Voipio On Tuesday 05 May 2009, Riku Voipio wrote: > On Tue, May 05, 2009 at 02:53:31PM +0100, Paul Brook wrote: > > On Tuesday 05 May 2009, Riku Voipio wrote: > > > +++ b/tcg/x86_64/tcg-target.c > > > @@ -616,15 +616,15 @@ static void tcg_out_qemu_ld(TCGContext *s, const > > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* movzbl */ > > > - =C2=A0 =C2=A0 =C2=A0 =C2=A0tcg_out_modrm_offset(s, 0xb6 | P_EXT, da= ta_reg, r0, 0); > > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0tcg_out_modrm_offset(s, 0xb6 | P_EXT, da= ta_reg, r0, > > > GUEST_BASE); > > > > This breaks when GUEST_BASE is large. > > usually we don't set it to very large, just high enough to overcome > mmap_min_addr limits. I'd expect a common use would be to move a 32-bit guest to an entirely empt= y=20 range of address space. Chances are this is going to be >4G. > > 32-bit x86 is probably ok because GUEST_BASE is always a 32-bit value. > > This is not true for x86-64. Incidentally tcg_out_modrm doesn't seem to > > check this, and silently generates broken code. > > Should we rather check for a mazimum size on guest_base or revert to the > lea -based version? I expect LEA has the same bug. We definitely need to be able to handle larg= e=20 offsets on 64-bit hosts, though obviously we want to avoid the overhead whe= n=20 the offset is small. Paul