aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorAnthony Green <green@redhat.com>2009-06-11 11:27:58 +0000
committerAnthony Green <green@redhat.com>2009-06-11 11:27:58 +0000
commitf865a31d1ed571ccb8d17653b150e3a30f22b30d (patch)
tree53213b9fa3500e9762839a2a15d4447b6e7c04cc /opcodes
parent1372b818548793632310cb702930171c849f62db (diff)
downloadgdb-f865a31d1ed571ccb8d17653b150e3a30f22b30d.zip
gdb-f865a31d1ed571ccb8d17653b150e3a30f22b30d.tar.gz
gdb-f865a31d1ed571ccb8d17653b150e3a30f22b30d.tar.bz2
Add PC-relative branch instructions to moxie port.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog7
-rw-r--r--opcodes/moxie-dis.c9
-rw-r--r--opcodes/moxie-opc.c49
3 files changed, 44 insertions, 21 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 8333e32..1bb84a9 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,10 @@
+2009-06-11 Anthony Green <green@moxielogic.com>
+
+ * moxie-opc.c (moxie_form1_opc_info): Remove branch instructions.
+ (moxie_form3_opc_info): Add branch instructions.
+ * moxie-dis.c (print_insn_moxie): Disassemble MOXIE_F3_PCREL
+ encoded instructions.
+
2009-06-06 Anthony Green <green@moxielogic.com>
* moxie-opc.c: Recode some MOXIE_F1_4 opcodes as MOXIE_F1_M.
diff --git a/opcodes/moxie-dis.c b/opcodes/moxie-dis.c
index d63eb2d..4e67e2c 100644
--- a/opcodes/moxie-dis.c
+++ b/opcodes/moxie-dis.c
@@ -33,6 +33,7 @@ static void *stream;
/* Macros to extract operands from the instruction word. */
#define OP_A(i) ((i >> 4) & 0xf)
#define OP_B(i) (i & 0xf)
+#define INST2OFFSET(o) ((((signed short)((o & ((1<<10)-1))<<6))>>6)<<1)
static const char * reg_names[16] =
{ "$fp", "$sp", "$r0", "$r1", "$r2", "$r3", "$r4", "$r5",
@@ -176,11 +177,13 @@ print_insn_moxie (bfd_vma addr, struct disassemble_info * info)
else
{
/* Extract the Form 3 opcode. */
- opcode = &moxie_form2_opc_info[(iword >> 12) & 3];
+ opcode = &moxie_form3_opc_info[(iword >> 10) & 15];
switch (opcode->itype)
{
- case MOXIE_F3_NARG:
- fpr (stream, "%s", opcode->name);
+ case MOXIE_F3_PCREL:
+ fpr (stream, "%s\t", opcode->name);
+ info->print_address_func ((bfd_vma) (addr + INST2OFFSET(iword)),
+ info);
break;
default:
abort();
diff --git a/opcodes/moxie-opc.c b/opcodes/moxie-opc.c
index 7275e3a..8194760 100644
--- a/opcodes/moxie-opc.c
+++ b/opcodes/moxie-opc.c
@@ -44,11 +44,11 @@
FORM 3 instructions start with a bits "11"...
- 11oovvvvvvvvvvvv
+ 11oooovvvvvvvvvv
0 F
- oo - form 3 opcode number
- vvvvvvvvvvvv - 12-bit immediate value. */
+ oooo - form 3 opcode number
+ vvvvvvvvvv - 10-bit immediate value. */
const moxie_opc_info_t moxie_form1_opc_info[64] =
{
@@ -67,16 +67,16 @@ 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_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" },
+ { 0x0f, MOXIE_F1_NARG, "bad" },
+ { 0x10, MOXIE_F1_NARG, "bad" },
+ { 0x11, MOXIE_F1_NARG, "bad" },
+ { 0x12, MOXIE_F1_NARG, "bad" },
+ { 0x13, MOXIE_F1_NARG, "bad" },
+ { 0x14, MOXIE_F1_NARG, "bad" },
+ { 0x15, MOXIE_F1_NARG, "bad" },
+ { 0x16, MOXIE_F1_NARG, "bad" },
+ { 0x17, MOXIE_F1_NARG, "bad" },
+ { 0x18, MOXIE_F1_NARG, "bad" },
{ 0x19, MOXIE_F1_A, "jsr" },
{ 0x1a, MOXIE_F1_M, "jmpa" },
{ 0x1b, MOXIE_F1_A4, "ldi.b" },
@@ -126,11 +126,24 @@ const moxie_opc_info_t moxie_form2_opc_info[4] =
{ 0x03, MOXIE_F2_A8V, "ssr" }
};
-const moxie_opc_info_t moxie_form3_opc_info[4] =
+const moxie_opc_info_t moxie_form3_opc_info[16] =
{
- { 0x00, MOXIE_F2_NARG, "bad" },
- { 0x01, MOXIE_F2_NARG, "bad" },
- { 0x02, MOXIE_F2_NARG, "bad" },
- { 0x03, MOXIE_F2_NARG, "bad" }
+ { 0x00, MOXIE_F3_PCREL,"beq" },
+ { 0x01, MOXIE_F3_PCREL,"bne" },
+ { 0x02, MOXIE_F3_PCREL,"blt" },
+ { 0x03, MOXIE_F3_PCREL,"bgt" },
+ { 0x04, MOXIE_F3_PCREL,"bltu" },
+ { 0x05, MOXIE_F3_PCREL,"bgtu" },
+ { 0x06, MOXIE_F3_PCREL,"bge" },
+ { 0x07, MOXIE_F3_PCREL,"ble" },
+ { 0x08, MOXIE_F3_PCREL,"bgeu" },
+ { 0x09, MOXIE_F3_PCREL,"bleu" },
+ { 0x0a, MOXIE_F3_NARG, "bad" },
+ { 0x0b, MOXIE_F3_NARG, "bad" },
+ { 0x0c, MOXIE_F3_NARG, "bad" },
+ { 0x0d, MOXIE_F3_NARG, "bad" },
+ { 0x0e, MOXIE_F3_NARG, "bad" },
+ { 0x0f, MOXIE_F3_NARG, "bad" }
};
+