Skip to content

Commit 24f898f

Browse files
committed
Fix #1869
1 parent 8a1c8da commit 24f898f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

qemu/target/i386/translate.c

+6-5
Original file line numberDiff line numberDiff line change
@@ -1490,12 +1490,13 @@ static void gen_op(DisasContext *s1, int op, MemOp ot, int d)
14901490
TCGContext *tcg_ctx = s1->uc->tcg_ctx;
14911491
uc_engine *uc = s1->uc;
14921492

1493+
/* Invalid lock prefix when destination is not memory or OP_CMPL. */
1494+
if ((d != OR_TMP0 || op == OP_CMPL) && s1->prefix & PREFIX_LOCK){
1495+
gen_illegal_opcode(s1);
1496+
return;
1497+
}
1498+
14931499
if (d != OR_TMP0) {
1494-
if (s1->prefix & PREFIX_LOCK) {
1495-
/* Lock prefix when destination is not memory. */
1496-
gen_illegal_opcode(s1);
1497-
return;
1498-
}
14991500
gen_op_mov_v_reg(s1, ot, s1->T0, d);
15001501
} else if (!(s1->prefix & PREFIX_LOCK)) {
15011502
gen_op_ld_v(s1, ot, s1->T0, s1->A0);

0 commit comments

Comments
 (0)