From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44046) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5DNo-0000Tm-Q8 for qemu-devel@nongnu.org; Wed, 17 Jun 2015 09:28:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z5DNn-0007S4-Pw for qemu-devel@nongnu.org; Wed, 17 Jun 2015 09:28:00 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:101::1]:58905) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5DNn-0007Rs-Ky for qemu-devel@nongnu.org; Wed, 17 Jun 2015 09:27:59 -0400 Date: Wed, 17 Jun 2015 15:27:58 +0200 From: Aurelien Jarno Message-ID: <20150617132758.GJ931@aurel32.net> References: <20150617124158.3316.54954.stgit@PASHA-ISP> <20150617124216.3316.15484.stgit@PASHA-ISP> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150617124216.3316.15484.stgit@PASHA-ISP> Subject: Re: [Qemu-devel] [PATCH v2 3/3] target-i386: fix memory operations in helpers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Dovgalyuk Cc: pbonzini@redhat.com, rth7680@gmail.com, leon.alrae@imgtec.com, qemu-devel@nongnu.org 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 > --- > 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 aurelien@aurel32.net http://www.aurel32.net