From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, "Lluís Vilanova" <vilanova@ac.upc.edu>,
"Richard Henderson" <rth@twiddle.net>
Subject: [Qemu-devel] [PULL 25/32] target/arm: [tcg,a64] Port to tb_stop
Date: Wed, 6 Sep 2017 09:06:05 -0700 [thread overview]
Message-ID: <20170906160612.22769-26-richard.henderson@linaro.org> (raw)
In-Reply-To: <20170906160612.22769-1-richard.henderson@linaro.org>
From: Lluís Vilanova <vilanova@ac.upc.edu>
Incrementally paves the way towards using the generic instruction translation
loop.
Reviewed-by: Emilio G. Cota <cota@braap.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Message-Id: <150002558503.22386.1149037590886263349.stgit@frigg.lan>
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
target/arm/translate-a64.c | 127 ++++++++++++++++++++++++---------------------
1 file changed, 67 insertions(+), 60 deletions(-)
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index f959f4469a..723e86c976 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -11327,6 +11327,72 @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
dc->base.pc_next = dc->pc;
}
+static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
+{
+ DisasContext *dc = container_of(dcbase, DisasContext, base);
+
+ if (unlikely(dc->base.singlestep_enabled || dc->ss_active)) {
+ /* Note that this means single stepping WFI doesn't halt the CPU.
+ * For conditional branch insns this is harmless unreachable code as
+ * gen_goto_tb() has already handled emitting the debug exception
+ * (and thus a tb-jump is not possible when singlestepping).
+ */
+ switch (dc->base.is_jmp) {
+ default:
+ gen_a64_set_pc_im(dc->pc);
+ /* fall through */
+ case DISAS_JUMP:
+ if (dc->base.singlestep_enabled) {
+ gen_exception_internal(EXCP_DEBUG);
+ } else {
+ gen_step_complete_exception(dc);
+ }
+ break;
+ case DISAS_NORETURN:
+ break;
+ }
+ } else {
+ switch (dc->base.is_jmp) {
+ case DISAS_NEXT:
+ case DISAS_TOO_MANY:
+ gen_goto_tb(dc, 1, dc->pc);
+ break;
+ default:
+ case DISAS_UPDATE:
+ gen_a64_set_pc_im(dc->pc);
+ /* fall through */
+ case DISAS_JUMP:
+ tcg_gen_lookup_and_goto_ptr(cpu_pc);
+ break;
+ case DISAS_EXIT:
+ tcg_gen_exit_tb(0);
+ break;
+ case DISAS_NORETURN:
+ case DISAS_SWI:
+ break;
+ case DISAS_WFE:
+ gen_a64_set_pc_im(dc->pc);
+ gen_helper_wfe(cpu_env);
+ break;
+ case DISAS_YIELD:
+ gen_a64_set_pc_im(dc->pc);
+ gen_helper_yield(cpu_env);
+ break;
+ case DISAS_WFI:
+ /* This is a special case because we don't want to just halt the CPU
+ * if trying to debug across a WFI.
+ */
+ gen_a64_set_pc_im(dc->pc);
+ gen_helper_wfi(cpu_env);
+ /* The helper doesn't necessarily throw an exception, but we
+ * must go back to the main loop to check for interrupts anyway.
+ */
+ tcg_gen_exit_tb(0);
+ break;
+ }
+ }
+}
+
void gen_intermediate_code_a64(DisasContextBase *dcbase, CPUState *cs,
TranslationBlock *tb)
{
@@ -11398,66 +11464,7 @@ void gen_intermediate_code_a64(DisasContextBase *dcbase, CPUState *cs,
gen_io_end();
}
- if (unlikely(cs->singlestep_enabled || dc->ss_active)) {
- /* Note that this means single stepping WFI doesn't halt the CPU.
- * For conditional branch insns this is harmless unreachable code as
- * gen_goto_tb() has already handled emitting the debug exception
- * (and thus a tb-jump is not possible when singlestepping).
- */
- switch (dc->base.is_jmp) {
- default:
- gen_a64_set_pc_im(dc->pc);
- /* fall through */
- case DISAS_JUMP:
- if (cs->singlestep_enabled) {
- gen_exception_internal(EXCP_DEBUG);
- } else {
- gen_step_complete_exception(dc);
- }
- break;
- case DISAS_NORETURN:
- break;
- }
- } else {
- switch (dc->base.is_jmp) {
- case DISAS_NEXT:
- case DISAS_TOO_MANY:
- gen_goto_tb(dc, 1, dc->pc);
- break;
- case DISAS_JUMP:
- tcg_gen_lookup_and_goto_ptr(cpu_pc);
- break;
- case DISAS_NORETURN:
- case DISAS_SWI:
- break;
- case DISAS_WFE:
- gen_a64_set_pc_im(dc->pc);
- gen_helper_wfe(cpu_env);
- break;
- case DISAS_YIELD:
- gen_a64_set_pc_im(dc->pc);
- gen_helper_yield(cpu_env);
- break;
- case DISAS_WFI:
- /* This is a special case because we don't want to just halt the CPU
- * if trying to debug across a WFI.
- */
- gen_a64_set_pc_im(dc->pc);
- gen_helper_wfi(cpu_env);
- /* The helper doesn't necessarily throw an exception, but we
- * must go back to the main loop to check for interrupts anyway.
- */
- tcg_gen_exit_tb(0);
- break;
- case DISAS_UPDATE:
- gen_a64_set_pc_im(dc->pc);
- /* fall through */
- case DISAS_EXIT:
- default:
- tcg_gen_exit_tb(0);
- break;
- }
- }
+ aarch64_tr_tb_stop(&dc->base, cs);
gen_tb_end(tb, dc->base.num_insns);
--
2.13.5
next prev parent reply other threads:[~2017-09-06 16:06 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-06 16:05 [Qemu-devel] [PULL 00/32] tcg generic translate loop Richard Henderson
2017-09-06 16:05 ` [Qemu-devel] [PULL 01/32] tcg: Add generic DISAS_NORETURN Richard Henderson
2017-09-06 16:05 ` [Qemu-devel] [PULL 02/32] target/i386: Use generic DISAS_* enumerators Richard Henderson
2017-09-06 16:05 ` [Qemu-devel] [PULL 03/32] target/arm: Use DISAS_NORETURN Richard Henderson
2017-09-06 16:05 ` [Qemu-devel] [PULL 04/32] target: [tcg] Use a generic enum for DISAS_ values Richard Henderson
2017-09-06 16:05 ` [Qemu-devel] [PULL 05/32] target/arm: Delay check for magic kernel page Richard Henderson
2017-09-06 16:05 ` [Qemu-devel] [PULL 06/32] tcg: Add generic translation framework Richard Henderson
2017-09-06 16:05 ` [Qemu-devel] [PULL 07/32] target/i386: [tcg] Port to DisasContextBase Richard Henderson
2017-09-06 16:05 ` [Qemu-devel] [PULL 08/32] target/i386: [tcg] Port to init_disas_context Richard Henderson
2017-09-06 16:05 ` [Qemu-devel] [PULL 09/32] target/i386: [tcg] Port to insn_start Richard Henderson
2017-09-06 16:05 ` [Qemu-devel] [PULL 10/32] target/i386: [tcg] Port to breakpoint_check Richard Henderson
2017-09-06 16:05 ` [Qemu-devel] [PULL 11/32] target/i386: [tcg] Port to translate_insn Richard Henderson
2017-09-06 16:05 ` [Qemu-devel] [PULL 12/32] target/i386: [tcg] Port to tb_stop Richard Henderson
2017-09-06 16:05 ` [Qemu-devel] [PULL 13/32] target/i386: [tcg] Port to disas_log Richard Henderson
2017-09-06 16:05 ` [Qemu-devel] [PULL 14/32] target/i386: [tcg] Port to generic translation framework Richard Henderson
2017-09-06 16:05 ` [Qemu-devel] [PULL 15/32] target/arm: [tcg] Port to DisasContextBase Richard Henderson
2017-09-06 16:05 ` [Qemu-devel] [PULL 16/32] target/arm: [tcg] Port to init_disas_context Richard Henderson
2017-09-06 16:05 ` [Qemu-devel] [PULL 17/32] target/arm: [tcg, a64] " Richard Henderson
2017-09-06 16:05 ` [Qemu-devel] [PULL 18/32] target/arm: [tcg] Port to tb_start Richard Henderson
2017-09-06 16:05 ` [Qemu-devel] [PULL 19/32] target/arm: [tcg] Port to insn_start Richard Henderson
2017-09-06 16:06 ` [Qemu-devel] [PULL 20/32] target/arm: [tcg, a64] " Richard Henderson
2017-09-06 16:06 ` [Qemu-devel] [PULL 21/32] target/arm: [tcg, a64] Port to breakpoint_check Richard Henderson
2017-09-06 16:06 ` [Qemu-devel] [PULL 22/32] target/arm: [tcg] Port to translate_insn Richard Henderson
2017-09-06 16:06 ` [Qemu-devel] [PULL 23/32] target/arm: [tcg, a64] " Richard Henderson
2017-09-06 16:06 ` [Qemu-devel] [PULL 24/32] target/arm: [tcg] Port to tb_stop Richard Henderson
2017-09-06 16:06 ` Richard Henderson [this message]
2017-09-06 16:06 ` [Qemu-devel] [PULL 26/32] target/arm: [tcg] Port to disas_log Richard Henderson
2017-09-06 16:06 ` [Qemu-devel] [PULL 27/32] target/arm: [tcg,a64] " Richard Henderson
2017-09-06 16:06 ` [Qemu-devel] [PULL 28/32] target/arm: [tcg] Port to generic translation framework Richard Henderson
2017-09-12 16:12 ` Laurent Desnogues
2017-09-12 16:37 ` Richard Henderson
2017-09-06 16:06 ` [Qemu-devel] [PULL 29/32] target/arm: [a64] Move page and ss checks to init_disas_context Richard Henderson
2017-09-06 16:06 ` [Qemu-devel] [PULL 30/32] target/arm: Move ss check " Richard Henderson
2017-09-06 16:06 ` [Qemu-devel] [PULL 31/32] target/arm: Split out thumb_tr_translate_insn Richard Henderson
2017-09-06 16:06 ` [Qemu-devel] [PULL 32/32] target/arm: Perform per-insn cross-page check only for Thumb Richard Henderson
2017-09-07 14:25 ` [Qemu-devel] [PULL 00/32] tcg generic translate loop 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=20170906160612.22769-26-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=vilanova@ac.upc.edu \
/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).