[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 21/22] disas: cris: Fix 0 buffer length case
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PULL 21/22] disas: cris: Fix 0 buffer length case |
Date: |
Tue, 7 Jul 2015 01:14:04 +0200 |
From: Peter Crosthwaite <address@hidden>
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 <address@hidden>
Signed-off-by: Peter Crosthwaite <address@hidden>
Signed-off-by: Andreas Färber <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.
--
2.1.4
- [Qemu-devel] [PULL 15/22] microblaze: boot: Use cpu_set_pc(), (continued)
- [Qemu-devel] [PULL 15/22] microblaze: boot: Use cpu_set_pc(), Andreas Färber, 2015/07/06
- [Qemu-devel] [PULL 13/22] gdbstub: Use cpu_set_pc() helper, Andreas Färber, 2015/07/06
- [Qemu-devel] [PULL 14/22] hw/arm/boot: Use cpu_set_pc(), Andreas Färber, 2015/07/06
- [Qemu-devel] [PULL 10/22] cpu: Change cpu_exec_init() arg to cpu, not env, Andreas Färber, 2015/07/06
- [Qemu-devel] [PULL 17/22] disas: QOMify target specific setup, Andreas Färber, 2015/07/06
- [Qemu-devel] [PULL 11/22] cpu-exec: Purge all uses of ENV_GET_CPU(), Andreas Färber, 2015/07/06
- [Qemu-devel] [PULL 18/22] disas: arm-a64: Make printfer and stream variable, Andreas Färber, 2015/07/06
- [Qemu-devel] [PULL 16/22] disas: Add print_insn to disassemble info, Andreas Färber, 2015/07/06
- [Qemu-devel] [PULL 19/22] disas: arm: QOMify target specific disas setup, Andreas Färber, 2015/07/06
- [Qemu-devel] [PULL 20/22] disas: microblaze: QOMify target specific disas setup, Andreas Färber, 2015/07/06
- [Qemu-devel] [PULL 21/22] disas: cris: Fix 0 buffer length case,
Andreas Färber <=
- [Qemu-devel] [PULL 22/22] disas: cris: QOMify target specific disas setup, Andreas Färber, 2015/07/06
- Re: [Qemu-devel] [PULL 00/22] QOM CPUState patch queue 2015-07-06, Andreas Färber, 2015/07/06