qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v4 2/5] cpu-exec: introduce loop exit with restore f


From: Pavel Dovgalyuk
Subject: [Qemu-devel] [PATCH v4 2/5] cpu-exec: introduce loop exit with restore function
Date: Mon, 29 Jun 2015 10:23:22 +0300
User-agent: StGit/0.16

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

Signed-off-by: Pavel Dovgalyuk <address@hidden>
---
 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 47169c4..18fdc17 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);
 int page_unprotect(target_ulong address, uintptr_t pc, void *puc);
 void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end,
                                    int is_cpu_write_access);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]