x86::trans: handle illegal case for opc c6/c7

Reference Intel software developer manual vol2 Appendix A Table A-6 for
detailed decoding information.

Re-applies commit ad767abda8 from qemu
This commit is contained in:
vardyh 2018-09-07 19:27:49 -04:00 committed by Lioncash
parent 48d98a76e7
commit 8ca718367f
No known key found for this signature in database
GPG Key ID: 4E3C3CC1031BA9C7

View File

@ -6105,12 +6105,21 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
break;
case 0xc6:
case 0xc7: /* mov Ev, Iv */
// Unicorn: Altered to handle illegal opcodes
ot = mo_b_d(b, dflag);
modrm = x86_ldub_code(env, s);
mod = (modrm >> 6) & 3;
reg = ((modrm >> 3) & 7) | rex_r;
if (mod != 3) {
if (reg != 0) {
goto illegal_op;
}
s->rip_offset = insn_const_size(ot);
gen_lea_modrm(env, s, modrm);
} else {
if (reg != 0 && reg != 7) {
goto illegal_op;
}
}
val = insn_get(env, s, ot);
tcg_gen_movi_tl(tcg_ctx, cpu_T0, val);