mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-11 03:24:58 -06:00
target-mips: Fix seg fault for LUI when MIPS_DEBUG_DISAS==1.
The call to gen_logic_imm for OPC_LUI passes -1 for rs. This causes the MIPS_DEBUG statement to seg fault due to the deference of regnames[rs]. This patch fixes that. Signed-off-by: Eric Johnson <ericj@mips.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> (aurel32: replaced static string formating by a static string)
This commit is contained in:
parent
0af10c86ed
commit
7c2c3ea3fd
1 changed files with 11 additions and 7 deletions
|
@ -2013,7 +2013,6 @@ static void gen_logic_imm(CPUMIPSState *env, DisasContext *ctx, uint32_t opc,
|
||||||
int rt, int rs, int16_t imm)
|
int rt, int rs, int16_t imm)
|
||||||
{
|
{
|
||||||
target_ulong uimm;
|
target_ulong uimm;
|
||||||
const char *opn = "imm logic";
|
|
||||||
|
|
||||||
if (rt == 0) {
|
if (rt == 0) {
|
||||||
/* If no destination, treat it as a NOP. */
|
/* If no destination, treat it as a NOP. */
|
||||||
|
@ -2027,29 +2026,34 @@ static void gen_logic_imm(CPUMIPSState *env, DisasContext *ctx, uint32_t opc,
|
||||||
tcg_gen_andi_tl(cpu_gpr[rt], cpu_gpr[rs], uimm);
|
tcg_gen_andi_tl(cpu_gpr[rt], cpu_gpr[rs], uimm);
|
||||||
else
|
else
|
||||||
tcg_gen_movi_tl(cpu_gpr[rt], 0);
|
tcg_gen_movi_tl(cpu_gpr[rt], 0);
|
||||||
opn = "andi";
|
MIPS_DEBUG("andi %s, %s, " TARGET_FMT_lx, regnames[rt],
|
||||||
|
regnames[rs], uimm);
|
||||||
break;
|
break;
|
||||||
case OPC_ORI:
|
case OPC_ORI:
|
||||||
if (rs != 0)
|
if (rs != 0)
|
||||||
tcg_gen_ori_tl(cpu_gpr[rt], cpu_gpr[rs], uimm);
|
tcg_gen_ori_tl(cpu_gpr[rt], cpu_gpr[rs], uimm);
|
||||||
else
|
else
|
||||||
tcg_gen_movi_tl(cpu_gpr[rt], uimm);
|
tcg_gen_movi_tl(cpu_gpr[rt], uimm);
|
||||||
opn = "ori";
|
MIPS_DEBUG("ori %s, %s, " TARGET_FMT_lx, regnames[rt],
|
||||||
|
regnames[rs], uimm);
|
||||||
break;
|
break;
|
||||||
case OPC_XORI:
|
case OPC_XORI:
|
||||||
if (likely(rs != 0))
|
if (likely(rs != 0))
|
||||||
tcg_gen_xori_tl(cpu_gpr[rt], cpu_gpr[rs], uimm);
|
tcg_gen_xori_tl(cpu_gpr[rt], cpu_gpr[rs], uimm);
|
||||||
else
|
else
|
||||||
tcg_gen_movi_tl(cpu_gpr[rt], uimm);
|
tcg_gen_movi_tl(cpu_gpr[rt], uimm);
|
||||||
opn = "xori";
|
MIPS_DEBUG("xori %s, %s, " TARGET_FMT_lx, regnames[rt],
|
||||||
|
regnames[rs], uimm);
|
||||||
break;
|
break;
|
||||||
case OPC_LUI:
|
case OPC_LUI:
|
||||||
tcg_gen_movi_tl(cpu_gpr[rt], imm << 16);
|
tcg_gen_movi_tl(cpu_gpr[rt], imm << 16);
|
||||||
opn = "lui";
|
MIPS_DEBUG("lui %s, " TARGET_FMT_lx, regnames[rt], uimm);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
MIPS_DEBUG("Unknown logical immediate opcode %08x", opc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
(void)opn; /* avoid a compiler warning */
|
|
||||||
MIPS_DEBUG("%s %s, %s, " TARGET_FMT_lx, opn, regnames[rt], regnames[rs], uimm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set on less than with immediate operand */
|
/* Set on less than with immediate operand */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue