i386: fix read/write cr with icount option

Running Windows with icount causes a crash in instruction of write cr.
This patch fixes it.

Reading and writing cr cause an icount read because there are called
cpu_get_apic_tpr and cpu_set_apic_tpr functions. So, there is need
gen_io_start()/gen_io_end() calls.

Backports commit 5b003a40bb1ab14d0398e91f03393d3c6b9577cd from qemu
This commit is contained in:
Mihail Abakumov 2018-03-03 14:55:57 -05:00 committed by Lioncash
parent 741ff79e23
commit e1c2fac129
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -8624,14 +8624,38 @@ case 0x101:
gen_update_cc_op(s);
gen_jmp_im(s, pc_start - s->cs_base);
if (b & 2) {
// Unicorn: if'd out
#if 0
if (s->tb->cflags & CF_USE_ICOUNT) {
gen_io_start();
}
#endif
gen_op_mov_v_reg(tcg_ctx, ot, cpu_T0, rm);
gen_helper_write_crN(tcg_ctx, cpu_env, tcg_const_i32(tcg_ctx, reg),
cpu_T0);
// Unicorn: if'd out
#if 0
if (s->tb->cflags & CF_USE_ICOUNT) {
gen_io_end();
}
#endif
gen_jmp_im(s, s->pc - s->cs_base);
gen_eob(s);
} else {
// Unicorn: if'd out
#if 0
if (s->tb->cflags & CF_USE_ICOUNT) {
gen_io_start();
}
#endif
gen_helper_read_crN(tcg_ctx, cpu_T0, cpu_env, tcg_const_i32(tcg_ctx, reg));
gen_op_mov_reg_v(tcg_ctx, ot, rm, cpu_T0);
#if 0
if (s->tb->cflags & CF_USE_ICOUNT) {
gen_io_end();
}
#endif
}
break;
default: