target-m68k: add linkl

Backports commit c630e436c0ed3adc3a858c328119daf6d1b3357f from qemu
This commit is contained in:
Laurent Vivier 2018-02-28 00:31:25 -05:00 committed by Lioncash
parent 59d6a1a744
commit 56882899be
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -1763,22 +1763,37 @@ DISAS_INSN(mull)
gen_logic_cc(s, dest, OS_LONG);
}
DISAS_INSN(link)
static void gen_link(DisasContext *s, uint16_t insn, int32_t offset)
{
TCGContext *tcg_ctx = s->uc->tcg_ctx;
int16_t offset;
TCGv reg;
TCGv tmp;
offset = cpu_ldsw_code(env, s->pc);
s->pc += 2;
reg = AREG(insn, 0);
tmp = tcg_temp_new(tcg_ctx);
tcg_gen_subi_i32(tcg_ctx, tmp, QREG_SP, 4);
gen_store(s, OS_LONG, tmp, reg);
if ((insn & 7) != 7)
if ((insn & 7) != 7) {
tcg_gen_mov_i32(tcg_ctx, reg, tmp);
}
tcg_gen_addi_i32(tcg_ctx, QREG_SP, tmp, offset);
tcg_temp_free(tcg_ctx, tmp);
}
DISAS_INSN(link)
{
int16_t offset;
offset = read_im16(env, s);
gen_link(s, insn, offset);
}
DISAS_INSN(linkl)
{
int32_t offset;
offset = read_im32(env, s);
gen_link(s, insn, offset);
}
DISAS_INSN(unlk)
@ -3136,6 +3151,7 @@ void register_m68k_insns (CPUM68KState *env)
INSN(not, 4600, ff00, M68000);
INSN(undef, 46c0, ffc0, M68000);
INSN(move_to_sr, 46c0, ffc0, CF_ISA_A);
INSN(linkl, 4808, fff8, M68000);
BASE(pea, 4840, ffc0);
BASE(swap, 4840, fff8);
INSN(bkpt, 4848, fff8, BKPT);