From 0e7c7f11f471e3350d50c08fda8e3ddf055940f2 Mon Sep 17 00:00:00 2001 From: Anthony Green Date: Sat, 6 Jun 2009 13:02:21 +0000 Subject: [PATCH] Print moxie addresses nicely. --- include/opcode/ChangeLog | 4 ++++ include/opcode/moxie.h | 2 ++ opcodes/ChangeLog | 5 +++++ opcodes/moxie-dis.c | 11 +++++++++++ opcodes/moxie-opc.c | 24 ++++++++++++------------ 5 files changed, 34 insertions(+), 12 deletions(-) diff --git a/include/opcode/ChangeLog b/include/opcode/ChangeLog index 0985425fbf..df8a7e6064 100644 --- a/include/opcode/ChangeLog +++ b/include/opcode/ChangeLog @@ -1,3 +1,7 @@ +2009-06-06 Anthony Green + + * moxie.h (MOXIE_F1_M): Define. + 2009-04-15 Anthony Green * moxie.h: Created. diff --git a/include/opcode/moxie.h b/include/opcode/moxie.h index c996fe584e..0035f5f757 100644 --- a/include/opcode/moxie.h +++ b/include/opcode/moxie.h @@ -24,6 +24,7 @@ Some use A and B registers (MOXIE_F1_AB) Some use A and consume a 4 byte immediate value (MOXIE_F1_A4) Some use just a 4 byte immediate value (MOXIE_F1_4) + Some use just a 4 byte memory address (MOXIE_F1_M) Some use B and an indirect A (MOXIE_F1_AiB) Some use A and an indirect B (MOXIE_F1_ABi) Some consume a 4 byte immediate value and use X (MOXIE_F1_4A) @@ -50,6 +51,7 @@ #define MOXIE_F1_4A 0x108 #define MOXIE_F1_AiB4 0x109 #define MOXIE_F1_ABi4 0x10a +#define MOXIE_F1_M 0x10b #define MOXIE_F2_NARG 0x200 #define MOXIE_F2_A8V 0x201 diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 7b8e100d5f..8333e32821 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,8 @@ +2009-06-06 Anthony Green + + * moxie-opc.c: Recode some MOXIE_F1_4 opcodes as MOXIE_F1_M. + * moxie-dis.c (print_insn_moxie): Handle MOXIE_F1_M case. + 2009-06-04 Alan Modra * dep-in.sed: Don't use \n in replacement part of s command. diff --git a/opcodes/moxie-dis.c b/opcodes/moxie-dis.c index b1d123f5a4..d63eb2db45 100644 --- a/opcodes/moxie-dis.c +++ b/opcodes/moxie-dis.c @@ -93,6 +93,17 @@ print_insn_moxie (bfd_vma addr, struct disassemble_info * info) length = 6; } break; + case MOXIE_F1_M: + { + unsigned imm; + if ((status = info->read_memory_func (addr + 2, buffer, 4, info))) + goto fail; + imm = bfd_getb32 (buffer); + fpr (stream, "%s\t", opcode->name); + info->print_address_func ((bfd_vma) imm, info); + length = 6; + } + break; case MOXIE_F1_AiB: fpr (stream, "%s\t(%s), %s", opcode->name, reg_names[OP_A(iword)], reg_names[OP_B(iword)]); diff --git a/opcodes/moxie-opc.c b/opcodes/moxie-opc.c index 559cd115e8..7275e3aa79 100644 --- a/opcodes/moxie-opc.c +++ b/opcodes/moxie-opc.c @@ -55,7 +55,7 @@ const moxie_opc_info_t moxie_form1_opc_info[64] = { 0x00, MOXIE_F1_NARG, "nop" }, { 0x01, MOXIE_F1_A4, "ldi.l" }, { 0x02, MOXIE_F1_AB, "mov" }, - { 0x03, MOXIE_F1_4, "jsra" }, + { 0x03, MOXIE_F1_M, "jsra" }, { 0x04, MOXIE_F1_NARG, "ret" }, { 0x05, MOXIE_F1_AB, "add.l" }, { 0x06, MOXIE_F1_AB, "push" }, @@ -67,18 +67,18 @@ const moxie_opc_info_t moxie_form1_opc_info[64] = { 0x0c, MOXIE_F1_ABi4, "ldo.l" }, { 0x0d, MOXIE_F1_AiB4, "sto.l" }, { 0x0e, MOXIE_F1_AB, "cmp" }, - { 0x0f, MOXIE_F1_4, "beq" }, - { 0x10, MOXIE_F1_4, "bne" }, - { 0x11, MOXIE_F1_4, "blt" }, - { 0x12, MOXIE_F1_4, "bgt" }, - { 0x13, MOXIE_F1_4, "bltu" }, - { 0x14, MOXIE_F1_4, "bgtu" }, - { 0x15, MOXIE_F1_4, "bge" }, - { 0x16, MOXIE_F1_4, "ble" }, - { 0x17, MOXIE_F1_4, "bgeu" }, - { 0x18, MOXIE_F1_4, "bleu" }, + { 0x0f, MOXIE_F1_M, "beq" }, + { 0x10, MOXIE_F1_M, "bne" }, + { 0x11, MOXIE_F1_M, "blt" }, + { 0x12, MOXIE_F1_M, "bgt" }, + { 0x13, MOXIE_F1_M, "bltu" }, + { 0x14, MOXIE_F1_M, "bgtu" }, + { 0x15, MOXIE_F1_M, "bge" }, + { 0x16, MOXIE_F1_M, "ble" }, + { 0x17, MOXIE_F1_M, "bgeu" }, + { 0x18, MOXIE_F1_M, "bleu" }, { 0x19, MOXIE_F1_A, "jsr" }, - { 0x1a, MOXIE_F1_4, "jmpa" }, + { 0x1a, MOXIE_F1_M, "jmpa" }, { 0x1b, MOXIE_F1_A4, "ldi.b" }, { 0x1c, MOXIE_F1_ABi, "ld.b" }, { 0x1d, MOXIE_F1_A4, "lda.b" }, -- 2.34.1