aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorAnthony Green <green@redhat.com>2012-09-13 22:24:51 +0000
committerAnthony Green <green@redhat.com>2012-09-13 22:24:51 +0000
commite202fa84e706abb043aed457473a764c76672297 (patch)
tree972e3d625d10ce5271e031e2f293cba7b2d9d11c /opcodes
parentb9516fa158d68eedaa9e2191e38e7a1acfcfee77 (diff)
downloadgdb-e202fa84e706abb043aed457473a764c76672297.zip
gdb-e202fa84e706abb043aed457473a764c76672297.tar.gz
gdb-e202fa84e706abb043aed457473a764c76672297.tar.bz2
Bi-endian patches for moxie
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog4
-rw-r--r--opcodes/moxie-dis.c36
2 files changed, 33 insertions, 7 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 13b0173..a1b2bfe 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,7 @@
+2012-09-13 Anthony Green <green@moxielogic.com>
+
+ * moxie-dis.c (print_insn_moxie): Handle bi-endian encodings.
+
2012-09-10 Matthias Klose <doko@ubuntu.com>
* config.in: Disable sanity check for kfreebsd.
diff --git a/opcodes/moxie-dis.c b/opcodes/moxie-dis.c
index 79ef099..77821bb 100644
--- a/opcodes/moxie-dis.c
+++ b/opcodes/moxie-dis.c
@@ -53,7 +53,11 @@ print_insn_moxie (bfd_vma addr, struct disassemble_info * info)
if ((status = info->read_memory_func (addr, buffer, 2, info)))
goto fail;
- iword = bfd_getb16 (buffer);
+
+ if (info->endian == BFD_ENDIAN_BIG)
+ iword = bfd_getb16 (buffer);
+ else
+ iword = bfd_getl16 (buffer);
/* Form 1 instructions have the high bit set to 0. */
if ((iword & (1<<15)) == 0)
@@ -79,7 +83,10 @@ print_insn_moxie (bfd_vma addr, struct disassemble_info * info)
unsigned imm;
if ((status = info->read_memory_func (addr + 2, buffer, 4, info)))
goto fail;
- imm = bfd_getb32 (buffer);
+ if (info->endian == BFD_ENDIAN_BIG)
+ imm = bfd_getb32 (buffer);
+ else
+ imm = bfd_getl32 (buffer);
fpr (stream, "%s\t%s, 0x%x", opcode->name,
reg_names[OP_A(iword)], imm);
length = 6;
@@ -90,7 +97,10 @@ print_insn_moxie (bfd_vma addr, struct disassemble_info * info)
unsigned imm;
if ((status = info->read_memory_func (addr + 2, buffer, 4, info)))
goto fail;
- imm = bfd_getb32 (buffer);
+ if (info->endian == BFD_ENDIAN_BIG)
+ imm = bfd_getb32 (buffer);
+ else
+ imm = bfd_getl32 (buffer);
fpr (stream, "%s\t0x%x", opcode->name, imm);
length = 6;
}
@@ -100,7 +110,10 @@ print_insn_moxie (bfd_vma addr, struct disassemble_info * info)
unsigned imm;
if ((status = info->read_memory_func (addr + 2, buffer, 4, info)))
goto fail;
- imm = bfd_getb32 (buffer);
+ if (info->endian == BFD_ENDIAN_BIG)
+ imm = bfd_getb32 (buffer);
+ else
+ imm = bfd_getl32 (buffer);
fpr (stream, "%s\t", opcode->name);
info->print_address_func ((bfd_vma) imm, info);
length = 6;
@@ -119,7 +132,10 @@ print_insn_moxie (bfd_vma addr, struct disassemble_info * info)
unsigned imm;
if ((status = info->read_memory_func (addr + 2, buffer, 4, info)))
goto fail;
- imm = bfd_getb32 (buffer);
+ if (info->endian == BFD_ENDIAN_BIG)
+ imm = bfd_getb32 (buffer);
+ else
+ imm = bfd_getl32 (buffer);
fpr (stream, "%s\t0x%x, %s",
opcode->name, imm, reg_names[OP_A(iword)]);
length = 6;
@@ -130,7 +146,10 @@ print_insn_moxie (bfd_vma addr, struct disassemble_info * info)
unsigned imm;
if ((status = info->read_memory_func (addr+2, buffer, 4, info)))
goto fail;
- imm = bfd_getb32 (buffer);
+ if (info->endian == BFD_ENDIAN_BIG)
+ imm = bfd_getb32 (buffer);
+ else
+ imm = bfd_getl32 (buffer);
fpr (stream, "%s\t0x%x(%s), %s", opcode->name,
imm,
reg_names[OP_A(iword)],
@@ -143,7 +162,10 @@ print_insn_moxie (bfd_vma addr, struct disassemble_info * info)
unsigned imm;
if ((status = info->read_memory_func (addr+2, buffer, 4, info)))
goto fail;
- imm = bfd_getb32 (buffer);
+ if (info->endian == BFD_ENDIAN_BIG)
+ imm = bfd_getb32 (buffer);
+ else
+ imm = bfd_getl32 (buffer);
fpr (stream, "%s\t%s, 0x%x(%s)",
opcode->name,
reg_names[OP_A(iword)],