[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 6/7] disas: cris: Fix 0 buffer length case
From: |
Edgar E. Iglesias |
Subject: |
Re: [Qemu-devel] [PATCH v3 6/7] disas: cris: Fix 0 buffer length case |
Date: |
Fri, 29 May 2015 15:21:15 +1000 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Sun, May 24, 2015 at 03:47:19PM -0700, Peter Crosthwaite wrote:
> 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 <address@hidden>
Reviewed-by: Edgar E. Iglesias <address@hidden>
> ---
> 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
>
>
- [Qemu-devel] [PATCH v3 0/7] Unify and QOMify (target|monitor)_disas, Peter Crosthwaite, 2015/05/24
- [Qemu-devel] [PATCH v3 1/7] disas: Add print_insn to disassemble info, Peter Crosthwaite, 2015/05/24
- [Qemu-devel] [PATCH v3 2/7] disas: QOMify target specific setup, Peter Crosthwaite, 2015/05/24
- [Qemu-devel] [PATCH v3 3/7] disas: arm-a64: Make printfer and stream variable, Peter Crosthwaite, 2015/05/24
- [Qemu-devel] [PATCH v3 4/7] disas: arm: QOMify target specific disas setup, Peter Crosthwaite, 2015/05/24
- [Qemu-devel] [PATCH v3 5/7] disas: microblaze: QOMify target specific disas setup, Peter Crosthwaite, 2015/05/24
- [Qemu-devel] [PATCH v3 6/7] disas: cris: Fix 0 buffer length case, Peter Crosthwaite, 2015/05/24
- Re: [Qemu-devel] [PATCH v3 6/7] disas: cris: Fix 0 buffer length case,
Edgar E. Iglesias <=
- [Qemu-devel] [PATCH v3 7/7] disas: cris: QOMify target specific disas setup, Peter Crosthwaite, 2015/05/24