[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v13 18/26] target/arm: [tcg] Port to breakpoint_chec
From: |
Lluís Vilanova |
Subject: |
[Qemu-devel] [PATCH v13 18/26] target/arm: [tcg] Port to breakpoint_check |
Date: |
Fri, 14 Jul 2017 12:26:14 +0300 |
User-agent: |
StGit/0.17.1-dirty |
Incrementally paves the way towards using the generic instruction translation
loop.
Signed-off-by: Lluís Vilanova <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
---
target/arm/translate.c | 53 +++++++++++++++++++++++++++++++-----------------
1 file changed, 34 insertions(+), 19 deletions(-)
diff --git a/target/arm/translate.c b/target/arm/translate.c
index b9183fc511..55bef09739 100644
--- a/target/arm/translate.c
+++ b/target/arm/translate.c
@@ -11917,6 +11917,33 @@ static void arm_tr_insn_start(DisasContextBase
*dcbase, CPUState *cpu)
#endif
}
+static bool arm_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu,
+ const CPUBreakpoint *bp)
+{
+ DisasContext *dc = container_of(dcbase, DisasContext, base);
+
+ if (bp->flags & BP_CPU) {
+ gen_set_condexec(dc);
+ gen_set_pc_im(dc, dc->pc);
+ gen_helper_check_breakpoints(cpu_env);
+ /* End the TB early; it's likely not going to be executed */
+ dc->base.is_jmp = DISAS_UPDATE;
+ } else {
+ gen_exception_internal_insn(dc, 0, EXCP_DEBUG);
+ /* The address covered by the breakpoint must be
+ included in [tb->pc, tb->pc + tb->size) in order
+ to for it to be properly cleared -- thus we
+ increment the PC here so that the logic setting
+ tb->size below does the right thing. */
+ /* TODO: Advance PC by correct instruction length to
+ * avoid disassembler error messages */
+ dc->pc += 2;
+ dc->base.is_jmp = DISAS_NORETURN;
+ }
+
+ return true;
+}
+
/* generate intermediate code for basic block 'tb'. */
void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
{
@@ -11965,28 +11992,16 @@ void gen_intermediate_code(CPUState *cs,
TranslationBlock *tb)
if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) {
CPUBreakpoint *bp;
QTAILQ_FOREACH(bp, &cs->breakpoints, entry) {
- if (bp->pc == dc->pc) {
- if (bp->flags & BP_CPU) {
- gen_set_condexec(dc);
- gen_set_pc_im(dc, dc->pc);
- gen_helper_check_breakpoints(cpu_env);
- /* End the TB early; it's likely not going to be
executed */
- dc->base.is_jmp = DISAS_UPDATE;
- } else {
- gen_exception_internal_insn(dc, 0, EXCP_DEBUG);
- /* The address covered by the breakpoint must be
- included in [tb->pc, tb->pc + tb->size) in order
- to for it to be properly cleared -- thus we
- increment the PC here so that the logic setting
- tb->size below does the right thing. */
- /* TODO: Advance PC by correct instruction length to
- * avoid disassembler error messages */
- dc->pc += 2;
- goto done_generating;
+ if (bp->pc == dc->base.pc_next) {
+ if (arm_tr_breakpoint_check(&dc->base, cs, bp)) {
+ break;
}
- break;
}
}
+
+ if (dc->base.is_jmp == DISAS_NORETURN) {
+ break;
+ }
}
if (dc->base.num_insns == max_insns && (tb->cflags & CF_LAST_IO)) {
- [Qemu-devel] [PATCH v13 08/26] target/i386: [tcg] Port to translate_insn, (continued)
- [Qemu-devel] [PATCH v13 08/26] target/i386: [tcg] Port to translate_insn, Lluís Vilanova, 2017/07/14
- [Qemu-devel] [PATCH v13 09/26] target/i386: [tcg] Port to tb_stop, Lluís Vilanova, 2017/07/14
- [Qemu-devel] [PATCH v13 10/26] target/i386: [tcg] Port to disas_log, Lluís Vilanova, 2017/07/14
- [Qemu-devel] [PATCH v13 11/26] target/i386: [tcg] Port to generic translation framework, Lluís Vilanova, 2017/07/14
- [Qemu-devel] [PATCH v13 12/26] target/arm: [tcg] Port to DisasContextBase, Lluís Vilanova, 2017/07/14
- [Qemu-devel] [PATCH v13 13/26] target/arm: [tcg] Port to init_disas_context, Lluís Vilanova, 2017/07/14
- [Qemu-devel] [PATCH v13 14/26] target/arm: [tcg, a64] Port to init_disas_context, Lluís Vilanova, 2017/07/14
- [Qemu-devel] [PATCH v13 15/26] target/arm: [tcg] Port to tb_start, Lluís Vilanova, 2017/07/14
- [Qemu-devel] [PATCH v13 16/26] target/arm: [tcg] Port to insn_start, Lluís Vilanova, 2017/07/14
- [Qemu-devel] [PATCH v13 17/26] target/arm: [tcg, a64] Port to insn_start, Lluís Vilanova, 2017/07/14
- [Qemu-devel] [PATCH v13 18/26] target/arm: [tcg] Port to breakpoint_check,
Lluís Vilanova <=
- Re: [Qemu-devel] [PATCH v13 18/26] target/arm: [tcg] Port to breakpoint_check, Lluís Vilanova, 2017/07/15
[Qemu-devel] [PATCH v13 19/26] target/arm: [tcg, a64] Port to breakpoint_check, Lluís Vilanova, 2017/07/14
[Qemu-devel] [PATCH v13 20/26] target/arm: [tcg] Port to translate_insn, Lluís Vilanova, 2017/07/14
[Qemu-devel] [PATCH v13 21/26] target/arm: [tcg, a64] Port to translate_insn, Lluís Vilanova, 2017/07/14
[Qemu-devel] [PATCH v13 22/26] target/arm: [tcg] Port to tb_stop, Lluís Vilanova, 2017/07/14