From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:60875) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QM1bt-0004tr-NS for qemu-devel@nongnu.org; Mon, 16 May 2011 13:29:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QM1br-0001jm-PH for qemu-devel@nongnu.org; Mon, 16 May 2011 13:29:37 -0400 Received: from hall.aurel32.net ([88.191.126.93]:46828) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QM1br-0001h8-Kc for qemu-devel@nongnu.org; Mon, 16 May 2011 13:29:35 -0400 Date: Mon, 16 May 2011 19:29:26 +0200 From: Aurelien Jarno Message-ID: <20110516172926.GA6132@volta.aurel32.net> References: <1303401708-5419-1-git-send-email-peter.maydell@linaro.org> <20110514213247.GB13600@volta.aurel32.net> <201105161710.59650.paul@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Subject: Re: [Qemu-devel] [PATCH] target-arm: Minimal implementation of performance counters List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: patches@linaro.org, Paul Brook , qemu-devel@nongnu.org On Mon, May 16, 2011 at 05:37:03PM +0100, Peter Maydell wrote: > On 16 May 2011 17:10, Paul Brook wrote: > >> > I just spoke with Paul on IRC about this. In summary: > >> >  * for a helper to cause an exception then it has (a) to make sure CPU > >> > > >> > state (pc, condflags) is sync'd before the call to the helper and (b) > >> > the helper has to be in a file with access to global env, because it > >> > needs to call cpu_loop_exit() > >> > >> I don't think (a) is true. It is possible to use the same way as for > >> load/store operations, that is call cpu_restore_state() before calling > >> cpu_loop_exit(). > > > > To call cpu_restore_state you need to know searched_pc.  To find that you need > > to unwind the host stack all the way back to translated code. > > You can do this by calling GETPC() from the top level helper function > though, right? [OK, we'd need to move the definition out of dyngen-exec.h.] No we don't need to move it out of dyngen-exec.h. dyngen-exec.h is included in target-*/exec.h, as the softmmu helpers, which are included in target-*/op_helper.c, call cpu_restore_state(). For an actual usage of cpu_restore_state() outside of the softmmu helpers, you can have a look at target-sh4/op-helper.c, which uses this technique for raising most exceptions, and especially the FPU ones. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net