From bffb60047d90919d8c3a11db9ae7e9f45553a657 Mon Sep 17 00:00:00 2001 From: Anthony Green Date: Sat, 27 Dec 2014 10:57:04 -0500 Subject: [PATCH] Limit moxie sto/ldo offsets to 16 bits --- gas/ChangeLog | 5 +++++ gas/config/tc-moxie.c | 16 ++++++++-------- include/opcode/ChangeLog | 5 +++++ include/opcode/moxie.h | 8 ++++---- opcodes/ChangeLog | 6 ++++++ opcodes/moxie-dis.c | 20 ++++++++++---------- opcodes/moxie-opc.c | 12 ++++++------ 7 files changed, 44 insertions(+), 28 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index ef7febf9885..b0d30b2aa00 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2014-12-27 Anthony Green PR gas/17753 diff --git a/gas/config/tc-moxie.c b/gas/config/tc-moxie.c index 02a59b7c708..fdd100c288f 100644 --- a/gas/config/tc-moxie.c +++ b/gas/config/tc-moxie.c @@ -404,7 +404,7 @@ md_assemble (char *str) iword += (a << 4); } break; - case MOXIE_F1_ABi4: + case MOXIE_F1_ABi2: iword = opcode->opcode << 8; while (ISSPACE (*op_end)) op_end++; @@ -426,13 +426,13 @@ md_assemble (char *str) op_end++; op_end = parse_exp_save_ilp (op_end, &arg); - offset = frag_more (4); + offset = frag_more (2); fix_new_exp (frag_now, (offset - frag_now->fr_literal), - 4, + 2, &arg, 0, - BFD_RELOC_32); + BFD_RELOC_16); if (*op_end != '(') { @@ -458,7 +458,7 @@ md_assemble (char *str) iword += (a << 4) + b; } break; - case MOXIE_F1_AiB4: + case MOXIE_F1_AiB2: iword = opcode->opcode << 8; while (ISSPACE (*op_end)) op_end++; @@ -468,13 +468,13 @@ md_assemble (char *str) int a, b; op_end = parse_exp_save_ilp (op_end, &arg); - offset = frag_more (4); + offset = frag_more (2); fix_new_exp (frag_now, (offset - frag_now->fr_literal), - 4, + 2, &arg, 0, - BFD_RELOC_32); + BFD_RELOC_16); if (*op_end != '(') { diff --git a/include/opcode/ChangeLog b/include/opcode/ChangeLog index a2248dc6bd6..85fe9ac5b27 100644 --- a/include/opcode/ChangeLog +++ b/include/opcode/ChangeLog @@ -1,3 +1,8 @@ +2014-12-27 Anthony Green + + * moxie.h (MOXIE_F1_AiB2, MOXIE_F1_ABi2): Renamed from + MOXIE_F1_AiB4 and MOXIE_F1_ABi2. + 2014-12-06 Eric Botcazou * visium.h: New file. diff --git a/include/opcode/moxie.h b/include/opcode/moxie.h index 6c5a0039718..f220e38f0a8 100644 --- a/include/opcode/moxie.h +++ b/include/opcode/moxie.h @@ -28,8 +28,8 @@ 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) - Some use B and an indirect A plus 4 bytes (MOXIE_F1_AiB4) - Some use A and an indirect B plus 4 bytes (MOXIE_F1_ABi4) + Some use B and an indirect A plus 2 byte offset (MOXIE_F1_AiB2) + Some use A and an indirect B plus 2 byte offset (MOXIE_F1_ABi2) Form 2 instructions also come in different flavors: @@ -50,8 +50,8 @@ #define MOXIE_F1_AiB 0x106 #define MOXIE_F1_ABi 0x107 #define MOXIE_F1_4A 0x108 -#define MOXIE_F1_AiB4 0x109 -#define MOXIE_F1_ABi4 0x10a +#define MOXIE_F1_AiB2 0x109 +#define MOXIE_F1_ABi2 0x10a #define MOXIE_F1_M 0x10b #define MOXIE_F2_NARG 0x200 diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 8de16f67e7f..dd302b2d3fa 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,9 @@ +2014-12-27 Anthony Green * moxie-opc: Define mul.x and umul.x instructions. Remove diff --git a/opcodes/moxie-dis.c b/opcodes/moxie-dis.c index 90e0464a18a..923dda10490 100644 --- a/opcodes/moxie-dis.c +++ b/opcodes/moxie-dis.c @@ -140,37 +140,37 @@ print_insn_moxie (bfd_vma addr, struct disassemble_info * info) length = 6; } break; - case MOXIE_F1_AiB4: + case MOXIE_F1_AiB2: { unsigned imm; - if ((status = info->read_memory_func (addr+2, buffer, 4, info))) + if ((status = info->read_memory_func (addr+2, buffer, 2, info))) goto fail; if (info->endian == BFD_ENDIAN_BIG) - imm = bfd_getb32 (buffer); + imm = bfd_getb16 (buffer); else - imm = bfd_getl32 (buffer); + imm = bfd_getl16 (buffer); fpr (stream, "%s\t0x%x(%s), %s", opcode->name, imm, reg_names[OP_A(iword)], reg_names[OP_B(iword)]); - length = 6; + length = 4; } break; - case MOXIE_F1_ABi4: + case MOXIE_F1_ABi2: { unsigned imm; - if ((status = info->read_memory_func (addr+2, buffer, 4, info))) + if ((status = info->read_memory_func (addr+2, buffer, 2, info))) goto fail; if (info->endian == BFD_ENDIAN_BIG) - imm = bfd_getb32 (buffer); + imm = bfd_getb16 (buffer); else - imm = bfd_getl32 (buffer); + imm = bfd_getl16 (buffer); fpr (stream, "%s\t%s, 0x%x(%s)", opcode->name, reg_names[OP_A(iword)], imm, reg_names[OP_B(iword)]); - length = 6; + length = 4; } break; case MOXIE_BAD: diff --git a/opcodes/moxie-opc.c b/opcodes/moxie-opc.c index a858088aa41..b3603c9c20b 100644 --- a/opcodes/moxie-opc.c +++ b/opcodes/moxie-opc.c @@ -64,8 +64,8 @@ const moxie_opc_info_t moxie_form1_opc_info[128] = { 0x09, MOXIE_F1_4A, "sta.l" }, { 0x0a, MOXIE_F1_ABi, "ld.l" }, { 0x0b, MOXIE_F1_AiB, "st.l" }, - { 0x0c, MOXIE_F1_ABi4, "ldo.l" }, - { 0x0d, MOXIE_F1_AiB4, "sto.l" }, + { 0x0c, MOXIE_F1_ABi2, "ldo.l" }, + { 0x0d, MOXIE_F1_AiB2, "sto.l" }, { 0x0e, MOXIE_F1_AB, "cmp" }, { 0x0f, MOXIE_F1_NARG, "nop" }, { 0x10, MOXIE_F1_AB, "sex.b" }, @@ -106,10 +106,10 @@ const moxie_opc_info_t moxie_form1_opc_info[128] = { 0x33, MOXIE_F1_AB, "mod" }, { 0x34, MOXIE_F1_AB, "umod" }, { 0x35, MOXIE_F1_NARG, "brk" }, - { 0x36, MOXIE_F1_ABi4, "ldo.b" }, - { 0x37, MOXIE_F1_AiB4, "sto.b" }, - { 0x38, MOXIE_F1_ABi4, "ldo.s" }, - { 0x39, MOXIE_F1_AiB4, "sto.s" }, + { 0x36, MOXIE_F1_ABi2, "ldo.b" }, + { 0x37, MOXIE_F1_AiB2, "sto.b" }, + { 0x38, MOXIE_F1_ABi2, "ldo.s" }, + { 0x39, MOXIE_F1_AiB2, "sto.s" }, { 0x3a, MOXIE_BAD, "bad" }, { 0x3b, MOXIE_BAD, "bad" }, { 0x3c, MOXIE_BAD, "bad" }, -- 2.30.2