diff options
author | Richard Henderson | 2015-09-18 00:58:10 +0200 |
---|---|---|
committer | Richard Henderson | 2015-10-07 11:36:28 +0200 |
commit | b933066ae03d924a92b2616b4a24e7d91cd5b841 (patch) | |
tree | a5475afc2a27a25b4f91c8376d68daec05183e2e /target-sh4 | |
parent | target-*: Increment num_insns immediately after tcg_gen_insn_start (diff) | |
download | qemu-b933066ae03d924a92b2616b4a24e7d91cd5b841.tar.gz qemu-b933066ae03d924a92b2616b4a24e7d91cd5b841.tar.xz qemu-b933066ae03d924a92b2616b4a24e7d91cd5b841.zip |
target-*: Introduce and use cpu_breakpoint_test
Reduce the boilerplate required for each target. At the same time,
move the test for breakpoint after calling tcg_gen_insn_start.
Note that arm and aarch64 do not use cpu_breakpoint_test, but still
move the inline test down after tcg_gen_insn_start.
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'target-sh4')
-rw-r--r-- | target-sh4/translate.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/target-sh4/translate.c b/target-sh4/translate.c index e0294e7d4e..53bf9e8d2c 100644 --- a/target-sh4/translate.c +++ b/target-sh4/translate.c @@ -1824,7 +1824,6 @@ gen_intermediate_code_internal(SuperHCPU *cpu, TranslationBlock *tb, CPUSH4State *env = &cpu->env; DisasContext ctx; target_ulong pc_start; - CPUBreakpoint *bp; int i, ii; int num_insns; int max_insns; @@ -1849,17 +1848,6 @@ gen_intermediate_code_internal(SuperHCPU *cpu, TranslationBlock *tb, max_insns = CF_COUNT_MASK; gen_tb_start(tb); while (ctx.bstate == BS_NONE && !tcg_op_buf_full()) { - if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) { - QTAILQ_FOREACH(bp, &cs->breakpoints, entry) { - if (ctx.pc == bp->pc) { - /* We have hit a breakpoint - make sure PC is up-to-date */ - tcg_gen_movi_i32(cpu_pc, ctx.pc); - gen_helper_debug(cpu_env); - ctx.bstate = BS_BRANCH; - break; - } - } - } if (search_pc) { i = tcg_op_buf_count(); if (ii < i) { @@ -1875,6 +1863,14 @@ gen_intermediate_code_internal(SuperHCPU *cpu, TranslationBlock *tb, tcg_gen_insn_start(ctx.pc); num_insns++; + if (unlikely(cpu_breakpoint_test(cs, ctx.pc, BP_ANY))) { + /* We have hit a breakpoint - make sure PC is up-to-date */ + tcg_gen_movi_i32(cpu_pc, ctx.pc); + gen_helper_debug(cpu_env); + ctx.bstate = BS_BRANCH; + break; + } + if (num_insns == max_insns && (tb->cflags & CF_LAST_IO)) { gen_io_start(); } |