target/i386: [tcg] Port to breakpoint_check

Incrementally paves the way towards using the generic instruction translation
loop.

Backports commit e6b41ec37f0a9742374dfdb90e662745969cd7ea from qemu
This commit is contained in:
Lluís Vilanova 2018-03-04 17:18:39 -05:00 committed by Lioncash
parent e3ea2c0393
commit 5f020bdf07
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -9307,17 +9307,21 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
num_insns++; num_insns++;
/* If RF is set, suppress an internally generated breakpoint. */ /* If RF is set, suppress an internally generated breakpoint. */
if (unlikely(cpu_breakpoint_test(cs, dc->base.pc_next, if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) {
tb->flags & HF_RF_MASK CPUBreakpoint *bp;
? BP_GDB : BP_ANY))) { QTAILQ_FOREACH(bp, &cs->breakpoints, entry) {
gen_debug(dc, dc->base.pc_next - dc->cs_base); if (bp->pc == dc->base.pc_next) {
/* The address covered by the breakpoint must be included in if (i386_tr_breakpoint_check(&dc->base, cs, bp)) {
[tb->pc, tb->pc + tb->size) in order to for it to be break;
properly cleared -- thus we increment the PC here so that
the logic setting tb->size below does the right thing. */
dc->base.pc_next += 1;
goto done_generating;
} }
}
}
if (dc->base.is_jmp == DISAS_NORETURN) {
break;
}
}
// Unicorn: commented out // Unicorn: commented out
//if (num_insns == max_insns && (tb->cflags & CF_LAST_IO)) { //if (num_insns == max_insns && (tb->cflags & CF_LAST_IO)) {
// gen_io_start(); // gen_io_start();
@ -9366,8 +9370,11 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
break; break;
} }
} }
//if (tb->cflags & CF_LAST_IO)
//if (tb->cflags & CF_LAST_IO) {
// gen_io_end(); // gen_io_end();
//}
// Unicorn: Left in for unicorn.
done_generating: done_generating:
gen_tb_end(tcg_ctx, tb, num_insns); gen_tb_end(tcg_ctx, tb, num_insns);