Commit 1c3c8af1 authored by Pavel Dovgalyuk's avatar Pavel Dovgalyuk Committed by Richard Henderson
Browse files

cpu-exec: introduce loop exit with restore function



This patch introduces loop exit function, which also
restores guest CPU state according to the value of host
program counter.

Reviewed-by: default avatarAurelien Jarno <aurelien@aurel32.net>
Signed-off-by: default avatarPavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20150710095702.13280.97477.stgit@PASHA-ISP>
Signed-off-by: default avatarRichard Henderson <rth@twiddle.net>
parent b8611499
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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
 */
+1 −0
Original line number Diff line number Diff line
@@ -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);