From: Eric Johnson <ericj@mips.com>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org
Subject: [Qemu-trivial] [PATCH] target-mips: Fix seg fault for LUI when MIPS_DEBUG_DISAS==1.
Date: Fri, 9 Nov 2012 19:40:51 -0800 [thread overview]
Message-ID: <1352518851-21812-1-git-send-email-ericj@mips.com> (raw)
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>
---
target-mips/translate.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/target-mips/translate.c b/target-mips/translate.c
index 8175da0..aba6327 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -2013,7 +2013,6 @@ static void gen_logic_imm(CPUMIPSState *env, DisasContext *ctx, uint32_t opc,
int rt, int rs, int16_t imm)
{
target_ulong uimm;
- const char *opn = "imm logic";
if (rt == 0) {
/* 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);
else
tcg_gen_movi_tl(cpu_gpr[rt], 0);
- opn = "andi";
+ MIPS_DEBUG("%s %s, %s, " TARGET_FMT_lx, "andi", regnames[rt],
+ regnames[rs], uimm);
break;
case OPC_ORI:
if (rs != 0)
tcg_gen_ori_tl(cpu_gpr[rt], cpu_gpr[rs], uimm);
else
tcg_gen_movi_tl(cpu_gpr[rt], uimm);
- opn = "ori";
+ MIPS_DEBUG("%s %s, %s, " TARGET_FMT_lx, "ori", regnames[rt],
+ regnames[rs], uimm);
break;
case OPC_XORI:
if (likely(rs != 0))
tcg_gen_xori_tl(cpu_gpr[rt], cpu_gpr[rs], uimm);
else
tcg_gen_movi_tl(cpu_gpr[rt], uimm);
- opn = "xori";
+ MIPS_DEBUG("%s %s, %s, " TARGET_FMT_lx, "xori", regnames[rt],
+ regnames[rs], uimm);
break;
case OPC_LUI:
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;
}
- (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 */
--
1.7.4.4
next reply other threads:[~2012-11-10 4:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-10 3:40 Eric Johnson [this message]
2012-11-11 16:05 ` [Qemu-trivial] [PATCH] target-mips: Fix seg fault for LUI when MIPS_DEBUG_DISAS==1 Aurelien Jarno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1352518851-21812-1-git-send-email-ericj@mips.com \
--to=ericj@mips.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.