mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-07-10 03:47:24 +00:00
target/m68k/translate: Perform pass over code relative to qemu
Catches a few things that got lost in the backporting process.
This commit is contained in:
parent
750d56421c
commit
6e9ecb876e
|
@ -377,7 +377,6 @@ static inline uint32_t read_im32(CPUM68KState *env, DisasContext *s)
|
||||||
uint32_t im;
|
uint32_t im;
|
||||||
im = read_im16(env, s) << 16;
|
im = read_im16(env, s) << 16;
|
||||||
im |= 0xffff & read_im16(env, s);
|
im |= 0xffff & read_im16(env, s);
|
||||||
s->pc += 2;
|
|
||||||
return im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1251,8 +1250,6 @@ typedef struct {
|
||||||
TCGv v2;
|
TCGv v2;
|
||||||
} DisasCompare;
|
} DisasCompare;
|
||||||
|
|
||||||
|
|
||||||
/* This generates a conditional branch, clobbering all temporaries. */
|
|
||||||
static void gen_cc_cond(DisasCompare *c, DisasContext *s, int cond)
|
static void gen_cc_cond(DisasCompare *c, DisasContext *s, int cond)
|
||||||
{
|
{
|
||||||
TCGContext *tcg_ctx = s->uc->tcg_ctx;
|
TCGContext *tcg_ctx = s->uc->tcg_ctx;
|
||||||
|
@ -1426,6 +1423,7 @@ static void gen_cc_cond(DisasCompare *c, DisasContext *s, int cond)
|
||||||
tcond = TCG_COND_LT;
|
tcond = TCG_COND_LT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if ((cond & 1) == 0) {
|
if ((cond & 1) == 0) {
|
||||||
tcond = tcg_invert_cond(tcond);
|
tcond = tcg_invert_cond(tcond);
|
||||||
|
@ -1630,6 +1628,7 @@ DISAS_INSN(divl)
|
||||||
uint16_t ext;
|
uint16_t ext;
|
||||||
|
|
||||||
ext = read_im16(env, s);
|
ext = read_im16(env, s);
|
||||||
|
|
||||||
sign = (ext & 0x0800) != 0;
|
sign = (ext & 0x0800) != 0;
|
||||||
|
|
||||||
if (ext & 0x400) {
|
if (ext & 0x400) {
|
||||||
|
@ -1908,16 +1907,18 @@ DISAS_INSN(addsub)
|
||||||
TCGv tmp;
|
TCGv tmp;
|
||||||
TCGv addr;
|
TCGv addr;
|
||||||
int add;
|
int add;
|
||||||
|
int opsize;
|
||||||
|
|
||||||
add = (insn & 0x4000) != 0;
|
add = (insn & 0x4000) != 0;
|
||||||
reg = DREG(insn, 9);
|
opsize = insn_opsize(insn);
|
||||||
|
reg = gen_extend(s, DREG(insn, 9), opsize, 1);
|
||||||
dest = tcg_temp_new(tcg_ctx);
|
dest = tcg_temp_new(tcg_ctx);
|
||||||
if (insn & 0x100) {
|
if (insn & 0x100) {
|
||||||
SRC_EA(env, tmp, OS_LONG, 0, &addr);
|
SRC_EA(env, tmp, opsize, 1, &addr);
|
||||||
src = reg;
|
src = reg;
|
||||||
} else {
|
} else {
|
||||||
tmp = reg;
|
tmp = reg;
|
||||||
SRC_EA(env, src, OS_LONG, 0, NULL);
|
SRC_EA(env, src, opsize, 1, NULL);
|
||||||
}
|
}
|
||||||
if (add) {
|
if (add) {
|
||||||
tcg_gen_add_i32(tcg_ctx, dest, tmp, src);
|
tcg_gen_add_i32(tcg_ctx, dest, tmp, src);
|
||||||
|
@ -1934,9 +1935,9 @@ DISAS_INSN(addsub)
|
||||||
} else {
|
} else {
|
||||||
tcg_gen_mov_i32(tcg_ctx, reg, dest);
|
tcg_gen_mov_i32(tcg_ctx, reg, dest);
|
||||||
}
|
}
|
||||||
|
tcg_temp_free(tcg_ctx, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Reverse the order of the bits in REG. */
|
/* Reverse the order of the bits in REG. */
|
||||||
DISAS_INSN(bitrev)
|
DISAS_INSN(bitrev)
|
||||||
{
|
{
|
||||||
|
@ -1962,8 +1963,8 @@ DISAS_INSN(bitop_reg)
|
||||||
else
|
else
|
||||||
opsize = OS_LONG;
|
opsize = OS_LONG;
|
||||||
op = (insn >> 6) & 3;
|
op = (insn >> 6) & 3;
|
||||||
|
|
||||||
SRC_EA(env, src1, opsize, 0, op ? &addr: NULL);
|
SRC_EA(env, src1, opsize, 0, op ? &addr: NULL);
|
||||||
|
|
||||||
gen_flush_flags(s);
|
gen_flush_flags(s);
|
||||||
src2 = tcg_temp_new(tcg_ctx);
|
src2 = tcg_temp_new(tcg_ctx);
|
||||||
if (opsize == OS_BYTE)
|
if (opsize == OS_BYTE)
|
||||||
|
@ -2051,6 +2052,7 @@ DISAS_INSN(movem)
|
||||||
do_addr_fault:
|
do_addr_fault:
|
||||||
gen_addr_fault(s);
|
gen_addr_fault(s);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case 2: /* indirect */
|
case 2: /* indirect */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2258,6 +2260,19 @@ static TCGv gen_get_ccr(DisasContext *s)
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static TCGv gen_get_sr(DisasContext *s)
|
||||||
|
{
|
||||||
|
TCGContext *tcg_ctx = s->uc->tcg_ctx;
|
||||||
|
TCGv ccr;
|
||||||
|
TCGv sr;
|
||||||
|
|
||||||
|
ccr = gen_get_ccr(s);
|
||||||
|
sr = tcg_temp_new(tcg_ctx);
|
||||||
|
tcg_gen_andi_i32(tcg_ctx, sr, tcg_ctx->QREG_SR, 0xffe0);
|
||||||
|
tcg_gen_or_i32(tcg_ctx, sr, sr, ccr);
|
||||||
|
return sr;
|
||||||
|
}
|
||||||
|
|
||||||
static void gen_set_sr_im(DisasContext *s, uint16_t val, int ccr_only)
|
static void gen_set_sr_im(DisasContext *s, uint16_t val, int ccr_only)
|
||||||
{
|
{
|
||||||
TCGContext *tcg_ctx = s->uc->tcg_ctx;
|
TCGContext *tcg_ctx = s->uc->tcg_ctx;
|
||||||
|
@ -2303,19 +2318,6 @@ static void gen_move_to_sr(CPUM68KState *env, DisasContext *s, uint16_t insn,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static TCGv gen_get_sr(DisasContext *s)
|
|
||||||
{
|
|
||||||
TCGContext *tcg_ctx = s->uc->tcg_ctx;
|
|
||||||
TCGv ccr;
|
|
||||||
TCGv sr;
|
|
||||||
|
|
||||||
ccr = gen_get_ccr(s);
|
|
||||||
sr = tcg_temp_new(tcg_ctx);
|
|
||||||
tcg_gen_andi_i32(tcg_ctx, sr, tcg_ctx->QREG_SR, 0xffe0);
|
|
||||||
tcg_gen_or_i32(tcg_ctx, sr, sr, ccr);
|
|
||||||
return sr;
|
|
||||||
}
|
|
||||||
|
|
||||||
DISAS_INSN(arith_im)
|
DISAS_INSN(arith_im)
|
||||||
{
|
{
|
||||||
TCGContext *tcg_ctx = s->uc->tcg_ctx;
|
TCGContext *tcg_ctx = s->uc->tcg_ctx;
|
||||||
|
@ -6085,15 +6087,12 @@ void register_m68k_insns (CPUM68KState *env)
|
||||||
INSN(rtd, 4e74, ffff, RTD);
|
INSN(rtd, 4e74, ffff, RTD);
|
||||||
BASE(rts, 4e75, ffff);
|
BASE(rts, 4e75, ffff);
|
||||||
BASE(jump, 4e80, ffc0);
|
BASE(jump, 4e80, ffc0);
|
||||||
INSN(jump, 4ec0, ffc0, CF_ISA_A);
|
BASE(jump, 4ec0, ffc0);
|
||||||
INSN(addsubq, 5180, f1c0, CF_ISA_A);
|
|
||||||
INSN(jump, 4ec0, ffc0, M68000);
|
|
||||||
INSN(addsubq, 5000, f080, M68000);
|
INSN(addsubq, 5000, f080, M68000);
|
||||||
INSN(addsubq, 5080, f0c0, M68000);
|
BASE(addsubq, 5080, f0c0);
|
||||||
INSN(scc, 50c0, f0f8, CF_ISA_A); /* Scc.B Dx */
|
INSN(scc, 50c0, f0f8, CF_ISA_A); /* Scc.B Dx */
|
||||||
INSN(scc, 50c0, f0c0, M68000); /* Scc.B <EA> */
|
INSN(scc, 50c0, f0c0, M68000); /* Scc.B <EA> */
|
||||||
INSN(dbcc, 50c8, f0f8, M68000);
|
INSN(dbcc, 50c8, f0f8, M68000);
|
||||||
INSN(addsubq, 5080, f1c0, CF_ISA_A);
|
|
||||||
INSN(tpf, 51f8, fff8, CF_ISA_A);
|
INSN(tpf, 51f8, fff8, CF_ISA_A);
|
||||||
|
|
||||||
/* Branch instructions. */
|
/* Branch instructions. */
|
||||||
|
|
Loading…
Reference in a new issue