aboutsummaryrefslogtreecommitdiff
path: root/cpu-exec.c
diff options
context:
space:
mode:
authorPavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>2015-07-10 12:57:02 +0300
committerRichard Henderson <rth@twiddle.net>2015-09-11 08:16:16 -0700
commit1c3c8af1fb40a481c07749e0448644d9b7700415 (patch)
tree019e1bdaf24566d3160c1701d2a2d4d6e08ccad7 /cpu-exec.c
parentb8611499b940b1b4db67aa985e3a844437bcbf00 (diff)
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: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru> Message-Id: <20150710095702.13280.97477.stgit@PASHA-ISP> Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'cpu-exec.c')
-rw-r--r--cpu-exec.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/cpu-exec.c b/cpu-exec.c
index 713540fc8f..6b6942de69 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
*/