On 2015-06-17 15:42, Pavel Dovgalyuk wrote: > This patch passes TB return address into softmmu functions that are > invoked from target helpers. This allows correct PC and icount recovering > while handling MMU faults. > > Signed-off-by: Pavel Dovgalyuk <pavel.dovga...@ispras.ru> > --- > target-i386/cc_helper.c | 2 > target-i386/cpu.h | 5 > target-i386/excp_helper.c | 23 + > target-i386/fpu_helper.c | 146 +++++---- > target-i386/helper.c | 4 > target-i386/int_helper.c | 32 +- > target-i386/mem_helper.c | 39 +- > target-i386/misc_helper.c | 12 - > target-i386/ops_sse.h | 2 > target-i386/seg_helper.c | 712 > +++++++++++++++++++++++---------------------- > target-i386/svm_helper.c | 4 > target-i386/translate.c | 25 -- > 12 files changed, 506 insertions(+), 500 deletions(-)
[ snip ] > diff --git a/target-i386/excp_helper.c b/target-i386/excp_helper.c > index 99fca84..48be348 100644 > --- a/target-i386/excp_helper.c > +++ b/target-i386/excp_helper.c > @@ -108,6 +109,10 @@ static void QEMU_NORETURN raise_interrupt2(CPUX86State > *env, int intno, > env->error_code = error_code; > env->exception_is_int = is_int; > env->exception_next_eip = env->eip + next_eip_addend; > + if (retaddr) { > + /* now we have a real cpu fault */ > + cpu_restore_state(cs, retaddr); > + } > cpu_loop_exit(cs); > } If we have to add this pattern to all targets, it's probably better to add a cpu_loop_exit function which takes a return address in argument to the core code. This also has the advantage that we know that all code has been converted once cpu_loop_exit can be removed. -- Aurelien Jarno GPG: 4096R/1DDD8C9B aurel...@aurel32.net http://www.aurel32.net