Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lj89f-0006po-Az for qemu-devel@nongnu.org; Mon, 16 Mar 2009 04:26:39 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lj89d-0006pM-JN for qemu-devel@nongnu.org; Mon, 16 Mar 2009 04:26:37 -0400 Received: from [199.232.76.173] (port=60238 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lj89d-0006pJ-EP for qemu-devel@nongnu.org; Mon, 16 Mar 2009 04:26:37 -0400 Received: from hall.aurel32.net ([88.191.82.174]:39662) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Lj89d-0000DA-4I for qemu-devel@nongnu.org; Mon, 16 Mar 2009 04:26:37 -0400 Received: from aurel32 by hall.aurel32.net with local (Exim 4.69) (envelope-from ) id 1Lj89X-0006VF-H5 for qemu-devel@nongnu.org; Mon, 16 Mar 2009 09:26:31 +0100 Date: Mon, 16 Mar 2009 09:26:31 +0100 From: Aurelien Jarno Subject: Re: [Qemu-devel] TCG/GCC breakage Message-ID: <20090316082631.GS10898@hall.aurel32.net> References: <5d6222a80903102040reef9775s8aaf9975e7594133@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <5d6222a80903102040reef9775s8aaf9975e7594133@mail.gmail.com> Sender: Aurelien Jarno Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Wed, Mar 11, 2009 at 12:40:20AM -0300, Glauber Costa wrote: > I'm seeing a strange behaviour here using qemu-system-x86_64 > (kvm not even compiled in) on an i386 host > > I'm suspecting gcc is doing something nasty in here, but I'll open it > up here to see if any > of you have any suggestion. > > I get segfaults very early in execution, and after some investigation, > I figured out that > ebp register is corrupted. I can't determine where the corruption starts. > > I then did rm x86-64-softmmu/op_helper.o; make CC=gcc34, so only this > file get compiled > by an older gcc, and it worked again. > > So it seems to me gcc may be generating gibberish somewhere in > helpers, but since > this code is a bit fragile, it might well be some mistake on our part. > > Ideas on how to attack it ? > I have been able to find time to look a bit more closer at this issue. I confirm that I am able to reproduce it with GCC 4.4, and that the %ebp register is corrupted after a call to some helpers. However, contrary to what I expected, it doesn't crash on call to helpers from TCG code, but rather on call of helper from cpu-exec.c. One of them is helper_cc_compute_all(). A diff on the assembly code between GCC 4.3 and 4.4 shows that %ebp is now used to access values in static tables, but is then never restored. It looks like that GCC is being mistaken by the fact that %ebp is used as the env register and consider that this register does not have to be saved and restored. That's why I really think it is a GCC 4.4 issue, and not a QEMU one. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net