diff options
author | Richard Henderson <rth@twiddle.net> | 2015-09-17 15:58:10 -0700 |
---|---|---|
committer | Richard Henderson <rth@twiddle.net> | 2015-10-07 20:36:28 +1100 |
commit | b933066ae03d924a92b2616b4a24e7d91cd5b841 (patch) | |
tree | a5475afc2a27a25b4f91c8376d68daec05183e2e /target-cris | |
parent | 959082fc4a93a016a6b697e1e0c2b373d8a3a373 (diff) |
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-cris')
-rw-r--r-- | target-cris/translate.c | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/target-cris/translate.c b/target-cris/translate.c index bba7217dd8..477bddc64b 100644 --- a/target-cris/translate.c +++ b/target-cris/translate.c @@ -3030,23 +3030,6 @@ static unsigned int crisv32_decoder(CPUCRISState *env, DisasContext *dc) return insn_len; } -static void check_breakpoint(CPUCRISState *env, DisasContext *dc) -{ - CPUState *cs = CPU(cris_env_get_cpu(env)); - CPUBreakpoint *bp; - - if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) { - QTAILQ_FOREACH(bp, &cs->breakpoints, entry) { - if (bp->pc == dc->pc) { - cris_evaluate_flags(dc); - tcg_gen_movi_tl(env_pc, dc->pc); - t_gen_raise_exception(EXCP_DEBUG); - dc->is_jmp = DISAS_UPDATE; - } - } - } -} - #include "translate_v10.c" /* @@ -3175,8 +3158,6 @@ gen_intermediate_code_internal(CRISCPU *cpu, TranslationBlock *tb, gen_tb_start(tb); do { - check_breakpoint(env, dc); - if (search_pc) { j = tcg_op_buf_count(); if (lj < j) { @@ -3196,6 +3177,14 @@ gen_intermediate_code_internal(CRISCPU *cpu, TranslationBlock *tb, tcg_gen_insn_start(dc->pc); num_insns++; + if (unlikely(cpu_breakpoint_test(cs, dc->pc, BP_ANY))) { + cris_evaluate_flags(dc); + tcg_gen_movi_tl(env_pc, dc->pc); + t_gen_raise_exception(EXCP_DEBUG); + dc->is_jmp = DISAS_UPDATE; + break; + } + /* Pretty disas. */ LOG_DIS("%8.8x:\t", dc->pc); |