From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JrbRe-0001kN-Vp for qemu-devel@nongnu.org; Thu, 01 May 2008 12:15:43 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JrbRd-0001ju-6o for qemu-devel@nongnu.org; Thu, 01 May 2008 12:15:42 -0400 Received: from [199.232.76.173] (port=58052 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JrbRd-0001jr-07 for qemu-devel@nongnu.org; Thu, 01 May 2008 12:15:41 -0400 Received: from nf-out-0910.google.com ([64.233.182.189]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JrbRc-0004Ns-IU for qemu-devel@nongnu.org; Thu, 01 May 2008 12:15:40 -0400 Received: by nf-out-0910.google.com with SMTP id b2so428723nfb.12 for ; Thu, 01 May 2008 09:15:39 -0700 (PDT) Message-ID: Date: Thu, 1 May 2008 19:15:39 +0300 From: "Blue Swirl" Subject: Re: [Qemu-devel] Crash due to invalid env->current_tb In-Reply-To: <200805011704.43953.paul@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20080429115614.GA15524@os.inf.tu-dresden.de> <20080501120241.GC13241@os.inf.tu-dresden.de> <200805011704.43953.paul@codesourcery.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paul Brook Cc: qemu-devel@nongnu.org On 5/1/08, Paul Brook wrote: > > > T0 = gen_func(); > > > > > > > For 64bit target T0 is 64bits so "=a" does not work and "=A" is needed. > > > The strange thing is that I need to throw away the upper 32bits because > > > otherwise it won't work. gen_func is defined to return just long but T0 > > > is unsigned long long, this seems inconsistent. The 'and' does not > > > appear in 32bit targets so it does not harm there. > > > > This is because in this special case, T0 is not used as target CPU > > temporary, but instead to return next TB address. On i386 this is 32 > > bits, so only EAX is needed. TCG does not touch EDX, so it contains > > garbage. This also means that moving EDX to high word of T0 and then > > throwing the high word away may be slightly wasteful. > > > Do we need to use T0 at all here? Can't we just use a normal local variable? I suspect T0 was used to gain extra performance, but in case of 64-bit target on 32-bit host there is this unnecessary work. But does cpu-exec.c need to know about T0/T1/T2 at all? Can we replace exec.h include with cpu.h one?