qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Subject: [Qemu-devel] [PULL 4/4] cpu-exec: introduce loop exit with restore function
Date: Fri, 11 Sep 2015 09:12:31 -0700	[thread overview]
Message-ID: <1441987951-5870-5-git-send-email-rth@twiddle.net> (raw)
In-Reply-To: <1441987951-5870-1-git-send-email-rth@twiddle.net>

From: Pavel Dovgalyuk <Pavel.Dovgaluk@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 <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>
---
 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

  parent reply	other threads:[~2015-09-11 16:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-11 16:12 [Qemu-devel] [PULL 0/4] Queued tcg related patches Richard Henderson
2015-09-11 16:12 ` [Qemu-devel] [PULL 1/4] tlb: Add "ifetch" argument to cpu_mmu_index() Richard Henderson
2015-09-11 16:12 ` [Qemu-devel] [PULL 2/4] softmmu: add helper function to pass through retaddr Richard Henderson
2015-09-11 16:12 ` [Qemu-devel] [PULL 3/4] softmmu: remove now unused functions Richard Henderson
2015-09-11 16:12 ` Richard Henderson [this message]
2015-09-14  9:38 ` [Qemu-devel] [PULL 0/4] Queued tcg related patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1441987951-5870-5-git-send-email-rth@twiddle.net \
    --to=rth@twiddle.net \
    --cc=pavel.dovgaluk@ispras.ru \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).