From: Onur Sahin <onursahin08@gmail.com>
To: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, peter.maydell@linaro.org,
Onur Sahin <onursahin08@gmail.com>
Subject: [Qemu-devel] [PATCH v2] target-arm: Check undefined opcodes for SWP in A32 decoder
Date: Fri, 23 Mar 2018 17:43:06 -0400 [thread overview]
Message-ID: <1521841386-27498-1-git-send-email-onursahin08@gmail.com> (raw)
In-Reply-To: <CAFEAcA9G3xVjmjys2R4-NXRHiZwLVLRO7ZQDZ0AhNMHHFhHV8A@mail.gmail.com>
Thanks for the feedback Peter. Removing the redundant check on bit
23 and adding checks for the "should be" bits as well (bits [11:8]).
The following patch should make sure we are not treating
architecturally Undefined instructions as a SWP, by verifying
the opcodes as per section A8.8.229 of ARMv7-A specification.
Best,
Onur
Signed-off-by: Onur Sahin <onursahin08@gmail.com>
---
target/arm/translate.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/target/arm/translate.c b/target/arm/translate.c
index ba6ab7d..1fb0b8f 100644
--- a/target/arm/translate.c
+++ b/target/arm/translate.c
@@ -9227,11 +9227,14 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
}
}
tcg_temp_free_i32(addr);
- } else {
+ } else if ((insn & 0x00300f00) == 0) {
+ /* 0bcccc_0001_0x00_xxxx_xxxx_0000_1001_xxxx
+ * - SWP, SWPB
+ */
+
TCGv taddr;
TCGMemOp opc = s->be_data;
- /* SWP instruction */
rm = (insn) & 0xf;
if (insn & (1 << 22)) {
@@ -9249,6 +9252,8 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
get_mem_index(s), opc);
tcg_temp_free(taddr);
store_reg(s, rd, tmp);
+ } else {
+ goto illegal_op;
}
}
} else {
--
1.8.3.1
next prev parent reply other threads:[~2018-03-23 21:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-23 3:58 [Qemu-devel] [PATCH] target-arm: Check undefined opcodes for SWP in A32 decoder Onur Sahin
2018-03-23 11:50 ` [Qemu-devel] [Qemu-arm] " Peter Maydell
2018-03-23 21:43 ` Onur Sahin [this message]
2018-04-05 12:26 ` [Qemu-devel] [PATCH v2] " 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=1521841386-27498-1-git-send-email-onursahin08@gmail.com \
--to=onursahin08@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--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).