From: Yongbok Kim <yongbok.kim@imgtec.com>
To: qemu-devel@nongnu.org
Cc: Miodrag Dinic <miodrag.dinic@imgtec.com>
Subject: [Qemu-devel] [PULL 1/2] target/mips: fix msa copy_[s|u]_df rd = 0 corner case
Date: Tue, 11 Jul 2017 16:16:04 +0100 [thread overview]
Message-ID: <1499786165-9404-2-git-send-email-yongbok.kim@imgtec.com> (raw)
In-Reply-To: <1499786165-9404-1-git-send-email-yongbok.kim@imgtec.com>
From: Miodrag Dinic <miodrag.dinic@imgtec.com>
This patch fixes the msa copy_[s|u]_df instruction emulation when
the destination register rd is zero. Without this patch the zero
register would get clobbered, which should never happen because it
is supposed to be hardwired to 0.
Fix this corner case by explicitly checking rd = 0 and effectively
making these instructions emulation no-op in that case.
Signed-off-by: Miodrag Dinic <miodrag.dinic@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Acked-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
---
target/mips/translate.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/target/mips/translate.c b/target/mips/translate.c
index 559f8fe..befb87f 100644
--- a/target/mips/translate.c
+++ b/target/mips/translate.c
@@ -18712,10 +18712,14 @@ static void gen_msa_elm_df(CPUMIPSState *env, DisasContext *ctx, uint32_t df,
#endif
switch (MASK_MSA_ELM(ctx->opcode)) {
case OPC_COPY_S_df:
- gen_helper_msa_copy_s_df(cpu_env, tdf, twd, tws, tn);
+ if (likely(wd != 0)) {
+ gen_helper_msa_copy_s_df(cpu_env, tdf, twd, tws, tn);
+ }
break;
case OPC_COPY_U_df:
- gen_helper_msa_copy_u_df(cpu_env, tdf, twd, tws, tn);
+ if (likely(wd != 0)) {
+ gen_helper_msa_copy_u_df(cpu_env, tdf, twd, tws, tn);
+ }
break;
case OPC_INSERT_df:
gen_helper_msa_insert_df(cpu_env, tdf, twd, tws, tn);
--
2.7.4
next prev parent reply other threads:[~2017-07-11 15:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-11 15:16 [Qemu-devel] [PULL 0/2] target-mips queue Yongbok Kim
2017-07-11 15:16 ` Yongbok Kim [this message]
2017-07-11 15:16 ` [Qemu-devel] [PULL 2/2] mips/malta: load the initrd at the end of the low memory Yongbok Kim
2017-07-13 12:38 ` [Qemu-devel] [PULL 0/2] target-mips queue Peter Maydell
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=1499786165-9404-2-git-send-email-yongbok.kim@imgtec.com \
--to=yongbok.kim@imgtec.com \
--cc=miodrag.dinic@imgtec.com \
--cc=qemu-devel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).