summaryrefslogtreecommitdiff
path: root/opcodes/dis-buf.c
diff options
context:
space:
mode:
authorTimothy Wall <twall@alum.mit.edu>2000-02-03 18:12:55 +0000
committerTimothy Wall <twall@alum.mit.edu>2000-02-03 18:12:55 +0000
commit3f8b77574a3b670316366084c4066e9f5f2d890b (patch)
tree9af773ccff3f09dc3b7813dfa81c2c0137447579 /opcodes/dis-buf.c
parent392c52aeadb5d1c017849e6cb65beffb351a3593 (diff)
downloadbinutils-redhat-3f8b77574a3b670316366084c4066e9f5f2d890b.tar.gz
octets vs bytes changes for binutils
Diffstat (limited to 'opcodes/dis-buf.c')
-rw-r--r--opcodes/dis-buf.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/opcodes/dis-buf.c b/opcodes/dis-buf.c
index 523fe72789..65b1edb3e6 100644
--- a/opcodes/dis-buf.c
+++ b/opcodes/dis-buf.c
@@ -29,11 +29,17 @@ buffer_read_memory (memaddr, myaddr, length, info)
int length;
struct disassemble_info *info;
{
+ int opb = info->octets_per_byte;
+ int end_addr_offset = length / opb;
+ int max_addr_offset = info->buffer_length / opb;
+ int octets = (memaddr - info->buffer_vma) * opb;
+
if (memaddr < info->buffer_vma
- || memaddr - info->buffer_vma + length > info->buffer_length)
+ || memaddr - info->buffer_vma + end_addr_offset > max_addr_offset)
/* Out of bounds. Use EIO because GDB uses it. */
return EIO;
- memcpy (myaddr, info->buffer + (memaddr - info->buffer_vma), length);
+ memcpy (myaddr, info->buffer + octets, length);
+
return 0;
}