From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kfgph-0006ud-QA for qemu-devel@nongnu.org; Tue, 16 Sep 2008 16:07:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kfgpg-0006uJ-9G for qemu-devel@nongnu.org; Tue, 16 Sep 2008 16:07:33 -0400 Received: from [199.232.76.173] (port=51398 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kfgpg-0006uF-27 for qemu-devel@nongnu.org; Tue, 16 Sep 2008 16:07:32 -0400 Received: from bart.se.axis.com ([195.60.68.10]:41840) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Kfgpf-0000uQ-0B for qemu-devel@nongnu.org; Tue, 16 Sep 2008 16:07:31 -0400 Received: from bart.se.axis.com (bart.se.axis.com [127.0.0.1]) by bart.se.axis.com (Postfix) with ESMTP id 30376640F6 for ; Tue, 16 Sep 2008 22:07:27 +0200 (CEST) Received: from axis.com (edgar.se.axis.com [10.93.151.1]) by bart.se.axis.com (Postfix) with ESMTP id 17C86640DC for ; Tue, 16 Sep 2008 22:07:27 +0200 (CEST) Date: Tue, 16 Sep 2008 22:07:27 +0200 From: "Edgar E. Iglesias" Subject: Re: [Qemu-devel] env fields as TCG variables Message-ID: <20080916200727.GC3992@edgar.se.axis.com> References: <20080916191112.GA3992@edgar.se.axis.com> <20080916194156.GB3992@edgar.se.axis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080916194156.GB3992@edgar.se.axis.com> 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 Cc: Blue Swirl , "Edgar E. Iglesias" On Tue, Sep 16, 2008 at 09:41:56PM +0200, Edgar E. Iglesias wrote: > On Tue, Sep 16, 2008 at 10:31:01PM +0300, Blue Swirl wrote: > > On 9/16/08, Edgar E. Iglesias wrote: > > > On Tue, Sep 16, 2008 at 09:37:41PM +0300, Blue Swirl wrote: > > > > I wonder if the following bug scenario is possible. > > > > > > > > Some of the env fields are accessible as TCG variables, like cpu_fsr > > > > for Sparc floating point status register (%fsr), stored in the env > > > > structure field env->fsr. When cpu_fsr is used in the generated code, > > > > a host CPU register is allocated for this task. But env->fsr can be > > > > modified directly in op_helper.c code. Isn't it then possible that the > > > > register (which stores cpu_fsr) and the structure field in memory > > > > (env->fsr) get out of sync? > > > > > > > > If this is true, no code outside the generated code should ever modify > > > > or even read env fields that are also available as TCG variables. Or > > > > do I miss something? > > > > > > > > > Hello, > > > > > > IIRC: > > > TCG writebacks before calling helpers. There used to be a bug with > > > qemu_ld/qemu_st like the one you described but it was fixed a long > > > time ago. I ran into that one with CRIS and avoided it for a while > > > by calling a dummy helper before load/stores. > > > > OK, this solves the main part of the problem. But what about code > > outside helpers, for example interrupt handling? > > Hi Again, Im not sure but if I understand correctly: > Interrupts are only taken between TB's and TCG writebacks globals at the end of TBs. > MMU faults work by writebacking globals before loads/stores. Sorry that was only for D faults. I faults are only taken between TB's AFAICT, so those are OK. Unless you do like CRIS and fetch across page boundaries within the same TB, but that's my bug :) Best regards