Add unlink support to moxie simulator
[deliverable/binutils-gdb.git] / opcodes / tic54x-dis.c
index ba33d5e3c5f2f606daca63eba4140b27c3d7e9d9..d8b80a3bf7dbb45492e955ba14ba917650c5906f 100644 (file)
@@ -1,6 +1,5 @@
 /* Disassembly routines for TMS320C54X architecture
-   Copyright 1999, 2000, 2001, 2005, 2007, 2009, 2012
-   Free Software Foundation, Inc.
+   Copyright (C) 1999-2019 Free Software Foundation, Inc.
    Contributed by Timothy Wall (twall@cygnus.com)
 
    This file is part of the GNU opcodes library.
@@ -24,7 +23,7 @@
 #include <errno.h>
 #include <math.h>
 #include <stdlib.h>
-#include "dis-asm.h"
+#include "disassemble.h"
 #include "opcode/tic54x.h"
 #include "coff/tic54x.h"
 
@@ -168,14 +167,13 @@ get_insn_size (unsigned short memdata, const insn_template *insn)
 }
 
 int
-print_instruction (info, memaddr, opcode, tm_name, tm_operands, size, ext)
-  disassemble_info *info;
-  bfd_vma memaddr;
-  unsigned short opcode;
-  const char *tm_name;
-  const enum optype tm_operands[];
-  int size;
-  int ext;
+print_instruction (disassemble_info *info,
+                  bfd_vma memaddr,
+                  unsigned short opcode,
+                  const char *tm_name,
+                  const enum optype tm_operands[],
+                  int size,
+                  int ext)
 {
   static int n;
   /* string storage for multiple operands */
@@ -396,8 +394,7 @@ print_instruction (info, memaddr, opcode, tm_name, tm_operands, size, ext)
             break;
           }
         case OP_k5:
-          sprintf (operand[i], "#%d",
-                   (int) (((signed char) opcode & 0x1F) << 3) >> 3);
+          sprintf (operand[i], "#%d", ((opcode & 0x1F) ^ 0x10) - 0x10);
           info->fprintf_func (info->stream, "%s%s", comma, operand[i]);
           break;
         case OP_k8u:
@@ -469,12 +466,11 @@ print_instruction (info, memaddr, opcode, tm_name, tm_operands, size, ext)
 }
 
 static int
-print_parallel_instruction (info, memaddr, opcode, ptm, size)
-  disassemble_info *info;
-  bfd_vma memaddr;
-  unsigned short opcode;
-  const insn_template *ptm;
-  int size;
+print_parallel_instruction (disassemble_info *info,
+                           bfd_vma memaddr,
+                           unsigned short opcode,
+                           const insn_template *ptm,
+                           int size)
 {
   print_instruction (info, memaddr, opcode,
                      ptm->name, ptm->operand_types, size, 0);
@@ -484,10 +480,9 @@ print_parallel_instruction (info, memaddr, opcode, ptm, size)
 }
 
 static int
-sprint_dual_address (info, buf, code)
-  disassemble_info *info ATTRIBUTE_UNUSED;
-  char buf[];
-  unsigned short code;
+sprint_dual_address (disassemble_info *info ATTRIBUTE_UNUSED,
+                    char buf[],
+                    unsigned short code)
 {
   const char *formats[] = {
     "*ar%d",
@@ -499,10 +494,9 @@ sprint_dual_address (info, buf, code)
 }
 
 static int
-sprint_indirect_address (info, buf, opcode)
-  disassemble_info *info ATTRIBUTE_UNUSED;
-  char buf[];
-  unsigned short opcode;
+sprint_indirect_address (disassemble_info *info ATTRIBUTE_UNUSED,
+                        char buf[],
+                        unsigned short opcode)
 {
   const char *formats[] = {
     "*ar%d",
@@ -522,22 +516,20 @@ sprint_indirect_address (info, buf, opcode)
 }
 
 static int
-sprint_direct_address (info, buf, opcode)
-  disassemble_info *info ATTRIBUTE_UNUSED;
-  char buf[];
-  unsigned short opcode;
+sprint_direct_address (disassemble_info *info ATTRIBUTE_UNUSED,
+                      char buf[],
+                      unsigned short opcode)
 {
   /* FIXME -- look up relocation if available */
   return sprintf (buf, "DP+0x%02x", (int) (opcode & 0x7F));
 }
 
 static int
-sprint_mmr (info, buf, mmr)
-  disassemble_info *info ATTRIBUTE_UNUSED;
-  char buf[];
-  int mmr;
+sprint_mmr (disassemble_info *info ATTRIBUTE_UNUSED,
+           char buf[],
+           int mmr)
 {
-  symbol *reg = (symbol *) mmregs;
+  tic54x_symbol *reg = (tic54x_symbol *) mmregs;
   while (reg->name != NULL)
     {
       if (mmr == reg->value)
@@ -552,10 +544,9 @@ sprint_mmr (info, buf, mmr)
 }
 
 static int
-sprint_cc2 (info, buf, opcode)
-  disassemble_info *info ATTRIBUTE_UNUSED;
-  char *buf;
-  unsigned short opcode;
+sprint_cc2 (disassemble_info *info ATTRIBUTE_UNUSED,
+           char *buf,
+           unsigned short opcode)
 {
   const char *cc2[] = {
     "??", "??", "ageq", "alt", "aneq", "aeq", "agt", "aleq",
@@ -565,10 +556,9 @@ sprint_cc2 (info, buf, opcode)
 }
 
 static int
-sprint_condition (info, buf, opcode)
-  disassemble_info *info ATTRIBUTE_UNUSED;
-  char *buf;
-  unsigned short opcode;
+sprint_condition (disassemble_info *info ATTRIBUTE_UNUSED,
+                 char *buf,
+                 unsigned short opcode)
 {
   char *start = buf;
   const char *cmp[] = {
This page took 0.026005 seconds and 4 git commands to generate.