mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-22 13:41:05 +00:00
target/i386: Generate #UD for LOCK on a register increment
Fix a TCG crash due to attempting an atomic increment operation without having set up the address first. This is a similar case to that dealt with in commit e84fcd7f662a0d8198703, and we fix it in the same way. Fixes: https://bugs.launchpad.net/qemu/+bug/1807675 Backports commit 8cb2ca3d7479748587313f0b34034a3f8aa08c92 from qemu
This commit is contained in:
parent
1a50ee5826
commit
6b413ffa97
|
@ -1564,6 +1564,11 @@ static void gen_inc(DisasContext *s, TCGMemOp ot, int d, int c)
|
|||
TCGv cpu_cc_src = tcg_ctx->cpu_cc_src;
|
||||
|
||||
if (s->prefix & PREFIX_LOCK) {
|
||||
if (d != OR_TMP0) {
|
||||
/* Lock prefix when destination is not memory */
|
||||
gen_illegal_opcode(s1);
|
||||
return;
|
||||
}
|
||||
tcg_gen_movi_tl(tcg_ctx, s->T0, c > 0 ? 1 : -1);
|
||||
tcg_gen_atomic_add_fetch_tl(tcg_ctx, s->T0, s->A0, s->T0,
|
||||
s->mem_index, ot | MO_LE);
|
||||
|
|
Loading…
Reference in a new issue