aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--target-i386/op.c5
-rw-r--r--target-i386/ops_template.h8
-rw-r--r--target-i386/translate.c2
3 files changed, 9 insertions, 6 deletions
diff --git a/target-i386/op.c b/target-i386/op.c
index 933595da65..fed0fca93c 100644
--- a/target-i386/op.c
+++ b/target-i386/op.c
@@ -1366,6 +1366,11 @@ void OPPROTO op_set_cc_op(void)
CC_OP = PARAM1;
}
+void OPPROTO op_mov_T0_cc(void)
+{
+ T0 = cc_table[CC_OP].compute_all();
+}
+
/* XXX: clear VIF/VIP in all ops ? */
void OPPROTO op_movl_eflags_T0(void)
diff --git a/target-i386/ops_template.h b/target-i386/ops_template.h
index 35d5b54121..373b77a245 100644
--- a/target-i386/ops_template.h
+++ b/target-i386/ops_template.h
@@ -339,18 +339,14 @@ void OPPROTO glue(op_jle_sub, SUFFIX)(void)
void OPPROTO glue(op_loopnz, SUFFIX)(void)
{
- int eflags;
- eflags = cc_table[CC_OP].compute_all();
- if ((DATA_TYPE)ECX != 0 && !(eflags & CC_Z))
+ if ((DATA_TYPE)ECX != 0 && !(T0 & CC_Z))
GOTO_LABEL_PARAM(1);
FORCE_RET();
}
void OPPROTO glue(op_loopz, SUFFIX)(void)
{
- int eflags;
- eflags = cc_table[CC_OP].compute_all();
- if ((DATA_TYPE)ECX != 0 && (eflags & CC_Z))
+ if ((DATA_TYPE)ECX != 0 && (T0 & CC_Z))
GOTO_LABEL_PARAM(1);
FORCE_RET();
}
diff --git a/target-i386/translate.c b/target-i386/translate.c
index a3005d8d53..093723944c 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -5271,6 +5271,8 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
gen_op_jz_ecx[s->aflag](l1);
} else {
gen_op_dec_ECX[s->aflag]();
+ if (b <= 1)
+ gen_op_mov_T0_cc();
gen_op_loop[s->aflag][b](l1);
}