OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [binutils-2.18.50/] [opcodes/] [score-dis.c] - Diff between revs 156 and 816

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 156 Rev 816
/* Instruction printing code for Score
/* Instruction printing code for Score
   Copyright 2006, 2007 Free Software Foundation, Inc.
   Copyright 2006, 2007 Free Software Foundation, Inc.
   Contributed by:
   Contributed by:
   Mei Ligang (ligang@sunnorth.com.cn)
   Mei Ligang (ligang@sunnorth.com.cn)
   Pei-Lin Tsai (pltsai@sunplus.com)
   Pei-Lin Tsai (pltsai@sunplus.com)
 
 
   This file is part of the GNU opcodes library.
   This file is part of the GNU opcodes library.
 
 
   This library is free software; you can redistribute it and/or modify
   This library is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3, or (at your option)
   the Free Software Foundation; either version 3, or (at your option)
   any later version.
   any later version.
 
 
   It is distributed in the hope that it will be useful, but WITHOUT
   It is distributed in the hope that it will be useful, but WITHOUT
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
   License for more details.
   License for more details.
 
 
   You should have received a copy of the GNU General Public License
   You should have received a copy of the GNU General Public License
   along with this file; see the file COPYING.  If not, write to the
   along with this file; see the file COPYING.  If not, write to the
   Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston,
   Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston,
   MA 02110-1301, USA.  */
   MA 02110-1301, USA.  */
 
 
#include "sysdep.h"
#include "sysdep.h"
#include "dis-asm.h"
#include "dis-asm.h"
#define DEFINE_TABLE
#define DEFINE_TABLE
#include "score-opc.h"
#include "score-opc.h"
#include "opintl.h"
#include "opintl.h"
#include "bfd.h"
#include "bfd.h"
 
 
/* FIXME: This shouldn't be done here.  */
/* FIXME: This shouldn't be done here.  */
#include "elf-bfd.h"
#include "elf-bfd.h"
#include "elf/internal.h"
#include "elf/internal.h"
#include "elf/score.h"
#include "elf/score.h"
 
 
#ifndef streq
#ifndef streq
#define streq(a,b)      (strcmp ((a), (b)) == 0)
#define streq(a,b)      (strcmp ((a), (b)) == 0)
#endif
#endif
 
 
#ifndef strneq
#ifndef strneq
#define strneq(a,b,n)   (strncmp ((a), (b), (n)) == 0)
#define strneq(a,b,n)   (strncmp ((a), (b), (n)) == 0)
#endif
#endif
 
 
#ifndef NUM_ELEM
#ifndef NUM_ELEM
#define NUM_ELEM(a)     (sizeof (a) / sizeof (a)[0])
#define NUM_ELEM(a)     (sizeof (a) / sizeof (a)[0])
#endif
#endif
 
 
typedef struct
typedef struct
{
{
  const char *name;
  const char *name;
  const char *description;
  const char *description;
  const char *reg_names[32];
  const char *reg_names[32];
} score_regname;
} score_regname;
 
 
static score_regname regnames[] =
static score_regname regnames[] =
{
{
  {"gcc", "Select register names used by GCC",
  {"gcc", "Select register names used by GCC",
  {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",
  {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",
   "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", "r20",
   "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", "r20",
   "r21", "r22", "r23", "r24", "r25", "r26", "r27", "gp", "r29", "r30", "r31"}},
   "r21", "r22", "r23", "r24", "r25", "r26", "r27", "gp", "r29", "r30", "r31"}},
};
};
 
 
static unsigned int regname_selected = 0;
static unsigned int regname_selected = 0;
 
 
#define NUM_SCORE_REGNAMES  NUM_ELEM (regnames)
#define NUM_SCORE_REGNAMES  NUM_ELEM (regnames)
#define score_regnames      regnames[regname_selected].reg_names
#define score_regnames      regnames[regname_selected].reg_names
 
 
/* Print one instruction from PC on INFO->STREAM.
/* Print one instruction from PC on INFO->STREAM.
   Return the size of the instruction.  */
   Return the size of the instruction.  */
static int
static int
print_insn_score32 (bfd_vma pc, struct disassemble_info *info, long given)
print_insn_score32 (bfd_vma pc, struct disassemble_info *info, long given)
{
{
  struct score_opcode *insn;
  struct score_opcode *insn;
  void *stream = info->stream;
  void *stream = info->stream;
  fprintf_ftype func = info->fprintf_func;
  fprintf_ftype func = info->fprintf_func;
 
 
  for (insn = score_opcodes; insn->assembler; insn++)
  for (insn = score_opcodes; insn->assembler; insn++)
    {
    {
      if ((insn->mask & 0xffff0000) && (given & insn->mask) == insn->value)
      if ((insn->mask & 0xffff0000) && (given & insn->mask) == insn->value)
        {
        {
          char *c;
          char *c;
 
 
          for (c = insn->assembler; *c; c++)
          for (c = insn->assembler; *c; c++)
            {
            {
              if (*c == '%')
              if (*c == '%')
                {
                {
                  switch (*++c)
                  switch (*++c)
                    {
                    {
                    case 'j':
                    case 'j':
                      {
                      {
                        int target;
                        int target;
 
 
                        if (info->flags & INSN_HAS_RELOC)
                        if (info->flags & INSN_HAS_RELOC)
                          pc = 0;
                          pc = 0;
                        target = (pc & 0xfe000000) | (given & 0x01fffffe);
                        target = (pc & 0xfe000000) | (given & 0x01fffffe);
                        (*info->print_address_func) (target, info);
                        (*info->print_address_func) (target, info);
                      }
                      }
                      break;
                      break;
                    case 'b':
                    case 'b':
                      {
                      {
                        /* Sign-extend a 20-bit number.  */
                        /* Sign-extend a 20-bit number.  */
#define SEXT20(x)       ((((x) & 0xfffff) ^ (~ 0x7ffff)) + 0x80000)
#define SEXT20(x)       ((((x) & 0xfffff) ^ (~ 0x7ffff)) + 0x80000)
                        int disp = ((given & 0x01ff8000) >> 5) | (given & 0x3fe);
                        int disp = ((given & 0x01ff8000) >> 5) | (given & 0x3fe);
                        int target = (pc + SEXT20 (disp));
                        int target = (pc + SEXT20 (disp));
 
 
                        (*info->print_address_func) (target, info);
                        (*info->print_address_func) (target, info);
                      }
                      }
                      break;
                      break;
                    case '0':
                    case '0':
                    case '1':
                    case '1':
                    case '2':
                    case '2':
                    case '3':
                    case '3':
                    case '4':
                    case '4':
                    case '5':
                    case '5':
                    case '6':
                    case '6':
                    case '7':
                    case '7':
                    case '8':
                    case '8':
                    case '9':
                    case '9':
                      {
                      {
                        int bitstart = *c++ - '0';
                        int bitstart = *c++ - '0';
                        int bitend = 0;
                        int bitend = 0;
 
 
                        while (*c >= '0' && *c <= '9')
                        while (*c >= '0' && *c <= '9')
                          bitstart = (bitstart * 10) + *c++ - '0';
                          bitstart = (bitstart * 10) + *c++ - '0';
 
 
                        switch (*c)
                        switch (*c)
                          {
                          {
                          case '-':
                          case '-':
                            c++;
                            c++;
                            while (*c >= '0' && *c <= '9')
                            while (*c >= '0' && *c <= '9')
                              bitend = (bitend * 10) + *c++ - '0';
                              bitend = (bitend * 10) + *c++ - '0';
 
 
                            if (!bitend)
                            if (!bitend)
                              abort ();
                              abort ();
 
 
                            switch (*c)
                            switch (*c)
                              {
                              {
                              case 'r':
                              case 'r':
                                {
                                {
                                  long reg;
                                  long reg;
 
 
                                  reg = given >> bitstart;
                                  reg = given >> bitstart;
                                  reg &= (2 << (bitend - bitstart)) - 1;
                                  reg &= (2 << (bitend - bitstart)) - 1;
 
 
                                  func (stream, "%s", score_regnames[reg]);
                                  func (stream, "%s", score_regnames[reg]);
                                }
                                }
                                break;
                                break;
                              case 'd':
                              case 'd':
                                {
                                {
                                  long reg;
                                  long reg;
 
 
                                  reg = given >> bitstart;
                                  reg = given >> bitstart;
                                  reg &= (2 << (bitend - bitstart)) - 1;
                                  reg &= (2 << (bitend - bitstart)) - 1;
 
 
                                  func (stream, "%ld", reg);
                                  func (stream, "%ld", reg);
                                }
                                }
                                break;
                                break;
                              case 'i':
                              case 'i':
                                {
                                {
                                  long reg;
                                  long reg;
 
 
                                  reg = given >> bitstart;
                                  reg = given >> bitstart;
                                  reg &= (2 << (bitend - bitstart)) - 1;
                                  reg &= (2 << (bitend - bitstart)) - 1;
                                  reg = ((reg ^ (1 << (bitend - bitstart))) -
                                  reg = ((reg ^ (1 << (bitend - bitstart))) -
                                        (1 << (bitend - bitstart)));
                                        (1 << (bitend - bitstart)));
 
 
                                  if (((given & insn->mask) == 0x0c00000a)      /* ldc1  */
                                  if (((given & insn->mask) == 0x0c00000a)      /* ldc1  */
                                      || ((given & insn->mask) == 0x0c000012)   /* ldc2  */
                                      || ((given & insn->mask) == 0x0c000012)   /* ldc2  */
                                      || ((given & insn->mask) == 0x0c00001c)   /* ldc3  */
                                      || ((given & insn->mask) == 0x0c00001c)   /* ldc3  */
                                      || ((given & insn->mask) == 0x0c00000b)   /* stc1  */
                                      || ((given & insn->mask) == 0x0c00000b)   /* stc1  */
                                      || ((given & insn->mask) == 0x0c000013)   /* stc2  */
                                      || ((given & insn->mask) == 0x0c000013)   /* stc2  */
                                      || ((given & insn->mask) == 0x0c00001b))  /* stc3  */
                                      || ((given & insn->mask) == 0x0c00001b))  /* stc3  */
                                    reg <<= 2;
                                    reg <<= 2;
 
 
                                  func (stream, "%ld", reg);
                                  func (stream, "%ld", reg);
                                }
                                }
                                break;
                                break;
                              case 'x':
                              case 'x':
                                {
                                {
                                  long reg;
                                  long reg;
 
 
                                  reg = given >> bitstart;
                                  reg = given >> bitstart;
                                  reg &= (2 << (bitend - bitstart)) - 1;
                                  reg &= (2 << (bitend - bitstart)) - 1;
 
 
                                  func (stream, "%lx", reg);
                                  func (stream, "%lx", reg);
                                }
                                }
                                break;
                                break;
                              default:
                              default:
                                abort ();
                                abort ();
                              }
                              }
                            break;
                            break;
                          case '`':
                          case '`':
                            c++;
                            c++;
                            if ((given & (1 << bitstart)) == 0)
                            if ((given & (1 << bitstart)) == 0)
                              func (stream, "%c", *c);
                              func (stream, "%c", *c);
                            break;
                            break;
                          case '\'':
                          case '\'':
                            c++;
                            c++;
                            if ((given & (1 << bitstart)) != 0)
                            if ((given & (1 << bitstart)) != 0)
                              func (stream, "%c", *c);
                              func (stream, "%c", *c);
                            break;
                            break;
                          default:
                          default:
                            abort ();
                            abort ();
                          }
                          }
                        break;
                        break;
 
 
                    default:
                    default:
                        abort ();
                        abort ();
                      }
                      }
                    }
                    }
                }
                }
              else
              else
                func (stream, "%c", *c);
                func (stream, "%c", *c);
            }
            }
          return 4;
          return 4;
        }
        }
    }
    }
 
 
#if (SCORE_SIMULATOR_ACTIVE)
#if (SCORE_SIMULATOR_ACTIVE)
  func (stream, _("<illegal instruction>"));
  func (stream, _("<illegal instruction>"));
  return 4;
  return 4;
#endif
#endif
 
 
  abort ();
  abort ();
}
}
 
 
static void
static void
print_insn_parallel_sym (struct disassemble_info *info)
print_insn_parallel_sym (struct disassemble_info *info)
{
{
  void *stream = info->stream;
  void *stream = info->stream;
  fprintf_ftype func = info->fprintf_func;
  fprintf_ftype func = info->fprintf_func;
 
 
  /* 10:       0000            nop!
  /* 10:       0000            nop!
     4 space + 1 colon + 1 space + 1 tab + 8 opcode + 2 space + 1 tab.
     4 space + 1 colon + 1 space + 1 tab + 8 opcode + 2 space + 1 tab.
     FIXME: the space number is not accurate.  */
     FIXME: the space number is not accurate.  */
  func (stream, "%s", " ||\n      \t          \t");
  func (stream, "%s", " ||\n      \t          \t");
}
}
 
 
/* Print one instruction from PC on INFO->STREAM.
/* Print one instruction from PC on INFO->STREAM.
   Return the size of the instruction.  */
   Return the size of the instruction.  */
static int
static int
print_insn_score16 (bfd_vma pc, struct disassemble_info *info, long given)
print_insn_score16 (bfd_vma pc, struct disassemble_info *info, long given)
{
{
  struct score_opcode *insn;
  struct score_opcode *insn;
  void *stream = info->stream;
  void *stream = info->stream;
  fprintf_ftype func = info->fprintf_func;
  fprintf_ftype func = info->fprintf_func;
 
 
  given &= 0xffff;
  given &= 0xffff;
  for (insn = score_opcodes; insn->assembler; insn++)
  for (insn = score_opcodes; insn->assembler; insn++)
    {
    {
      if (!(insn->mask & 0xffff0000) && (given & insn->mask) == insn->value)
      if (!(insn->mask & 0xffff0000) && (given & insn->mask) == insn->value)
        {
        {
          char *c = insn->assembler;
          char *c = insn->assembler;
 
 
          info->bytes_per_chunk = 2;
          info->bytes_per_chunk = 2;
          info->bytes_per_line = 4;
          info->bytes_per_line = 4;
          given &= 0xffff;
          given &= 0xffff;
 
 
          for (; *c; c++)
          for (; *c; c++)
            {
            {
              if (*c == '%')
              if (*c == '%')
                {
                {
                  switch (*++c)
                  switch (*++c)
                    {
                    {
 
 
                    case 'j':
                    case 'j':
                      {
                      {
                        int target;
                        int target;
 
 
                        if (info->flags & INSN_HAS_RELOC)
                        if (info->flags & INSN_HAS_RELOC)
                          pc = 0;
                          pc = 0;
 
 
                        target = (pc & 0xfffff000) | (given & 0x00000ffe);
                        target = (pc & 0xfffff000) | (given & 0x00000ffe);
                        (*info->print_address_func) (target, info);
                        (*info->print_address_func) (target, info);
                      }
                      }
                      break;
                      break;
                    case 'b':
                    case 'b':
                      {
                      {
                        /* Sign-extend a 9-bit number.  */
                        /* Sign-extend a 9-bit number.  */
#define SEXT9(x)           ((((x) & 0x1ff) ^ (~ 0xff)) + 0x100)
#define SEXT9(x)           ((((x) & 0x1ff) ^ (~ 0xff)) + 0x100)
                        int disp = (given & 0xff) << 1;
                        int disp = (given & 0xff) << 1;
                        int target = (pc + SEXT9 (disp));
                        int target = (pc + SEXT9 (disp));
 
 
                        (*info->print_address_func) (target, info);
                        (*info->print_address_func) (target, info);
                      }
                      }
                      break;
                      break;
 
 
                    case '0':
                    case '0':
                    case '1':
                    case '1':
                    case '2':
                    case '2':
                    case '3':
                    case '3':
                    case '4':
                    case '4':
                    case '5':
                    case '5':
                    case '6':
                    case '6':
                    case '7':
                    case '7':
                    case '8':
                    case '8':
                    case '9':
                    case '9':
                      {
                      {
                        int bitstart = *c++ - '0';
                        int bitstart = *c++ - '0';
                        int bitend = 0;
                        int bitend = 0;
 
 
                        while (*c >= '0' && *c <= '9')
                        while (*c >= '0' && *c <= '9')
                          bitstart = (bitstart * 10) + *c++ - '0';
                          bitstart = (bitstart * 10) + *c++ - '0';
 
 
                        switch (*c)
                        switch (*c)
                          {
                          {
                          case '-':
                          case '-':
                            {
                            {
                              long reg;
                              long reg;
 
 
                              c++;
                              c++;
                              while (*c >= '0' && *c <= '9')
                              while (*c >= '0' && *c <= '9')
                                bitend = (bitend * 10) + *c++ - '0';
                                bitend = (bitend * 10) + *c++ - '0';
                              if (!bitend)
                              if (!bitend)
                                abort ();
                                abort ();
                              reg = given >> bitstart;
                              reg = given >> bitstart;
                              reg &= (2 << (bitend - bitstart)) - 1;
                              reg &= (2 << (bitend - bitstart)) - 1;
                              switch (*c)
                              switch (*c)
                                {
                                {
                                case 'R':
                                case 'R':
                                  func (stream, "%s", score_regnames[reg + 16]);
                                  func (stream, "%s", score_regnames[reg + 16]);
                                  break;
                                  break;
                                case 'r':
                                case 'r':
                                  func (stream, "%s", score_regnames[reg]);
                                  func (stream, "%s", score_regnames[reg]);
                                  break;
                                  break;
                                case 'd':
                                case 'd':
                                  if (*(c + 1) == '\0')
                                  if (*(c + 1) == '\0')
                                    func (stream, "%ld", reg);
                                    func (stream, "%ld", reg);
                                  else
                                  else
                                    {
                                    {
                                      c++;
                                      c++;
                                      if (*c == '1')
                                      if (*c == '1')
                                        func (stream, "%ld", reg << 1);
                                        func (stream, "%ld", reg << 1);
                                      else if (*c == '2')
                                      else if (*c == '2')
                                        func (stream, "%ld", reg << 2);
                                        func (stream, "%ld", reg << 2);
                                    }
                                    }
                                  break;
                                  break;
 
 
                                case 'x':
                                case 'x':
                                  if (*(c + 1) == '\0')
                                  if (*(c + 1) == '\0')
                                    func (stream, "%lx", reg);
                                    func (stream, "%lx", reg);
                                  else
                                  else
                                    {
                                    {
                                      c++;
                                      c++;
                                      if (*c == '1')
                                      if (*c == '1')
                                        func (stream, "%lx", reg << 1);
                                        func (stream, "%lx", reg << 1);
                                      else if (*c == '2')
                                      else if (*c == '2')
                                        func (stream, "%lx", reg << 2);
                                        func (stream, "%lx", reg << 2);
                                    }
                                    }
                                  break;
                                  break;
                                case 'i':
                                case 'i':
                                  reg = ((reg ^ (1 << bitend)) - (1 << bitend));
                                  reg = ((reg ^ (1 << bitend)) - (1 << bitend));
                                  func (stream, "%ld", reg);
                                  func (stream, "%ld", reg);
                                  break;
                                  break;
                                default:
                                default:
                                  abort ();
                                  abort ();
                                }
                                }
                            }
                            }
                            break;
                            break;
 
 
                          case '\'':
                          case '\'':
                            c++;
                            c++;
                            if ((given & (1 << bitstart)) != 0)
                            if ((given & (1 << bitstart)) != 0)
                              func (stream, "%c", *c);
                              func (stream, "%c", *c);
                            break;
                            break;
                          default:
                          default:
                            abort ();
                            abort ();
                          }
                          }
                      }
                      }
                      break;
                      break;
                    default:
                    default:
                      abort ();
                      abort ();
                    }
                    }
                }
                }
              else
              else
                func (stream, "%c", *c);
                func (stream, "%c", *c);
            }
            }
 
 
          return 2;
          return 2;
        }
        }
    }
    }
#if (SCORE_SIMULATOR_ACTIVE)
#if (SCORE_SIMULATOR_ACTIVE)
  func (stream, _("<illegal instruction>"));
  func (stream, _("<illegal instruction>"));
  return 2;
  return 2;
#endif
#endif
  /* No match.  */
  /* No match.  */
  abort ();
  abort ();
}
}
 
 
/* NOTE: There are no checks in these routines that
/* NOTE: There are no checks in these routines that
   the relevant number of data bytes exist.  */
   the relevant number of data bytes exist.  */
static int
static int
print_insn (bfd_vma pc, struct disassemble_info *info, bfd_boolean little)
print_insn (bfd_vma pc, struct disassemble_info *info, bfd_boolean little)
{
{
  unsigned char b[4];
  unsigned char b[4];
  long given;
  long given;
  long ridparity;
  long ridparity;
  int status;
  int status;
  bfd_boolean insn_pce_p = FALSE;
  bfd_boolean insn_pce_p = FALSE;
  bfd_boolean insn_16_p = FALSE;
  bfd_boolean insn_16_p = FALSE;
 
 
  info->display_endian = little ? BFD_ENDIAN_LITTLE : BFD_ENDIAN_BIG;
  info->display_endian = little ? BFD_ENDIAN_LITTLE : BFD_ENDIAN_BIG;
 
 
  if (pc & 0x2)
  if (pc & 0x2)
    {
    {
      info->bytes_per_chunk = 2;
      info->bytes_per_chunk = 2;
      status = info->read_memory_func (pc, (bfd_byte *) b, 2, info);
      status = info->read_memory_func (pc, (bfd_byte *) b, 2, info);
      b[3] = b[2] = 0;
      b[3] = b[2] = 0;
      insn_16_p = TRUE;
      insn_16_p = TRUE;
    }
    }
  else
  else
    {
    {
      info->bytes_per_chunk = 4;
      info->bytes_per_chunk = 4;
      status = info->read_memory_func (pc, (bfd_byte *) & b[0], 4, info);
      status = info->read_memory_func (pc, (bfd_byte *) & b[0], 4, info);
      if (status != 0)
      if (status != 0)
        {
        {
          info->bytes_per_chunk = 2;
          info->bytes_per_chunk = 2;
          status = info->read_memory_func (pc, (bfd_byte *) b, 2, info);
          status = info->read_memory_func (pc, (bfd_byte *) b, 2, info);
          b[3] = b[2] = 0;
          b[3] = b[2] = 0;
          insn_16_p = TRUE;
          insn_16_p = TRUE;
        }
        }
    }
    }
 
 
  if (status != 0)
  if (status != 0)
    {
    {
      info->memory_error_func (status, pc, info);
      info->memory_error_func (status, pc, info);
      return -1;
      return -1;
    }
    }
 
 
  if (little)
  if (little)
    {
    {
      given = (b[0]) | (b[1] << 8) | (b[2] << 16) | (b[3] << 24);
      given = (b[0]) | (b[1] << 8) | (b[2] << 16) | (b[3] << 24);
    }
    }
  else
  else
    {
    {
      given = (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | (b[3]);
      given = (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | (b[3]);
    }
    }
 
 
  if ((given & 0x80008000) == 0x80008000)
  if ((given & 0x80008000) == 0x80008000)
    {
    {
      insn_pce_p = FALSE;
      insn_pce_p = FALSE;
      insn_16_p = FALSE;
      insn_16_p = FALSE;
    }
    }
  else if ((given & 0x8000) == 0x8000)
  else if ((given & 0x8000) == 0x8000)
    {
    {
      insn_pce_p = TRUE;
      insn_pce_p = TRUE;
    }
    }
  else
  else
    {
    {
      insn_16_p = TRUE;
      insn_16_p = TRUE;
    }
    }
 
 
  /* 16 bit instruction.  */
  /* 16 bit instruction.  */
  if (insn_16_p)
  if (insn_16_p)
    {
    {
      if (little)
      if (little)
        {
        {
          given = b[0] | (b[1] << 8);
          given = b[0] | (b[1] << 8);
        }
        }
      else
      else
        {
        {
          given = (b[0] << 8) | b[1];
          given = (b[0] << 8) | b[1];
        }
        }
 
 
      status = print_insn_score16 (pc, info, given);
      status = print_insn_score16 (pc, info, given);
    }
    }
  /* pce instruction.  */
  /* pce instruction.  */
  else if (insn_pce_p)
  else if (insn_pce_p)
    {
    {
      long other;
      long other;
 
 
      other = given & 0xFFFF;
      other = given & 0xFFFF;
      given = (given & 0xFFFF0000) >> 16;
      given = (given & 0xFFFF0000) >> 16;
 
 
      status = print_insn_score16 (pc, info, given);
      status = print_insn_score16 (pc, info, given);
      print_insn_parallel_sym (info);
      print_insn_parallel_sym (info);
      status += print_insn_score16 (pc, info, other);
      status += print_insn_score16 (pc, info, other);
      /* disassemble_bytes() will output 4 byte per chunk for pce instructio.  */
      /* disassemble_bytes() will output 4 byte per chunk for pce instructio.  */
      info->bytes_per_chunk = 4;
      info->bytes_per_chunk = 4;
    }
    }
  /* 32 bit instruction.  */
  /* 32 bit instruction.  */
  else
  else
    {
    {
      /* Get rid of parity.  */
      /* Get rid of parity.  */
      ridparity = (given & 0x7FFF);
      ridparity = (given & 0x7FFF);
      ridparity |= (given & 0x7FFF0000) >> 1;
      ridparity |= (given & 0x7FFF0000) >> 1;
      given = ridparity;
      given = ridparity;
      status = print_insn_score32 (pc, info, given);
      status = print_insn_score32 (pc, info, given);
    }
    }
 
 
  return status;
  return status;
}
}
 
 
int
int
print_insn_big_score (bfd_vma pc, struct disassemble_info *info)
print_insn_big_score (bfd_vma pc, struct disassemble_info *info)
{
{
  return print_insn (pc, info, FALSE);
  return print_insn (pc, info, FALSE);
}
}
 
 
int
int
print_insn_little_score (bfd_vma pc, struct disassemble_info *info)
print_insn_little_score (bfd_vma pc, struct disassemble_info *info)
{
{
  return print_insn (pc, info, TRUE);
  return print_insn (pc, info, TRUE);
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.