From: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
To: qemu-devel@nongnu.org
Cc: rth7680@gmail.com, agraf@suse.de, pavel.dovgaluk@ispras.ru,
pbonzini@redhat.com, leon.alrae@imgtec.com, aurelien@aurel32.net
Subject: [Qemu-devel] [PATCH v4 2/5] cpu-exec: introduce loop exit with restore function
Date: Mon, 29 Jun 2015 10:23:22 +0300 [thread overview]
Message-ID: <20150629072322.388.31566.stgit@PASHA-ISP> (raw)
In-Reply-To: <20150629072310.388.48661.stgit@PASHA-ISP>
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 <pavel.dovgaluk@ispras.ru>
---
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);
next prev parent reply other threads:[~2015-06-29 7:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-29 7:23 [Qemu-devel] [PATCH v4 0/5] Fix exceptions handling for MIPS and i386 Pavel Dovgalyuk
2015-06-29 7:23 ` [Qemu-devel] [PATCH v4 1/5] softmmu: add helper function to pass through retaddr Pavel Dovgalyuk
2015-07-01 9:00 ` Richard Henderson
2015-07-01 16:16 ` Aurelien Jarno
2015-06-29 7:23 ` Pavel Dovgalyuk [this message]
2015-07-01 9:02 ` [Qemu-devel] [PATCH v4 2/5] cpu-exec: introduce loop exit with restore function Richard Henderson
2015-07-01 16:30 ` Aurelien Jarno
2015-06-29 7:23 ` [Qemu-devel] [PATCH v4 3/5] target-mips: improve exceptions handling Pavel Dovgalyuk
2015-07-01 16:37 ` Aurelien Jarno
2015-06-29 7:23 ` [Qemu-devel] [PATCH v4 4/5] target-i386: fix memory operations in helpers Pavel Dovgalyuk
2015-07-01 9:17 ` Richard Henderson
2015-07-01 9:22 ` Pavel Dovgaluk
2015-07-01 9:26 ` Richard Henderson
2015-06-29 7:23 ` [Qemu-devel] [PATCH v4 5/5] target-ppc: exceptions handling in icount mode Pavel Dovgalyuk
2015-06-29 7:24 ` [Qemu-devel] [PATCH v4 0/5] Fix exceptions handling for MIPS and i386 Pavel Dovgaluk
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=20150629072322.388.31566.stgit@PASHA-ISP \
--to=pavel.dovgaluk@ispras.ru \
--cc=agraf@suse.de \
--cc=aurelien@aurel32.net \
--cc=leon.alrae@imgtec.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth7680@gmail.com \
/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).