summaryrefslogtreecommitdiff
path: root/opcodes/moxie-dis.c
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/moxie-dis.c
parentb9516fa158d68eedaa9e2191e38e7a1acfcfee77 (diff)
downloadbinutils-gdb-e202fa84e706abb043aed457473a764c76672297.tar.gz
Bi-endian patches for moxie
Diffstat (limited to 'opcodes/moxie-dis.c')
-rw-r--r--opcodes/moxie-dis.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/opcodes/moxie-dis.c b/opcodes/moxie-dis.c
index 79ef09916fa..77821bba780 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)],