From: Justin Fletcher <gerph@gerph.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] ARM load/store multiple bug
Date: Sat, 9 Sep 2006 23:19:10 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.63.0609092307540.3197@buttercup.gerph.org> (raw)
Hiya,
I have found a bug in the implementation of the load/store multiple
instructions in ARM (LDM and STM). These are defined in the ARM ARM to
ignore bits 0 and 1 of the address when the load takes place - that is the
base register for these operations is always treated as a 32bit aligned
value (although its value is only rounded internally). This differs from
the LDR/STR operation which uses the full width of instructions.
In other words :
MOV r0, #9
LDMIA r0, {r1,r2}
Is equivalent to loading r1 with the value at 8, and r2 with the value at
12. Contrast this with the following :
MOV r0, #9
LDR r1, [r0]
LDR r2, [r0,#4]
which would load r1 with the value at 8, rotated right 8 bits, and r2 with
the value at 12, rotated right 8 bits.
I have not confirmed the behaviour or the LDR operation, but have found
problems with the multiple register operations. My solution would be to
add the equivalent of a BIC instruction in to the target-arm/translate.c
to clear off the bottom two bits, around line 1695 :
---8<---
if (n != 1)
gen_op_addl_T1_im(-((n - 1) * 4));
}
}
j = 0;
/* Insert something like gen_op_bicl_T1_im(3); here */
for(i=0;i<16;i++) {
if (insn & (1 << i)) {
if (insn & (1 << 20)) {
---8<---
However, there isn't any such function and I'm unsure how to make that
change. Any suggestions would be greatfully received.
--
Gerph <http://gerph.org/>
... Find answers on the street, in cracks beneath my feet.
next reply other threads:[~2006-09-09 22:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-09 22:19 Justin Fletcher [this message]
2006-09-09 23:43 ` [Qemu-devel] ARM load/store multiple bug Paul Brook
2006-09-10 10:43 ` Justin Fletcher
2006-09-10 16:46 ` Fabrice Bellard
2006-09-10 17:15 ` Paul Brook
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=Pine.LNX.4.63.0609092307540.3197@buttercup.gerph.org \
--to=gerph@gerph.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).