mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-24 12:09:58 +00:00
Improved debug output for the MIPS opcode decoder.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2801 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
4759513bd9
commit
923617a396
@ -540,7 +540,7 @@ enum {
|
|||||||
BS_EXCP = 3, /* We reached an exception condition */
|
BS_EXCP = 3, /* We reached an exception condition */
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined MIPS_DEBUG_DISAS
|
#ifdef MIPS_DEBUG_DISAS
|
||||||
#define MIPS_DEBUG(fmt, args...) \
|
#define MIPS_DEBUG(fmt, args...) \
|
||||||
do { \
|
do { \
|
||||||
if (loglevel & CPU_LOG_TB_IN_ASM) { \
|
if (loglevel & CPU_LOG_TB_IN_ASM) { \
|
||||||
@ -710,7 +710,7 @@ OP_ST_TABLE(uxc1);
|
|||||||
static void gen_ldst (DisasContext *ctx, uint32_t opc, int rt,
|
static void gen_ldst (DisasContext *ctx, uint32_t opc, int rt,
|
||||||
int base, int16_t offset)
|
int base, int16_t offset)
|
||||||
{
|
{
|
||||||
const char *opn = "unk";
|
const char *opn = "ldst";
|
||||||
|
|
||||||
if (base == 0) {
|
if (base == 0) {
|
||||||
GEN_LOAD_IMM_TN(T0, offset);
|
GEN_LOAD_IMM_TN(T0, offset);
|
||||||
@ -849,7 +849,7 @@ static void gen_ldst (DisasContext *ctx, uint32_t opc, int rt,
|
|||||||
opn = "sc";
|
opn = "sc";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
MIPS_INVAL("load/store");
|
MIPS_INVAL(opn);
|
||||||
generate_exception(ctx, EXCP_RI);
|
generate_exception(ctx, EXCP_RI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -860,7 +860,7 @@ static void gen_ldst (DisasContext *ctx, uint32_t opc, int rt,
|
|||||||
static void gen_flt_ldst (DisasContext *ctx, uint32_t opc, int ft,
|
static void gen_flt_ldst (DisasContext *ctx, uint32_t opc, int ft,
|
||||||
int base, int16_t offset)
|
int base, int16_t offset)
|
||||||
{
|
{
|
||||||
const char *opn = "unk";
|
const char *opn = "flt_ldst";
|
||||||
|
|
||||||
if (base == 0) {
|
if (base == 0) {
|
||||||
GEN_LOAD_IMM_TN(T0, offset);
|
GEN_LOAD_IMM_TN(T0, offset);
|
||||||
@ -896,7 +896,7 @@ static void gen_flt_ldst (DisasContext *ctx, uint32_t opc, int ft,
|
|||||||
opn = "sdc1";
|
opn = "sdc1";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
MIPS_INVAL("float load/store");
|
MIPS_INVAL(opn);
|
||||||
generate_exception(ctx, EXCP_RI);
|
generate_exception(ctx, EXCP_RI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -908,7 +908,7 @@ static void gen_arith_imm (DisasContext *ctx, uint32_t opc, int rt,
|
|||||||
int rs, int16_t imm)
|
int rs, int16_t imm)
|
||||||
{
|
{
|
||||||
uint32_t uimm;
|
uint32_t uimm;
|
||||||
const char *opn = "unk";
|
const char *opn = "imm arith";
|
||||||
|
|
||||||
if (rt == 0 && opc != OPC_ADDI && opc != OPC_DADDI) {
|
if (rt == 0 && opc != OPC_ADDI && opc != OPC_DADDI) {
|
||||||
/* if no destination, treat it as a NOP
|
/* if no destination, treat it as a NOP
|
||||||
@ -1073,7 +1073,7 @@ static void gen_arith_imm (DisasContext *ctx, uint32_t opc, int rt,
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
MIPS_INVAL("imm arith");
|
MIPS_INVAL(opn);
|
||||||
generate_exception(ctx, EXCP_RI);
|
generate_exception(ctx, EXCP_RI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1085,7 +1085,7 @@ static void gen_arith_imm (DisasContext *ctx, uint32_t opc, int rt,
|
|||||||
static void gen_arith (DisasContext *ctx, uint32_t opc,
|
static void gen_arith (DisasContext *ctx, uint32_t opc,
|
||||||
int rd, int rs, int rt)
|
int rd, int rs, int rt)
|
||||||
{
|
{
|
||||||
const char *opn = "unk";
|
const char *opn = "arith";
|
||||||
|
|
||||||
if (rd == 0 && opc != OPC_ADD && opc != OPC_SUB
|
if (rd == 0 && opc != OPC_ADD && opc != OPC_SUB
|
||||||
&& opc != OPC_DADD && opc != OPC_DSUB) {
|
&& opc != OPC_DADD && opc != OPC_DSUB) {
|
||||||
@ -1223,7 +1223,7 @@ static void gen_arith (DisasContext *ctx, uint32_t opc,
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
MIPS_INVAL("arith");
|
MIPS_INVAL(opn);
|
||||||
generate_exception(ctx, EXCP_RI);
|
generate_exception(ctx, EXCP_RI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1235,7 +1235,7 @@ static void gen_arith (DisasContext *ctx, uint32_t opc,
|
|||||||
/* Arithmetic on HI/LO registers */
|
/* Arithmetic on HI/LO registers */
|
||||||
static void gen_HILO (DisasContext *ctx, uint32_t opc, int reg)
|
static void gen_HILO (DisasContext *ctx, uint32_t opc, int reg)
|
||||||
{
|
{
|
||||||
const char *opn = "unk";
|
const char *opn = "hilo";
|
||||||
|
|
||||||
if (reg == 0 && (opc == OPC_MFHI || opc == OPC_MFLO)) {
|
if (reg == 0 && (opc == OPC_MFHI || opc == OPC_MFLO)) {
|
||||||
/* Treat as a NOP */
|
/* Treat as a NOP */
|
||||||
@ -1264,7 +1264,7 @@ static void gen_HILO (DisasContext *ctx, uint32_t opc, int reg)
|
|||||||
opn = "mtlo";
|
opn = "mtlo";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
MIPS_INVAL("HILO");
|
MIPS_INVAL(opn);
|
||||||
generate_exception(ctx, EXCP_RI);
|
generate_exception(ctx, EXCP_RI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1274,7 +1274,7 @@ static void gen_HILO (DisasContext *ctx, uint32_t opc, int reg)
|
|||||||
static void gen_muldiv (DisasContext *ctx, uint32_t opc,
|
static void gen_muldiv (DisasContext *ctx, uint32_t opc,
|
||||||
int rs, int rt)
|
int rs, int rt)
|
||||||
{
|
{
|
||||||
const char *opn = "unk";
|
const char *opn = "mul/div";
|
||||||
|
|
||||||
GEN_LOAD_REG_TN(T0, rs);
|
GEN_LOAD_REG_TN(T0, rs);
|
||||||
GEN_LOAD_REG_TN(T1, rt);
|
GEN_LOAD_REG_TN(T1, rt);
|
||||||
@ -1330,7 +1330,7 @@ static void gen_muldiv (DisasContext *ctx, uint32_t opc,
|
|||||||
opn = "msubu";
|
opn = "msubu";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
MIPS_INVAL("mul/div");
|
MIPS_INVAL(opn);
|
||||||
generate_exception(ctx, EXCP_RI);
|
generate_exception(ctx, EXCP_RI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1340,7 +1340,7 @@ static void gen_muldiv (DisasContext *ctx, uint32_t opc,
|
|||||||
static void gen_cl (DisasContext *ctx, uint32_t opc,
|
static void gen_cl (DisasContext *ctx, uint32_t opc,
|
||||||
int rd, int rs)
|
int rd, int rs)
|
||||||
{
|
{
|
||||||
const char *opn = "unk";
|
const char *opn = "CLx";
|
||||||
if (rd == 0) {
|
if (rd == 0) {
|
||||||
/* Treat as a NOP */
|
/* Treat as a NOP */
|
||||||
MIPS_DEBUG("NOP");
|
MIPS_DEBUG("NOP");
|
||||||
@ -1367,7 +1367,7 @@ static void gen_cl (DisasContext *ctx, uint32_t opc,
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
MIPS_INVAL("CLx");
|
MIPS_INVAL(opn);
|
||||||
generate_exception(ctx, EXCP_RI);
|
generate_exception(ctx, EXCP_RI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1431,7 +1431,7 @@ static void gen_trap (DisasContext *ctx, uint32_t opc,
|
|||||||
/* Never trap: treat as NOP */
|
/* Never trap: treat as NOP */
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
MIPS_INVAL("TRAP");
|
MIPS_INVAL("trap");
|
||||||
generate_exception(ctx, EXCP_RI);
|
generate_exception(ctx, EXCP_RI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1462,7 +1462,7 @@ static void gen_trap (DisasContext *ctx, uint32_t opc,
|
|||||||
gen_op_ne();
|
gen_op_ne();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
MIPS_INVAL("TRAP");
|
MIPS_INVAL("trap");
|
||||||
generate_exception(ctx, EXCP_RI);
|
generate_exception(ctx, EXCP_RI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1499,12 +1499,13 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc,
|
|||||||
int bcond = 0;
|
int bcond = 0;
|
||||||
|
|
||||||
if (ctx->hflags & MIPS_HFLAG_BMASK) {
|
if (ctx->hflags & MIPS_HFLAG_BMASK) {
|
||||||
|
#ifdef MIPS_DEBUG_DISAS
|
||||||
if (loglevel & CPU_LOG_TB_IN_ASM) {
|
if (loglevel & CPU_LOG_TB_IN_ASM) {
|
||||||
fprintf(logfile,
|
fprintf(logfile,
|
||||||
"Branch in delay slot at PC 0x" TARGET_FMT_lx "\n",
|
"Branch in delay slot at PC 0x" TARGET_FMT_lx "\n",
|
||||||
ctx->pc);
|
ctx->pc);
|
||||||
}
|
}
|
||||||
MIPS_INVAL("branch/jump in bdelay slot");
|
#endif
|
||||||
generate_exception(ctx, EXCP_RI);
|
generate_exception(ctx, EXCP_RI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1553,6 +1554,7 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc,
|
|||||||
if (offset != 0 && offset != 16) {
|
if (offset != 0 && offset != 16) {
|
||||||
/* Hint = 0 is JR/JALR, hint 16 is JR.HB/JALR.HB, the
|
/* Hint = 0 is JR/JALR, hint 16 is JR.HB/JALR.HB, the
|
||||||
others are reserved. */
|
others are reserved. */
|
||||||
|
MIPS_INVAL("jump hint");
|
||||||
generate_exception(ctx, EXCP_RI);
|
generate_exception(ctx, EXCP_RI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1610,12 +1612,12 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc,
|
|||||||
return;
|
return;
|
||||||
case OPC_J:
|
case OPC_J:
|
||||||
ctx->hflags |= MIPS_HFLAG_B;
|
ctx->hflags |= MIPS_HFLAG_B;
|
||||||
MIPS_DEBUG("j %08x", btarget);
|
MIPS_DEBUG("j " TARGET_FMT_lx, btarget);
|
||||||
break;
|
break;
|
||||||
case OPC_JAL:
|
case OPC_JAL:
|
||||||
blink = 31;
|
blink = 31;
|
||||||
ctx->hflags |= MIPS_HFLAG_B;
|
ctx->hflags |= MIPS_HFLAG_B;
|
||||||
MIPS_DEBUG("jal %08x", btarget);
|
MIPS_DEBUG("jal " TARGET_FMT_lx, btarget);
|
||||||
break;
|
break;
|
||||||
case OPC_JR:
|
case OPC_JR:
|
||||||
ctx->hflags |= MIPS_HFLAG_BR;
|
ctx->hflags |= MIPS_HFLAG_BR;
|
||||||
@ -1635,70 +1637,70 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc,
|
|||||||
switch (opc) {
|
switch (opc) {
|
||||||
case OPC_BEQ:
|
case OPC_BEQ:
|
||||||
gen_op_eq();
|
gen_op_eq();
|
||||||
MIPS_DEBUG("beq %s, %s, %08x",
|
MIPS_DEBUG("beq %s, %s, " TARGET_FMT_lx,
|
||||||
regnames[rs], regnames[rt], btarget);
|
regnames[rs], regnames[rt], btarget);
|
||||||
goto not_likely;
|
goto not_likely;
|
||||||
case OPC_BEQL:
|
case OPC_BEQL:
|
||||||
gen_op_eq();
|
gen_op_eq();
|
||||||
MIPS_DEBUG("beql %s, %s, %08x",
|
MIPS_DEBUG("beql %s, %s, " TARGET_FMT_lx,
|
||||||
regnames[rs], regnames[rt], btarget);
|
regnames[rs], regnames[rt], btarget);
|
||||||
goto likely;
|
goto likely;
|
||||||
case OPC_BNE:
|
case OPC_BNE:
|
||||||
gen_op_ne();
|
gen_op_ne();
|
||||||
MIPS_DEBUG("bne %s, %s, %08x",
|
MIPS_DEBUG("bne %s, %s, " TARGET_FMT_lx,
|
||||||
regnames[rs], regnames[rt], btarget);
|
regnames[rs], regnames[rt], btarget);
|
||||||
goto not_likely;
|
goto not_likely;
|
||||||
case OPC_BNEL:
|
case OPC_BNEL:
|
||||||
gen_op_ne();
|
gen_op_ne();
|
||||||
MIPS_DEBUG("bnel %s, %s, %08x",
|
MIPS_DEBUG("bnel %s, %s, " TARGET_FMT_lx,
|
||||||
regnames[rs], regnames[rt], btarget);
|
regnames[rs], regnames[rt], btarget);
|
||||||
goto likely;
|
goto likely;
|
||||||
case OPC_BGEZ:
|
case OPC_BGEZ:
|
||||||
gen_op_gez();
|
gen_op_gez();
|
||||||
MIPS_DEBUG("bgez %s, %08x", regnames[rs], btarget);
|
MIPS_DEBUG("bgez %s, " TARGET_FMT_lx, regnames[rs], btarget);
|
||||||
goto not_likely;
|
goto not_likely;
|
||||||
case OPC_BGEZL:
|
case OPC_BGEZL:
|
||||||
gen_op_gez();
|
gen_op_gez();
|
||||||
MIPS_DEBUG("bgezl %s, %08x", regnames[rs], btarget);
|
MIPS_DEBUG("bgezl %s, " TARGET_FMT_lx, regnames[rs], btarget);
|
||||||
goto likely;
|
goto likely;
|
||||||
case OPC_BGEZAL:
|
case OPC_BGEZAL:
|
||||||
gen_op_gez();
|
gen_op_gez();
|
||||||
MIPS_DEBUG("bgezal %s, %08x", regnames[rs], btarget);
|
MIPS_DEBUG("bgezal %s, " TARGET_FMT_lx, regnames[rs], btarget);
|
||||||
blink = 31;
|
blink = 31;
|
||||||
goto not_likely;
|
goto not_likely;
|
||||||
case OPC_BGEZALL:
|
case OPC_BGEZALL:
|
||||||
gen_op_gez();
|
gen_op_gez();
|
||||||
blink = 31;
|
blink = 31;
|
||||||
MIPS_DEBUG("bgezall %s, %08x", regnames[rs], btarget);
|
MIPS_DEBUG("bgezall %s, " TARGET_FMT_lx, regnames[rs], btarget);
|
||||||
goto likely;
|
goto likely;
|
||||||
case OPC_BGTZ:
|
case OPC_BGTZ:
|
||||||
gen_op_gtz();
|
gen_op_gtz();
|
||||||
MIPS_DEBUG("bgtz %s, %08x", regnames[rs], btarget);
|
MIPS_DEBUG("bgtz %s, " TARGET_FMT_lx, regnames[rs], btarget);
|
||||||
goto not_likely;
|
goto not_likely;
|
||||||
case OPC_BGTZL:
|
case OPC_BGTZL:
|
||||||
gen_op_gtz();
|
gen_op_gtz();
|
||||||
MIPS_DEBUG("bgtzl %s, %08x", regnames[rs], btarget);
|
MIPS_DEBUG("bgtzl %s, " TARGET_FMT_lx, regnames[rs], btarget);
|
||||||
goto likely;
|
goto likely;
|
||||||
case OPC_BLEZ:
|
case OPC_BLEZ:
|
||||||
gen_op_lez();
|
gen_op_lez();
|
||||||
MIPS_DEBUG("blez %s, %08x", regnames[rs], btarget);
|
MIPS_DEBUG("blez %s, " TARGET_FMT_lx, regnames[rs], btarget);
|
||||||
goto not_likely;
|
goto not_likely;
|
||||||
case OPC_BLEZL:
|
case OPC_BLEZL:
|
||||||
gen_op_lez();
|
gen_op_lez();
|
||||||
MIPS_DEBUG("blezl %s, %08x", regnames[rs], btarget);
|
MIPS_DEBUG("blezl %s, " TARGET_FMT_lx, regnames[rs], btarget);
|
||||||
goto likely;
|
goto likely;
|
||||||
case OPC_BLTZ:
|
case OPC_BLTZ:
|
||||||
gen_op_ltz();
|
gen_op_ltz();
|
||||||
MIPS_DEBUG("bltz %s, %08x", regnames[rs], btarget);
|
MIPS_DEBUG("bltz %s, " TARGET_FMT_lx, regnames[rs], btarget);
|
||||||
goto not_likely;
|
goto not_likely;
|
||||||
case OPC_BLTZL:
|
case OPC_BLTZL:
|
||||||
gen_op_ltz();
|
gen_op_ltz();
|
||||||
MIPS_DEBUG("bltzl %s, %08x", regnames[rs], btarget);
|
MIPS_DEBUG("bltzl %s, " TARGET_FMT_lx, regnames[rs], btarget);
|
||||||
goto likely;
|
goto likely;
|
||||||
case OPC_BLTZAL:
|
case OPC_BLTZAL:
|
||||||
gen_op_ltz();
|
gen_op_ltz();
|
||||||
blink = 31;
|
blink = 31;
|
||||||
MIPS_DEBUG("bltzal %s, %08x", regnames[rs], btarget);
|
MIPS_DEBUG("bltzal %s, " TARGET_FMT_lx, regnames[rs], btarget);
|
||||||
not_likely:
|
not_likely:
|
||||||
ctx->hflags |= MIPS_HFLAG_BC;
|
ctx->hflags |= MIPS_HFLAG_BC;
|
||||||
gen_op_set_bcond();
|
gen_op_set_bcond();
|
||||||
@ -1706,7 +1708,7 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc,
|
|||||||
case OPC_BLTZALL:
|
case OPC_BLTZALL:
|
||||||
gen_op_ltz();
|
gen_op_ltz();
|
||||||
blink = 31;
|
blink = 31;
|
||||||
MIPS_DEBUG("bltzall %s, %08x", regnames[rs], btarget);
|
MIPS_DEBUG("bltzall %s, " TARGET_FMT_lx, regnames[rs], btarget);
|
||||||
likely:
|
likely:
|
||||||
ctx->hflags |= MIPS_HFLAG_BL;
|
ctx->hflags |= MIPS_HFLAG_BL;
|
||||||
gen_op_set_bcond();
|
gen_op_set_bcond();
|
||||||
@ -1718,7 +1720,7 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MIPS_DEBUG("enter ds: link %d cond %02x target %08x",
|
MIPS_DEBUG("enter ds: link %d cond %02x target " TARGET_FMT_lx,
|
||||||
blink, ctx->hflags, btarget);
|
blink, ctx->hflags, btarget);
|
||||||
ctx->btarget = btarget;
|
ctx->btarget = btarget;
|
||||||
if (blink > 0) {
|
if (blink > 0) {
|
||||||
@ -4221,6 +4223,7 @@ static void gen_cp0 (DisasContext *ctx, uint32_t opc, int rt, int rd)
|
|||||||
case OPC_DERET:
|
case OPC_DERET:
|
||||||
opn = "deret";
|
opn = "deret";
|
||||||
if (!(ctx->hflags & MIPS_HFLAG_DM)) {
|
if (!(ctx->hflags & MIPS_HFLAG_DM)) {
|
||||||
|
MIPS_INVAL(opn);
|
||||||
generate_exception(ctx, EXCP_RI);
|
generate_exception(ctx, EXCP_RI);
|
||||||
} else {
|
} else {
|
||||||
save_cpu_state(ctx, 0);
|
save_cpu_state(ctx, 0);
|
||||||
@ -4238,11 +4241,7 @@ static void gen_cp0 (DisasContext *ctx, uint32_t opc, int rt, int rd)
|
|||||||
ctx->bstate = BS_EXCP;
|
ctx->bstate = BS_EXCP;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (loglevel & CPU_LOG_TB_IN_ASM) {
|
MIPS_INVAL(opn);
|
||||||
fprintf(logfile, "Invalid CP0 opcode: %08x %03x %03x %03x\n",
|
|
||||||
ctx->opcode, ctx->opcode >> 26, ctx->opcode & 0x3F,
|
|
||||||
((ctx->opcode >> 16) & 0x1F));
|
|
||||||
}
|
|
||||||
generate_exception(ctx, EXCP_RI);
|
generate_exception(ctx, EXCP_RI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -4254,25 +4253,26 @@ static void gen_compute_branch1 (DisasContext *ctx, uint32_t op,
|
|||||||
int32_t cc, int32_t offset)
|
int32_t cc, int32_t offset)
|
||||||
{
|
{
|
||||||
target_ulong btarget;
|
target_ulong btarget;
|
||||||
|
const char *opn = "cp1 cond branch";
|
||||||
|
|
||||||
btarget = ctx->pc + 4 + offset;
|
btarget = ctx->pc + 4 + offset;
|
||||||
|
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case OPC_BC1F:
|
case OPC_BC1F:
|
||||||
gen_op_bc1f(cc);
|
gen_op_bc1f(cc);
|
||||||
MIPS_DEBUG("bc1f " TARGET_FMT_lx, btarget);
|
opn = "bc1f";
|
||||||
goto not_likely;
|
goto not_likely;
|
||||||
case OPC_BC1FL:
|
case OPC_BC1FL:
|
||||||
gen_op_bc1f(cc);
|
gen_op_bc1f(cc);
|
||||||
MIPS_DEBUG("bc1fl " TARGET_FMT_lx, btarget);
|
opn = "bc1fl";
|
||||||
goto likely;
|
goto likely;
|
||||||
case OPC_BC1T:
|
case OPC_BC1T:
|
||||||
gen_op_bc1t(cc);
|
gen_op_bc1t(cc);
|
||||||
MIPS_DEBUG("bc1t " TARGET_FMT_lx, btarget);
|
opn = "bc1t";
|
||||||
goto not_likely;
|
goto not_likely;
|
||||||
case OPC_BC1TL:
|
case OPC_BC1TL:
|
||||||
gen_op_bc1t(cc);
|
gen_op_bc1t(cc);
|
||||||
MIPS_DEBUG("bc1tl " TARGET_FMT_lx, btarget);
|
opn = "bc1tl";
|
||||||
likely:
|
likely:
|
||||||
ctx->hflags |= MIPS_HFLAG_BL;
|
ctx->hflags |= MIPS_HFLAG_BL;
|
||||||
gen_op_set_bcond();
|
gen_op_set_bcond();
|
||||||
@ -4280,34 +4280,31 @@ static void gen_compute_branch1 (DisasContext *ctx, uint32_t op,
|
|||||||
break;
|
break;
|
||||||
case OPC_BC1FANY2:
|
case OPC_BC1FANY2:
|
||||||
gen_op_bc1fany2(cc);
|
gen_op_bc1fany2(cc);
|
||||||
MIPS_DEBUG("bc1fany2 " TARGET_FMT_lx, btarget);
|
opn = "bc1fany2";
|
||||||
goto not_likely;
|
goto not_likely;
|
||||||
case OPC_BC1TANY2:
|
case OPC_BC1TANY2:
|
||||||
gen_op_bc1tany2(cc);
|
gen_op_bc1tany2(cc);
|
||||||
MIPS_DEBUG("bc1tany2 " TARGET_FMT_lx, btarget);
|
opn = "bc1tany2";
|
||||||
goto not_likely;
|
goto not_likely;
|
||||||
case OPC_BC1FANY4:
|
case OPC_BC1FANY4:
|
||||||
gen_op_bc1fany4(cc);
|
gen_op_bc1fany4(cc);
|
||||||
MIPS_DEBUG("bc1fany4 " TARGET_FMT_lx, btarget);
|
opn = "bc1fany4";
|
||||||
goto not_likely;
|
goto not_likely;
|
||||||
case OPC_BC1TANY4:
|
case OPC_BC1TANY4:
|
||||||
gen_op_bc1tany4(cc);
|
gen_op_bc1tany4(cc);
|
||||||
MIPS_DEBUG("bc1tany4 " TARGET_FMT_lx, btarget);
|
opn = "bc1tany4";
|
||||||
not_likely:
|
not_likely:
|
||||||
ctx->hflags |= MIPS_HFLAG_BC;
|
ctx->hflags |= MIPS_HFLAG_BC;
|
||||||
gen_op_set_bcond();
|
gen_op_set_bcond();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
MIPS_INVAL("cp1 branch");
|
MIPS_INVAL(opn);
|
||||||
generate_exception (ctx, EXCP_RI);
|
generate_exception (ctx, EXCP_RI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
MIPS_DEBUG("%s: cond %02x target " TARGET_FMT_lx, opn,
|
||||||
MIPS_DEBUG("enter ds: cond %02x target " TARGET_FMT_lx,
|
|
||||||
ctx->hflags, btarget);
|
ctx->hflags, btarget);
|
||||||
ctx->btarget = btarget;
|
ctx->btarget = btarget;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Coprocessor 1 (FPU) */
|
/* Coprocessor 1 (FPU) */
|
||||||
@ -4325,18 +4322,19 @@ static void gen_compute_branch1 (DisasContext *ctx, uint32_t op,
|
|||||||
* FIXME: This is broken for R2, it needs to be checked at runtime, not
|
* FIXME: This is broken for R2, it needs to be checked at runtime, not
|
||||||
* at translation time.
|
* at translation time.
|
||||||
*/
|
*/
|
||||||
#define CHECK_FR(ctx, freg) do { \
|
#define CHECK_FR(ctx, freg) do { \
|
||||||
if (!((ctx)->CP0_Status & (1 << CP0St_FR)) && ((freg) & 1)) { \
|
if (!((ctx)->CP0_Status & (1 << CP0St_FR)) && ((freg) & 1)) { \
|
||||||
generate_exception (ctx, EXCP_RI); \
|
MIPS_INVAL("FPU mode"); \
|
||||||
return; \
|
generate_exception (ctx, EXCP_RI); \
|
||||||
} \
|
return; \
|
||||||
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define FOP(func, fmt) (((fmt) << 21) | (func))
|
#define FOP(func, fmt) (((fmt) << 21) | (func))
|
||||||
|
|
||||||
static void gen_cp1 (DisasContext *ctx, uint32_t opc, int rt, int fs)
|
static void gen_cp1 (DisasContext *ctx, uint32_t opc, int rt, int fs)
|
||||||
{
|
{
|
||||||
const char *opn = "unk";
|
const char *opn = "cp1 move";
|
||||||
|
|
||||||
switch (opc) {
|
switch (opc) {
|
||||||
case OPC_MFC1:
|
case OPC_MFC1:
|
||||||
@ -4390,11 +4388,7 @@ static void gen_cp1 (DisasContext *ctx, uint32_t opc, int rt, int fs)
|
|||||||
opn = "mthc1";
|
opn = "mthc1";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (loglevel & CPU_LOG_TB_IN_ASM) {
|
MIPS_INVAL(opn);
|
||||||
fprintf(logfile, "Invalid CP1 opcode: %08x %03x %03x %03x\n",
|
|
||||||
ctx->opcode, ctx->opcode >> 26, ctx->opcode & 0x3F,
|
|
||||||
((ctx->opcode >> 16) & 0x1F));
|
|
||||||
}
|
|
||||||
generate_exception (ctx, EXCP_RI);
|
generate_exception (ctx, EXCP_RI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -4440,7 +4434,7 @@ GEN_MOVCF(ps);
|
|||||||
static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
|
static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
|
||||||
int fs, int fd, int cc)
|
int fs, int fd, int cc)
|
||||||
{
|
{
|
||||||
const char *opn = "unk";
|
const char *opn = "farith";
|
||||||
const char *condnames[] = {
|
const char *condnames[] = {
|
||||||
"c.f",
|
"c.f",
|
||||||
"c.un",
|
"c.un",
|
||||||
@ -5041,11 +5035,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
|
|||||||
opn = condnames[func-48];
|
opn = condnames[func-48];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (loglevel & CPU_LOG_TB_IN_ASM) {
|
MIPS_INVAL(opn);
|
||||||
fprintf(logfile, "Invalid FP arith function: %08x %03x %03x %03x\n",
|
|
||||||
ctx->opcode, ctx->opcode >> 26, ctx->opcode & 0x3F,
|
|
||||||
((ctx->opcode >> 16) & 0x1F));
|
|
||||||
}
|
|
||||||
generate_exception (ctx, EXCP_RI);
|
generate_exception (ctx, EXCP_RI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5059,7 +5049,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
|
|||||||
static void gen_flt3_ldst (DisasContext *ctx, uint32_t opc, int fd,
|
static void gen_flt3_ldst (DisasContext *ctx, uint32_t opc, int fd,
|
||||||
int base, int index)
|
int base, int index)
|
||||||
{
|
{
|
||||||
const char *opn = "unk";
|
const char *opn = "extended float load/store";
|
||||||
|
|
||||||
GEN_LOAD_REG_TN(T0, base);
|
GEN_LOAD_REG_TN(T0, base);
|
||||||
GEN_LOAD_REG_TN(T1, index);
|
GEN_LOAD_REG_TN(T1, index);
|
||||||
@ -5098,7 +5088,7 @@ static void gen_flt3_ldst (DisasContext *ctx, uint32_t opc, int fd,
|
|||||||
opn = "suxc1";
|
opn = "suxc1";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
MIPS_INVAL("extended float load/store");
|
MIPS_INVAL(opn);
|
||||||
generate_exception(ctx, EXCP_RI);
|
generate_exception(ctx, EXCP_RI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5108,7 +5098,7 @@ static void gen_flt3_ldst (DisasContext *ctx, uint32_t opc, int fd,
|
|||||||
static void gen_flt3_arith (DisasContext *ctx, uint32_t opc, int fd,
|
static void gen_flt3_arith (DisasContext *ctx, uint32_t opc, int fd,
|
||||||
int fr, int fs, int ft)
|
int fr, int fs, int ft)
|
||||||
{
|
{
|
||||||
const char *opn = "unk";
|
const char *opn = "flt3_arith";
|
||||||
|
|
||||||
/* All of those work only on 64bit FPUs. */
|
/* All of those work only on 64bit FPUs. */
|
||||||
CHECK_FR(ctx, fd | fr | fs | ft);
|
CHECK_FR(ctx, fd | fr | fs | ft);
|
||||||
@ -5173,11 +5163,8 @@ static void gen_flt3_arith (DisasContext *ctx, uint32_t opc, int fd,
|
|||||||
generate_exception (ctx, EXCP_RI);
|
generate_exception (ctx, EXCP_RI);
|
||||||
opn = "nmsub.ps";
|
opn = "nmsub.ps";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (loglevel & CPU_LOG_TB_IN_ASM) {
|
MIPS_INVAL(opn);
|
||||||
fprintf(logfile, "Invalid extended FP arith function: %08x %03x %03x\n",
|
|
||||||
ctx->opcode, ctx->opcode >> 26, ctx->opcode & 0x3F);
|
|
||||||
}
|
|
||||||
generate_exception (ctx, EXCP_RI);
|
generate_exception (ctx, EXCP_RI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5459,7 +5446,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx)
|
|||||||
/* treat as noop */
|
/* treat as noop */
|
||||||
break;
|
break;
|
||||||
default: /* Invalid */
|
default: /* Invalid */
|
||||||
MIPS_INVAL("REGIMM");
|
MIPS_INVAL("regimm");
|
||||||
generate_exception(ctx, EXCP_RI);
|
generate_exception(ctx, EXCP_RI);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -5494,7 +5481,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx)
|
|||||||
ctx->bstate = BS_STOP;
|
ctx->bstate = BS_STOP;
|
||||||
break;
|
break;
|
||||||
default: /* Invalid */
|
default: /* Invalid */
|
||||||
MIPS_INVAL("MFMC0");
|
MIPS_INVAL("mfmc0");
|
||||||
generate_exception(ctx, EXCP_RI);
|
generate_exception(ctx, EXCP_RI);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -5506,10 +5493,13 @@ static void decode_opc (CPUState *env, DisasContext *ctx)
|
|||||||
/* Shadow registers not implemented. */
|
/* Shadow registers not implemented. */
|
||||||
GEN_LOAD_REG_TN(T0, rt);
|
GEN_LOAD_REG_TN(T0, rt);
|
||||||
GEN_STORE_TN_REG(rd, T0);
|
GEN_STORE_TN_REG(rd, T0);
|
||||||
} else
|
} else {
|
||||||
|
MIPS_INVAL("shadow register move");
|
||||||
generate_exception(ctx, EXCP_RI);
|
generate_exception(ctx, EXCP_RI);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
MIPS_INVAL("cp0");
|
||||||
generate_exception(ctx, EXCP_RI);
|
generate_exception(ctx, EXCP_RI);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -5539,7 +5529,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx)
|
|||||||
/* Treat as a noop */
|
/* Treat as a noop */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Floating point. */
|
/* Floating point (COP1). */
|
||||||
case OPC_LWC1:
|
case OPC_LWC1:
|
||||||
case OPC_LDC1:
|
case OPC_LDC1:
|
||||||
case OPC_SWC1:
|
case OPC_SWC1:
|
||||||
@ -5584,6 +5574,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx)
|
|||||||
(imm >> 8) & 0x7);
|
(imm >> 8) & 0x7);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
MIPS_INVAL("cp1");
|
||||||
generate_exception (ctx, EXCP_RI);
|
generate_exception (ctx, EXCP_RI);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -5635,6 +5626,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx)
|
|||||||
gen_flt3_arith(ctx, op1, sa, rs, rd, rt);
|
gen_flt3_arith(ctx, op1, sa, rs, rd, rt);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
MIPS_INVAL("cp3");
|
||||||
generate_exception (ctx, EXCP_RI);
|
generate_exception (ctx, EXCP_RI);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -5667,7 +5659,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx)
|
|||||||
/* MDMX: Not implemented. */
|
/* MDMX: Not implemented. */
|
||||||
#endif
|
#endif
|
||||||
default: /* Invalid */
|
default: /* Invalid */
|
||||||
MIPS_INVAL("");
|
MIPS_INVAL("major opcode");
|
||||||
generate_exception(ctx, EXCP_RI);
|
generate_exception(ctx, EXCP_RI);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -5764,7 +5756,7 @@ gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb,
|
|||||||
cpu_dump_state(env, logfile, fprintf, 0);
|
cpu_dump_state(env, logfile, fprintf, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined MIPS_DEBUG_DISAS
|
#ifdef MIPS_DEBUG_DISAS
|
||||||
if (loglevel & CPU_LOG_TB_IN_ASM)
|
if (loglevel & CPU_LOG_TB_IN_ASM)
|
||||||
fprintf(logfile, "\ntb %p super %d cond %04x\n",
|
fprintf(logfile, "\ntb %p super %d cond %04x\n",
|
||||||
tb, ctx.mem_idx, ctx.hflags);
|
tb, ctx.mem_idx, ctx.hflags);
|
||||||
|
Loading…
Reference in New Issue
Block a user