From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Peter Crosthwaite" <crosthwaitepeter@gmail.com>,
"Andreas Färber" <afaerber@suse.de>,
"Peter Crosthwaite" <crosthwaite.peter@gmail.com>
Subject: [Qemu-devel] [PULL v3 21/22] disas: cris: Fix 0 buffer length case
Date: Thu, 9 Jul 2015 15:24:11 +0200 [thread overview]
Message-ID: <1436448252-1916-22-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1436448252-1916-1-git-send-email-afaerber@suse.de>
From: Peter Crosthwaite <crosthwaitepeter@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.
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
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.
--
2.1.4
next prev parent reply other threads:[~2015-07-09 13:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1436448252-1916-1-git-send-email-afaerber@suse.de>
2015-07-09 13:23 ` [Qemu-devel] [PULL v3 03/22] cpu: Reorder cpu->as, cpu->thread_id, cpu->memory_dispatch init Andreas Färber
2015-07-09 13:24 ` [Qemu-devel] [PULL v3 13/22] gdbstub: Use cpu_set_pc() helper Andreas Färber
2015-07-09 13:24 ` Andreas Färber [this message]
2015-07-09 13:24 ` [Qemu-devel] [PULL v3 22/22] disas: cris: QOMify target specific disas setup Andreas Färber
2015-07-09 15:22 ` [Qemu-devel] [PULL v3 00/22] QOM CPUState patch queue 2015-07-09 Peter Maydell
2015-07-09 16:32 ` Peter Maydell
[not found] ` <1436448252-1916-6-git-send-email-afaerber@suse.de>
2015-07-14 10:38 ` [Qemu-devel] [PULL v3 05/22] cpu: Convert cpu_index into a bitmap Bharata B Rao
2015-07-14 11:47 ` Igor Mammedov
2015-07-15 3:42 ` Bharata B Rao
2015-07-15 8:09 ` Igor Mammedov
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=1436448252-1916-22-git-send-email-afaerber@suse.de \
--to=afaerber@suse.de \
--cc=crosthwaite.peter@gmail.com \
--cc=crosthwaitepeter@gmail.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).