From: Dongxue Zhang <elta.era@gmail.com>
To: qemu-devel@nongnu.org
Cc: Dongxue Zhang <elta.era@gmail.com>, aurelien@aurel32.net
Subject: [Qemu-devel] [PATCH 2/2] target-mips/translate.c: Add judgement for msb and lsb
Date: Mon, 28 Jul 2014 23:58:22 +0800 [thread overview]
Message-ID: <1406563102-11035-2-git-send-email-elta.era@gmail.com> (raw)
In-Reply-To: <1406563102-11035-1-git-send-email-elta.era@gmail.com>
Use 'if' to make sure the real msb greater than the lsb. As the compiler may
not do this.
Signed-off-by: Dongxue Zhang <elta.era@gmail.com>
---
target-mips/translate.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/target-mips/translate.c b/target-mips/translate.c
index c381366..e2cce31 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -3946,14 +3946,23 @@ static void gen_bitops (DisasContext *ctx, uint32_t opc, int rt,
break;
#if defined(TARGET_MIPS64)
case OPC_DINSM:
+ if (lsb > (msb + 32)) {
+ goto fail;
+ }
gen_load_gpr(t0, rt);
tcg_gen_deposit_tl(t0, t0, t1, lsb, msb + 32 - lsb + 1);
break;
case OPC_DINSU:
+ if (lsb > msb) {
+ goto fail;
+ }
gen_load_gpr(t0, rt);
tcg_gen_deposit_tl(t0, t0, t1, lsb + 32, msb - lsb + 1);
break;
case OPC_DINS:
+ if (lsb > msb) {
+ goto fail;
+ }
gen_load_gpr(t0, rt);
tcg_gen_deposit_tl(t0, t0, t1, lsb, msb - lsb + 1);
break;
--
1.8.1.2
next prev parent reply other threads:[~2014-07-28 15:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-28 15:58 [Qemu-devel] [PATCH 1/2] target-mips/translate.c: Free TCG in OPC_DINSV Dongxue Zhang
2014-07-28 15:58 ` Dongxue Zhang [this message]
2014-07-28 21:42 ` [Qemu-devel] [PATCH 2/2] target-mips/translate.c: Add judgement for msb and lsb Aurelien Jarno
2014-07-28 22:01 ` Peter Maydell
2014-07-28 22:32 ` Aurelien Jarno
2014-07-28 22:34 ` Peter Maydell
2014-07-28 22:52 ` Aurelien Jarno
2014-07-29 12:41 ` Elta
2014-07-29 14:08 ` Aurelien Jarno
2014-07-29 15:32 ` Dongxue Zhang
2014-07-29 12:47 ` Peter Maydell
2014-07-28 21:42 ` [Qemu-devel] [PATCH 1/2] target-mips/translate.c: Free TCG in OPC_DINSV 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=1406563102-11035-2-git-send-email-elta.era@gmail.com \
--to=elta.era@gmail.com \
--cc=aurelien@aurel32.net \
--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).