From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39224) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZC3YB-0006qO-82 for qemu-devel@nongnu.org; Mon, 06 Jul 2015 06:23:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZC3Y9-00052N-MX for qemu-devel@nongnu.org; Mon, 06 Jul 2015 06:22:59 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:47605) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZC3Y9-00051c-HA for qemu-devel@nongnu.org; Mon, 06 Jul 2015 06:22:57 -0400 Date: Mon, 6 Jul 2015 12:22:56 +0200 From: Aurelien Jarno Message-ID: <20150706102256.GA22489@aurel32.net> References: <20150706082535.11980.88013.stgit@PASHA-ISP> <20150706082548.11980.70826.stgit@PASHA-ISP> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150706082548.11980.70826.stgit@PASHA-ISP> Subject: Re: [Qemu-devel] [PATCH v5 02/11] cpu-exec: introduce loop exit with restore function 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, agraf@suse.de On 2015-07-06 11:25, Pavel Dovgalyuk wrote: > This patch introduces loop exit function, which also > restores guest CPU state according to the value of host > program counter. > > Reviewed-by: Richard Henderson > Reviewed-by: Aurelien Jarno > > Signed-off-by: Pavel Dovgalyuk > --- > cpu-exec.c | 9 +++++++++ > include/exec/exec-all.h | 1 + > 2 files changed, 10 insertions(+), 0 deletions(-) > > diff --git a/cpu-exec.c b/cpu-exec.c > index 0734af2..0b5449e 100644 > --- a/cpu-exec.c > +++ b/cpu-exec.c > @@ -134,6 +134,15 @@ void cpu_loop_exit(CPUState *cpu) > siglongjmp(cpu->jmp_env, 1); > } > > +void cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc) > +{ > + if (pc) { > + cpu_restore_state(cpu, pc); > + } > + cpu->current_tb = NULL; > + siglongjmp(cpu->jmp_env, 1); > +} > + > /* exit the current TB from a signal handler. The host registers are > restored in a state compatible with the CPU emulator > */ > diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h > index 682cb07..6a0ccb6 100644 > --- a/include/exec/exec-all.h > +++ b/include/exec/exec-all.h > @@ -90,6 +90,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, > int cflags); > void cpu_exec_init(CPUArchState *env); > void QEMU_NORETURN cpu_loop_exit(CPUState *cpu); > +void QEMU_NORETURN cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc); > > #if !defined(CONFIG_USER_ONLY) > //bool qemu_in_vcpu_thread(void); Note that this line is not commented in QEMU master, so your patch doesn't apply cleanly. -- Aurelien Jarno GPG: 4096R/1DDD8C9B aurelien@aurel32.net http://www.aurel32.net