From: Peter Crosthwaite <crosthwaitepeter@gmail.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org,
Peter Crosthwaite <crosthwaite.peter@gmail.com>,
claudio.fontana@huawei.com, edgar.iglesias@gmail.com,
afaerber@suse.de, rth@twiddle.net
Subject: [Qemu-devel] [PATCH qom v4 6/7] disas: cris: Fix 0 buffer length case
Date: Tue, 23 Jun 2015 20:57:37 -0700 [thread overview]
Message-ID: <22bbba694f8cdd2ccac41019d1be8412abff62ad.1435117090.git.crosthwaite.peter@gmail.com> (raw)
In-Reply-To: <cover.1435117090.git.crosthwaite.peter@gmail.com>
In-Reply-To: <cover.1435117090.git.crosthwaite.peter@gmail.com>
Cris has the complication of variable length instructions and has
a check in place to clamp memory reads in case the disas request
doesn't have enough bytes for the instruction being disas'd. This
breaks down in the case where disassembling for the monitor where
the buffer length is defaulted to 0.
The buffer length should never be zero for a regular target_disas,
so we can safely assume the 0 case is for the monitor in which case
consider the buffer length to be the max for cris instructions.
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
disas/cris.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/disas/cris.c b/disas/cris.c
index e6cff7a..1b76a09 100644
--- a/disas/cris.c
+++ b/disas/cris.c
@@ -2575,9 +2575,9 @@ print_insn_cris_generic (bfd_vma memaddr,
If we can't get any data, or we do not get enough data, we print
the error message. */
- nbytes = info->buffer_length;
- if (nbytes > MAX_BYTES_PER_CRIS_INSN)
- nbytes = MAX_BYTES_PER_CRIS_INSN;
+ nbytes = info->buffer_length ? info->buffer_length
+ : MAX_BYTES_PER_CRIS_INSN;
+ nbytes = MIN(nbytes, MAX_BYTES_PER_CRIS_INSN);
status = (*info->read_memory_func) (memaddr, buffer, nbytes, info);
/* If we did not get all we asked for, then clear the rest.
--
1.9.1
next prev parent reply other threads:[~2015-06-24 3:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-24 3:57 [Qemu-devel] [PATCH qom v4 0/7] Unify and QOMify (target|monitor)_disas Peter Crosthwaite
2015-06-24 3:57 ` [Qemu-devel] [PATCH qom v4 1/7] disas: Add print_insn to disassemble info Peter Crosthwaite
2015-06-24 3:57 ` [Qemu-devel] [PATCH qom v4 2/7] disas: QOMify target specific setup Peter Crosthwaite
2015-06-24 3:57 ` [Qemu-devel] [PATCH qom v4 3/7] disas: arm-a64: Make printfer and stream variable Peter Crosthwaite
2015-06-24 3:57 ` [Qemu-devel] [PATCH qom v4 4/7] disas: arm: QOMify target specific disas setup Peter Crosthwaite
2015-06-24 3:57 ` [Qemu-devel] [PATCH qom v4 5/7] disas: microblaze: " Peter Crosthwaite
2015-06-24 3:57 ` Peter Crosthwaite [this message]
2015-06-24 3:57 ` [Qemu-devel] [PATCH qom v4 7/7] disas: cris: " Peter Crosthwaite
2015-07-05 20:48 ` [Qemu-devel] [PATCH qom v4 0/7] Unify and QOMify (target|monitor)_disas Peter Crosthwaite
2015-07-06 11:44 ` Richard Henderson
2015-07-06 11:48 ` Andreas Färber
2015-07-06 16:41 ` Peter Crosthwaite
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=22bbba694f8cdd2ccac41019d1be8412abff62ad.1435117090.git.crosthwaite.peter@gmail.com \
--to=crosthwaitepeter@gmail.com \
--cc=afaerber@suse.de \
--cc=claudio.fontana@huawei.com \
--cc=crosthwaite.peter@gmail.com \
--cc=edgar.iglesias@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).