oops - toplevel changelog entry for previous delta.
[deliverable/binutils-gdb.git] / opcodes / ft32-dis.c
index 93339a1794a10c02e0c3c98e28317be87df42082..5f42fff4f514b36619a60b07f9c535b30c2bb6aa 100644 (file)
@@ -1,5 +1,5 @@
 /* Disassemble ft32 instructions.
-   Copyright (C) 2013-2017 Free Software Foundation, Inc.
+   Copyright (C) 2013-2020 Free Software Foundation, Inc.
    Contributed by FTDI (support@ftdichip.com)
 
    This file is part of the GNU opcodes library.
@@ -39,32 +39,31 @@ sign_extend(int bit, int value)
   return (value & (onebit - 1)) - (value & onebit);
 }
 
-int
-print_insn_ft32 (bfd_vma addr, struct disassemble_info *info)
+static void
+ft32_opcode(bfd_vma addr ATTRIBUTE_UNUSED,
+            unsigned int iword,
+            struct disassemble_info *info)
 {
-  int status;
-  stream = info->stream;
-  bfd_byte buffer[4];
-  unsigned int iword;
   const ft32_opc_info_t *oo;
 
-  fpr = info->fprintf_func;
-
-  if ((status = info->read_memory_func (addr, buffer, 4, info)))
-    goto fail;
-
-  iword = bfd_getl32 (buffer);
-
   for (oo = ft32_opc_info; oo->name; oo++)
     if ((iword & oo->mask) == oo->bits)
       break;
 
+  unsigned int sc[2];
+  if (ft32_decode_shortcode((unsigned int)addr, iword, sc))
+    {
+      ft32_opcode(addr, sc[0], info);
+      fpr (stream, " ; ");
+      ft32_opcode(addr, sc[1], info);
+    }
+
   if (oo->name)
     {
       int f = oo->fields;
       int imm;
 
-      fpr (stream, "%08x %s", iword, oo->name);
+      fpr (stream, "%s", oo->name);
       if (oo->dw)
         {
           fpr (stream, ".%c ", "bsl"[(iword >> FT32_FLD_DW_BIT) & 3]);
@@ -148,9 +147,9 @@ print_insn_ft32 (bfd_vma addr, struct disassemble_info *info)
                 imm = iword & ((1 << FT32_FLD_K16_SIZ) - 1);
                 fpr(stream, "%d", imm);
                 break;
-              case  FT32_FLD_K8:
-                imm = iword & ((1 << FT32_FLD_K8_SIZ) - 1);
-                fpr(stream, "%d", sign_extend(7, imm));
+              case  FT32_FLD_K15:
+                imm = iword & ((1 << FT32_FLD_K15_SIZ) - 1);
+                fpr(stream, "%d", sign_extend(14, imm));
                 break;
               case  FT32_FLD_R_D_POST:
                 fpr(stream, "$r%d", (iword >> FT32_FLD_R_D_BIT) & 0x1f);
@@ -171,8 +170,28 @@ print_insn_ft32 (bfd_vma addr, struct disassemble_info *info)
     }
     else
     {
-      fpr (stream, "%08x!", iword);
+      fpr (stream, "!");
     }
+}
+
+int
+print_insn_ft32 (bfd_vma addr, struct disassemble_info *info)
+{
+  int status;
+  stream = info->stream;
+  bfd_byte buffer[4];
+  unsigned int iword;
+
+  fpr = info->fprintf_func;
+
+  if ((status = info->read_memory_func (addr, buffer, 4, info)))
+    goto fail;
+
+  iword = bfd_getl32 (buffer);
+
+  fpr (stream, "%08x ", iword);
+
+  ft32_opcode(addr, iword, info);
 
   return 4;
 
This page took 0.025398 seconds and 4 git commands to generate.