From: Pavel Dovgalyuk <pavel.dovga...@ispras.ru> This patch introduces loop exit function, which also restores guest CPU state according to the value of host program counter.
Reviewed-by: Aurelien Jarno <aurel...@aurel32.net> Signed-off-by: Pavel Dovgalyuk <pavel.dovga...@ispras.ru> Message-Id: <20150710095702.13280.97477.stgit@PASHA-ISP> Signed-off-by: Richard Henderson <r...@twiddle.net> --- 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