On Mon, May 16, 2011 at 05:37:03PM +0100, Peter Maydell wrote: > On 16 May 2011 17:10, Paul Brook <p...@codesourcery.com> 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 aurel...@aurel32.net http://www.aurel32.net