From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33994) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaQwp-0004LS-7w for qemu-devel@nongnu.org; Fri, 11 Sep 2015 12:13:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZaQwo-0007pr-Af for qemu-devel@nongnu.org; Fri, 11 Sep 2015 12:13:11 -0400 Received: from mail-qk0-x22c.google.com ([2607:f8b0:400d:c09::22c]:33669) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaQwo-0007pn-4U for qemu-devel@nongnu.org; Fri, 11 Sep 2015 12:13:10 -0400 Received: by qkdw123 with SMTP id w123so33836038qkd.0 for ; Fri, 11 Sep 2015 09:13:09 -0700 (PDT) Sender: Richard Henderson From: Richard Henderson Date: Fri, 11 Sep 2015 09:12:31 -0700 Message-Id: <1441987951-5870-5-git-send-email-rth@twiddle.net> In-Reply-To: <1441987951-5870-1-git-send-email-rth@twiddle.net> References: <1441987951-5870-1-git-send-email-rth@twiddle.net> Subject: [Qemu-devel] [PULL 4/4] cpu-exec: introduce loop exit with restore function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Pavel Dovgalyuk From: Pavel Dovgalyuk This patch introduces loop exit function, which also restores guest CPU state according to the value of host program counter. Reviewed-by: Aurelien Jarno Signed-off-by: Pavel Dovgalyuk Message-Id: <20150710095702.13280.97477.stgit@PASHA-ISP> Signed-off-by: Richard Henderson --- cpu-exec.c | 9 +++++++++ include/exec/exec-all.h | 1 + 2 files changed, 10 insertions(+) diff --git a/cpu-exec.c b/cpu-exec.c index 713540f..6b6942d 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 83b9251..b5fadf7 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(CPUState *cpu, Error **errp); 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); -- 2.4.3