Index: opcodes/moxie-dis.c |
diff --git a/opcodes/moxie-dis.c b/opcodes/moxie-dis.c |
index 79ef09916fa3e16a4a4072cf46aa409cb2472805..f726f21d68056a33d28de053e1b64389ec1dd693 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)], |
@@ -152,8 +174,11 @@ print_insn_moxie (bfd_vma addr, struct disassemble_info * info) |
length = 6; |
} |
break; |
+ case MOXIE_BAD: |
+ fpr (stream, "bad"); |
+ break; |
default: |
- abort (); |
+ abort(); |
} |
} |
else if ((iword & (1<<14)) == 0) |
@@ -171,6 +196,9 @@ print_insn_moxie (bfd_vma addr, struct disassemble_info * info) |
case MOXIE_F2_NARG: |
fpr (stream, "%s", opcode->name); |
break; |
+ case MOXIE_BAD: |
+ fpr (stream, "bad"); |
+ break; |
default: |
abort(); |
} |
@@ -183,9 +211,12 @@ print_insn_moxie (bfd_vma addr, struct disassemble_info * info) |
{ |
case MOXIE_F3_PCREL: |
fpr (stream, "%s\t", opcode->name); |
- info->print_address_func ((bfd_vma) (addr + INST2OFFSET(iword)), |
+ info->print_address_func ((bfd_vma) (addr + INST2OFFSET(iword) + 2), |
info); |
break; |
+ case MOXIE_BAD: |
+ fpr (stream, "bad"); |
+ break; |
default: |
abort(); |
} |