aboutsummaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorMihail Abakumov <mikhail.abakumov@ispras.ru>2017-05-19 12:36:15 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2017-06-07 18:22:02 +0200
commit5b003a40bb1ab14d0398e91f03393d3c6b9577cd (patch)
treee823d36ee2bfd4dc9d9769409eabdaaaba42909a /target
parentf8c45c6550b9ff1e1f0b92709ff3213a79870879 (diff)
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. Signed-off-by: Mihail Abakumov <mikhail.abakumov@ispras.ru> Message-Id: <ffb376034ff184f2fcbe93d5317d9e76@ispras.ru> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target')
-rw-r--r--target/i386/translate.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/target/i386/translate.c b/target/i386/translate.c
index 674ec96d5a..ed3b896db4 100644
--- a/target/i386/translate.c
+++ b/target/i386/translate.c
@@ -7939,14 +7939,26 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s,
gen_update_cc_op(s);
gen_jmp_im(pc_start - s->cs_base);
if (b & 2) {
+ if (s->tb->cflags & CF_USE_ICOUNT) {
+ gen_io_start();
+ }
gen_op_mov_v_reg(ot, cpu_T0, rm);
gen_helper_write_crN(cpu_env, tcg_const_i32(reg),
cpu_T0);
+ if (s->tb->cflags & CF_USE_ICOUNT) {
+ gen_io_end();
+ }
gen_jmp_im(s->pc - s->cs_base);
gen_eob(s);
} else {
+ if (s->tb->cflags & CF_USE_ICOUNT) {
+ gen_io_start();
+ }
gen_helper_read_crN(cpu_T0, cpu_env, tcg_const_i32(reg));
gen_op_mov_reg_v(ot, rm, cpu_T0);
+ if (s->tb->cflags & CF_USE_ICOUNT) {
+ gen_io_end();
+ }
}
break;
default: