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-xtensa | |
parent | 959082fc4a93a016a6b697e1e0c2b373d8a3a373 (diff) | |
download | qemu-b933066ae03d924a92b2616b4a24e7d91cd5b841.zip qemu-b933066ae03d924a92b2616b4a24e7d91cd5b841.tar.gz qemu-b933066ae03d924a92b2616b4a24e7d91cd5b841.tar.bz2 |
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-xtensa')
-rw-r--r-- | target-xtensa/translate.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/target-xtensa/translate.c b/target-xtensa/translate.c index 3607e41..ea87cb5 100644 --- a/target-xtensa/translate.c +++ b/target-xtensa/translate.c @@ -2984,22 +2984,6 @@ static inline unsigned xtensa_insn_len(CPUXtensaState *env, DisasContext *dc) return xtensa_op0_insn_len(OP0); } -static void check_breakpoint(CPUXtensaState *env, DisasContext *dc) -{ - CPUState *cs = CPU(xtensa_env_get_cpu(env)); - CPUBreakpoint *bp; - - if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) { - QTAILQ_FOREACH(bp, &cs->breakpoints, entry) { - if (bp->pc == dc->pc) { - tcg_gen_movi_i32(cpu_pc, dc->pc); - gen_exception(dc, EXCP_DEBUG); - dc->is_jmp = DISAS_UPDATE; - } - } - } -} - static void gen_ibreak_check(CPUXtensaState *env, DisasContext *dc) { unsigned i; @@ -3062,8 +3046,6 @@ void gen_intermediate_code_internal(XtensaCPU *cpu, } do { - check_breakpoint(env, &dc); - if (search_pc) { j = tcg_op_buf_count(); if (lj < j) { @@ -3081,6 +3063,13 @@ void gen_intermediate_code_internal(XtensaCPU *cpu, ++dc.ccount_delta; + if (unlikely(cpu_breakpoint_test(cs, dc.pc, BP_ANY))) { + tcg_gen_movi_i32(cpu_pc, dc.pc); + gen_exception(&dc, EXCP_DEBUG); + dc.is_jmp = DISAS_UPDATE; + break; + } + if (insn_count == max_insns && (tb->cflags & CF_LAST_IO)) { gen_io_start(); } |