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

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [opcodes/] [mips-dis.c] - Diff between revs 158 and 166

Show entire file | Details | Blame | View Log

Rev 158 Rev 166
Line 603... Line 603...
 
 
  { "octeon",   1, bfd_mach_mips_octeon, CPU_OCTEON,
  { "octeon",   1, bfd_mach_mips_octeon, CPU_OCTEON,
    ISA_MIPS64R2 | INSN_OCTEON, mips_cp0_names_numeric, NULL, 0,
    ISA_MIPS64R2 | INSN_OCTEON, mips_cp0_names_numeric, NULL, 0,
    mips_hwr_names_numeric },
    mips_hwr_names_numeric },
 
 
 
  { "octeon+",   1, bfd_mach_mips_octeonp, CPU_OCTEONP,
 
    ISA_MIPS64R2 | INSN_OCTEONP, mips_cp0_names_numeric,
 
    NULL, 0, mips_hwr_names_numeric },
 
 
 
  { "octeon2",   1, bfd_mach_mips_octeon2, CPU_OCTEON2,
 
    ISA_MIPS64R2 | INSN_OCTEON2, mips_cp0_names_numeric,
 
    NULL, 0, mips_hwr_names_numeric },
 
 
  { "xlr", 1, bfd_mach_mips_xlr, CPU_XLR,
  { "xlr", 1, bfd_mach_mips_xlr, CPU_XLR,
    ISA_MIPS64 | INSN_XLR,
    ISA_MIPS64 | INSN_XLR,
    mips_cp0_names_xlr,
    mips_cp0_names_xlr,
    mips_cp0sel_names_xlr, ARRAY_SIZE (mips_cp0sel_names_xlr),
    mips_cp0sel_names_xlr, ARRAY_SIZE (mips_cp0sel_names_xlr),
    mips_hwr_names_numeric },
    mips_hwr_names_numeric },
Line 2258... Line 2266...
/* Disassemble microMIPS instructions.  */
/* Disassemble microMIPS instructions.  */
 
 
static int
static int
print_insn_micromips (bfd_vma memaddr, struct disassemble_info *info)
print_insn_micromips (bfd_vma memaddr, struct disassemble_info *info)
{
{
  const fprintf_ftype iprintf = info->fprintf_func;
  const fprintf_ftype infprintf = info->fprintf_func;
  const struct mips_opcode *op, *opend;
  const struct mips_opcode *op, *opend;
  unsigned int lsb, msbd, msb;
  unsigned int lsb, msbd, msb;
  void *is = info->stream;
  void *is = info->stream;
  unsigned int regno;
  unsigned int regno;
  bfd_byte buffer[2];
  bfd_byte buffer[2];
Line 2305... Line 2313...
      higher = insn;
      higher = insn;
 
 
      status = (*info->read_memory_func) (memaddr + 2, buffer, 2, info);
      status = (*info->read_memory_func) (memaddr + 2, buffer, 2, info);
      if (status != 0)
      if (status != 0)
        {
        {
          iprintf (is, "micromips 0x%x", higher);
          infprintf (is, "micromips 0x%x", higher);
          (*info->memory_error_func) (status, memaddr + 2, info);
          (*info->memory_error_func) (status, memaddr + 2, info);
          return -1;
          return -1;
        }
        }
      if (info->endian == BFD_ENDIAN_BIG)
      if (info->endian == BFD_ENDIAN_BIG)
        insn = bfd_getb16 (buffer);
        insn = bfd_getb16 (buffer);
Line 2318... Line 2326...
      higher = (higher << 16) | insn;
      higher = (higher << 16) | insn;
 
 
      status = (*info->read_memory_func) (memaddr + 4, buffer, 2, info);
      status = (*info->read_memory_func) (memaddr + 4, buffer, 2, info);
      if (status != 0)
      if (status != 0)
        {
        {
          iprintf (is, "micromips 0x%x", higher);
          infprintf (is, "micromips 0x%x", higher);
          (*info->memory_error_func) (status, memaddr + 4, info);
          (*info->memory_error_func) (status, memaddr + 4, info);
          return -1;
          return -1;
        }
        }
      if (info->endian == BFD_ENDIAN_BIG)
      if (info->endian == BFD_ENDIAN_BIG)
        insn = bfd_getb16 (buffer);
        insn = bfd_getb16 (buffer);
      else
      else
        insn = bfd_getl16 (buffer);
        insn = bfd_getl16 (buffer);
      iprintf (is, "0x%x%04x (48-bit insn)", higher, insn);
      infprintf (is, "0x%x%04x (48-bit insn)", higher, insn);
 
 
      info->insn_type = dis_noninsn;
      info->insn_type = dis_noninsn;
      return 6;
      return 6;
    }
    }
  else if ((insn & 0x1c00) == 0x0000 || (insn & 0x1000) == 0x1000)
  else if ((insn & 0x1c00) == 0x0000 || (insn & 0x1000) == 0x1000)
Line 2339... Line 2347...
      higher = insn;
      higher = insn;
 
 
      status = (*info->read_memory_func) (memaddr + 2, buffer, 2, info);
      status = (*info->read_memory_func) (memaddr + 2, buffer, 2, info);
      if (status != 0)
      if (status != 0)
        {
        {
          iprintf (is, "micromips 0x%x", higher);
          infprintf (is, "micromips 0x%x", higher);
          (*info->memory_error_func) (status, memaddr + 2, info);
          (*info->memory_error_func) (status, memaddr + 2, info);
          return -1;
          return -1;
        }
        }
 
 
      if (info->endian == BFD_ENDIAN_BIG)
      if (info->endian == BFD_ENDIAN_BIG)
Line 2369... Line 2377...
          && ((length == 2 && (op->mask & 0xffff0000) == 0)
          && ((length == 2 && (op->mask & 0xffff0000) == 0)
              || (length == 4 && (op->mask & 0xffff0000) != 0)))
              || (length == 4 && (op->mask & 0xffff0000) != 0)))
        {
        {
          const char *s;
          const char *s;
 
 
          iprintf (is, "%s", op->name);
          infprintf (is, "%s", op->name);
          if (op->args[0] != '\0')
          if (op->args[0] != '\0')
            iprintf (is, "\t");
            infprintf (is, "\t");
 
 
          for (s = op->args; *s != '\0'; s++)
          for (s = op->args; *s != '\0'; s++)
            {
            {
              switch (*s)
              switch (*s)
                {
                {
                case ',':
                case ',':
                case '(':
                case '(':
                case ')':
                case ')':
                  iprintf (is, "%c", *s);
                  infprintf (is, "%c", *s);
                  break;
                  break;
 
 
                case '.':
                case '.':
                  delta = GET_OP (insn, OFFSET10);
                  delta = GET_OP (insn, OFFSET10);
                  if (delta & 0x200)
                  if (delta & 0x200)
                    delta |= ~0x3ff;
                    delta |= ~0x3ff;
                  iprintf (is, "%d", delta);
                  infprintf (is, "%d", delta);
                  break;
                  break;
 
 
                case '1':
                case '1':
                  iprintf (is, "0x%lx", GET_OP (insn, STYPE));
                  infprintf (is, "0x%lx", GET_OP (insn, STYPE));
                  break;
                  break;
 
 
                case '<':
                case '<':
                  iprintf (is, "0x%lx", GET_OP (insn, SHAMT));
                  infprintf (is, "0x%lx", GET_OP (insn, SHAMT));
                  break;
                  break;
 
 
                case '\\':
                case '\\':
                  iprintf (is, "0x%lx", GET_OP (insn, 3BITPOS));
                  infprintf (is, "0x%lx", GET_OP (insn, 3BITPOS));
                  break;
                  break;
 
 
                case '|':
                case '|':
                  iprintf (is, "0x%lx", GET_OP (insn, TRAP));
                  infprintf (is, "0x%lx", GET_OP (insn, TRAP));
                  break;
                  break;
 
 
                case '~':
                case '~':
                  delta = GET_OP (insn, OFFSET12);
                  delta = GET_OP (insn, OFFSET12);
                  if (delta & 0x800)
                  if (delta & 0x800)
                    delta |= ~0x7ff;
                    delta |= ~0x7ff;
                  iprintf (is, "%d", delta);
                  infprintf (is, "%d", delta);
                  break;
                  break;
 
 
                case 'a':
                case 'a':
                  if (strcmp (op->name, "jalx") == 0)
                  if (strcmp (op->name, "jalx") == 0)
                    info->target = (((memaddr + 4) & ~(bfd_vma) 0x0fffffff)
                    info->target = (((memaddr + 4) & ~(bfd_vma) 0x0fffffff)
Line 2431... Line 2439...
 
 
                case 'b':
                case 'b':
                case 'r':
                case 'r':
                case 's':
                case 's':
                case 'v':
                case 'v':
                  iprintf (is, "%s", mips_gpr_names[GET_OP (insn, RS)]);
                  infprintf (is, "%s", mips_gpr_names[GET_OP (insn, RS)]);
                  break;
                  break;
 
 
                case 'c':
                case 'c':
                  iprintf (is, "0x%lx", GET_OP (insn, CODE));
                  infprintf (is, "0x%lx", GET_OP (insn, CODE));
                  break;
                  break;
 
 
                case 'd':
                case 'd':
                  iprintf (is, "%s", mips_gpr_names[GET_OP (insn, RD)]);
                  infprintf (is, "%s", mips_gpr_names[GET_OP (insn, RD)]);
                  break;
                  break;
 
 
                case 'h':
                case 'h':
                  iprintf (is, "0x%lx", GET_OP (insn, PREFX));
                  infprintf (is, "0x%lx", GET_OP (insn, PREFX));
                  break;
                  break;
 
 
                case 'i':
                case 'i':
                case 'u':
                case 'u':
                  iprintf (is, "0x%lx", GET_OP (insn, IMMEDIATE));
                  infprintf (is, "0x%lx", GET_OP (insn, IMMEDIATE));
                  break;
                  break;
 
 
                case 'j': /* Same as i, but sign-extended.  */
                case 'j': /* Same as i, but sign-extended.  */
                case 'o':
                case 'o':
                  delta = (GET_OP (insn, DELTA) ^ 0x8000) - 0x8000;
                  delta = (GET_OP (insn, DELTA) ^ 0x8000) - 0x8000;
                  iprintf (is, "%d", delta);
                  infprintf (is, "%d", delta);
                  break;
                  break;
 
 
                case 'k':
                case 'k':
                  iprintf (is, "0x%x", GET_OP (insn, CACHE));
                  infprintf (is, "0x%x", GET_OP (insn, CACHE));
                  break;
                  break;
 
 
                case 'n':
                case 'n':
                  {
                  {
                    int s_reg_encode;
                    int s_reg_encode;
Line 2470... Line 2478...
                    immed = GET_OP (insn, RT);
                    immed = GET_OP (insn, RT);
                    s_reg_encode = immed & 0xf;
                    s_reg_encode = immed & 0xf;
                    if (s_reg_encode != 0)
                    if (s_reg_encode != 0)
                      {
                      {
                        if (s_reg_encode == 1)
                        if (s_reg_encode == 1)
                          iprintf (is, "%s", mips_gpr_names[16]);
                          infprintf (is, "%s", mips_gpr_names[16]);
                        else if (s_reg_encode < 9)
                        else if (s_reg_encode < 9)
                          iprintf (is, "%s-%s",
                          infprintf (is, "%s-%s",
                                   mips_gpr_names[16],
                                   mips_gpr_names[16],
                                   mips_gpr_names[15 + s_reg_encode]);
                                   mips_gpr_names[15 + s_reg_encode]);
                        else if (s_reg_encode == 9)
                        else if (s_reg_encode == 9)
                          iprintf (is, "%s-%s,%s",
                          infprintf (is, "%s-%s,%s",
                                   mips_gpr_names[16],
                                   mips_gpr_names[16],
                                   mips_gpr_names[23],
                                   mips_gpr_names[23],
                                   mips_gpr_names[30]);
                                   mips_gpr_names[30]);
                        else
                        else
                          iprintf (is, "UNKNOWN");
                          infprintf (is, "UNKNOWN");
                      }
                      }
 
 
                    if (immed & 0x10) /* For ra.  */
                    if (immed & 0x10) /* For ra.  */
                      {
                      {
                        if (s_reg_encode == 0)
                        if (s_reg_encode == 0)
                          iprintf (is, "%s", mips_gpr_names[31]);
                          infprintf (is, "%s", mips_gpr_names[31]);
                        else
                        else
                          iprintf (is, ",%s", mips_gpr_names[31]);
                          infprintf (is, ",%s", mips_gpr_names[31]);
                      }
                      }
                    break;
                    break;
                  }
                  }
 
 
                case 'p':
                case 'p':
Line 2502... Line 2510...
                  info->target = (delta << 1) + memaddr + length;
                  info->target = (delta << 1) + memaddr + length;
                  (*info->print_address_func) (info->target, info);
                  (*info->print_address_func) (info->target, info);
                  break;
                  break;
 
 
                case 'q':
                case 'q':
                  iprintf (is, "0x%lx", GET_OP (insn, CODE2));
                  infprintf (is, "0x%lx", GET_OP (insn, CODE2));
                  break;
                  break;
 
 
                case 't':
                case 't':
                case 'w':
                case 'w':
                  iprintf (is, "%s", mips_gpr_names[GET_OP (insn, RT)]);
                  infprintf (is, "%s", mips_gpr_names[GET_OP (insn, RT)]);
                  break;
                  break;
 
 
                case 'y':
                case 'y':
                  iprintf (is, "%s", mips_gpr_names[GET_OP (insn, RS3)]);
                  infprintf (is, "%s", mips_gpr_names[GET_OP (insn, RS3)]);
                  break;
                  break;
 
 
                case 'z':
                case 'z':
                  iprintf (is, "%s", mips_gpr_names[0]);
                  infprintf (is, "%s", mips_gpr_names[0]);
                  break;
                  break;
 
 
                case 'B':
                case 'B':
                  iprintf (is, "0x%lx", GET_OP (insn, CODE10));
                  infprintf (is, "0x%lx", GET_OP (insn, CODE10));
                  break;
                  break;
 
 
                case 'C':
                case 'C':
                  iprintf (is, "0x%lx", GET_OP (insn, COPZ));
                  infprintf (is, "0x%lx", GET_OP (insn, COPZ));
                  break;
                  break;
 
 
                case 'D':
                case 'D':
                  iprintf (is, "%s", mips_fpr_names[GET_OP (insn, FD)]);
                  infprintf (is, "%s", mips_fpr_names[GET_OP (insn, FD)]);
                  break;
                  break;
 
 
                case 'E':
                case 'E':
                  /* Coprocessor register for lwcN instructions, et al.
                  /* Coprocessor register for lwcN instructions, et al.
 
 
                    Note that there is no load/store cp0 instructions, and
                    Note that there is no load/store cp0 instructions, and
                    that FPU (cp1) instructions disassemble this field using
                    that FPU (cp1) instructions disassemble this field using
                    'T' format.  Therefore, until we gain understanding of
                    'T' format.  Therefore, until we gain understanding of
                    cp2 register names, we can simply print the register
                    cp2 register names, we can simply print the register
                    numbers.  */
                    numbers.  */
                  iprintf (is, "$%ld", GET_OP (insn, RT));
                  infprintf (is, "$%ld", GET_OP (insn, RT));
                  break;
                  break;
 
 
                case 'G':
                case 'G':
                  /* Coprocessor register for mtcN instructions, et al.  Note
                  /* Coprocessor register for mtcN instructions, et al.  Note
                     that FPU (cp1) instructions disassemble this field using
                     that FPU (cp1) instructions disassemble this field using
Line 2557... Line 2565...
                    {
                    {
                    case 0x000000fc:                            /* mfc0  */
                    case 0x000000fc:                            /* mfc0  */
                    case 0x000002fc:                            /* mtc0  */
                    case 0x000002fc:                            /* mtc0  */
                    case 0x580000fc:                            /* dmfc0 */
                    case 0x580000fc:                            /* dmfc0 */
                    case 0x580002fc:                            /* dmtc0 */
                    case 0x580002fc:                            /* dmtc0 */
                      iprintf (is, "%s", mips_cp0_names[GET_OP (insn, RS)]);
                      infprintf (is, "%s", mips_cp0_names[GET_OP (insn, RS)]);
                      break;
                      break;
                    default:
                    default:
                      iprintf (is, "$%ld", GET_OP (insn, RS));
                      infprintf (is, "$%ld", GET_OP (insn, RS));
                      break;
                      break;
                    }
                    }
                  break;
                  break;
 
 
                case 'H':
                case 'H':
                  iprintf (is, "%ld", GET_OP (insn, SEL));
                  infprintf (is, "%ld", GET_OP (insn, SEL));
                  break;
                  break;
 
 
                case 'K':
                case 'K':
                  iprintf (is, "%s", mips_hwr_names[GET_OP (insn, RS)]);
                  infprintf (is, "%s", mips_hwr_names[GET_OP (insn, RS)]);
                  break;
                  break;
 
 
                case 'M':
                case 'M':
                  iprintf (is, "$fcc%ld", GET_OP (insn, CCC));
                  infprintf (is, "$fcc%ld", GET_OP (insn, CCC));
                  break;
                  break;
 
 
                case 'N':
                case 'N':
                  iprintf (is,
                  infprintf (is,
                           (op->pinfo & (FP_D | FP_S)) != 0
                           (op->pinfo & (FP_D | FP_S)) != 0
                           ? "$fcc%ld" : "$cc%ld",
                           ? "$fcc%ld" : "$cc%ld",
                           GET_OP (insn, BCC));
                           GET_OP (insn, BCC));
                  break;
                  break;
 
 
                case 'R':
                case 'R':
                  iprintf (is, "%s", mips_fpr_names[GET_OP (insn, FR)]);
                  infprintf (is, "%s", mips_fpr_names[GET_OP (insn, FR)]);
                  break;
                  break;
 
 
                case 'S':
                case 'S':
                case 'V':
                case 'V':
                  iprintf (is, "%s", mips_fpr_names[GET_OP (insn, FS)]);
                  infprintf (is, "%s", mips_fpr_names[GET_OP (insn, FS)]);
                  break;
                  break;
 
 
                case 'T':
                case 'T':
                  iprintf (is, "%s", mips_fpr_names[GET_OP (insn, FT)]);
                  infprintf (is, "%s", mips_fpr_names[GET_OP (insn, FT)]);
                  break;
                  break;
 
 
                case '+':
                case '+':
                  /* Extension character; switch for second char.  */
                  /* Extension character; switch for second char.  */
                  s++;
                  s++;
                  switch (*s)
                  switch (*s)
                    {
                    {
                    case 'A':
                    case 'A':
                      lsb = GET_OP (insn, EXTLSB);
                      lsb = GET_OP (insn, EXTLSB);
                      iprintf (is, "0x%x", lsb);
                      infprintf (is, "0x%x", lsb);
                      break;
                      break;
 
 
                    case 'B':
                    case 'B':
                      msb = GET_OP (insn, INSMSB);
                      msb = GET_OP (insn, INSMSB);
                      iprintf (is, "0x%x", msb - lsb + 1);
                      infprintf (is, "0x%x", msb - lsb + 1);
                      break;
                      break;
 
 
                    case 'C':
                    case 'C':
                    case 'H':
                    case 'H':
                      msbd = GET_OP (insn, EXTMSBD);
                      msbd = GET_OP (insn, EXTMSBD);
                      iprintf (is, "0x%x", msbd + 1);
                      infprintf (is, "0x%x", msbd + 1);
                      break;
                      break;
 
 
                    case 'D':
                    case 'D':
                      {
                      {
                        const struct mips_cp0sel_name *n;
                        const struct mips_cp0sel_name *n;
Line 2635... Line 2643...
                           have a name unrelated to register being printed.  */
                           have a name unrelated to register being printed.  */
                        n = lookup_mips_cp0sel_name (mips_cp0sel_names,
                        n = lookup_mips_cp0sel_name (mips_cp0sel_names,
                                                     mips_cp0sel_names_len,
                                                     mips_cp0sel_names_len,
                                                     cp0reg, sel);
                                                     cp0reg, sel);
                        if (n != NULL)
                        if (n != NULL)
                          iprintf (is, "%s", n->name);
                          infprintf (is, "%s", n->name);
                        else
                        else
                          iprintf (is, "$%d,%d", cp0reg, sel);
                          infprintf (is, "$%d,%d", cp0reg, sel);
                        break;
                        break;
                      }
                      }
 
 
                    case 'E':
                    case 'E':
                      lsb = GET_OP (insn, EXTLSB) + 32;
                      lsb = GET_OP (insn, EXTLSB) + 32;
                      iprintf (is, "0x%x", lsb);
                      infprintf (is, "0x%x", lsb);
                      break;
                      break;
 
 
                    case 'F':
                    case 'F':
                      msb = GET_OP (insn, INSMSB) + 32;
                      msb = GET_OP (insn, INSMSB) + 32;
                      iprintf (is, "0x%x", msb - lsb + 1);
                      infprintf (is, "0x%x", msb - lsb + 1);
                      break;
                      break;
 
 
                    case 'G':
                    case 'G':
                      msbd = GET_OP (insn, EXTMSBD) + 32;
                      msbd = GET_OP (insn, EXTMSBD) + 32;
                      iprintf (is, "0x%x", msbd + 1);
                      infprintf (is, "0x%x", msbd + 1);
                      break;
                      break;
 
 
                    default:
                    default:
                      /* xgettext:c-format */
                      /* xgettext:c-format */
                      iprintf (is,
                      infprintf (is,
                               _("# internal disassembler error, "
                               _("# internal disassembler error, "
                                 "unrecognized modifier (+%c)"),
                                 "unrecognized modifier (+%c)"),
                               *s);
                               *s);
                      abort ();
                      abort ();
                    }
                    }
Line 2672... Line 2680...
                  /* Extension character; switch for second char.  */
                  /* Extension character; switch for second char.  */
                  s++;
                  s++;
                  switch (*s)
                  switch (*s)
                    {
                    {
                    case 'a':   /* global pointer.  */
                    case 'a':   /* global pointer.  */
                      iprintf (is, "%s", mips_gpr_names[28]);
                      infprintf (is, "%s", mips_gpr_names[28]);
                      break;
                      break;
 
 
                    case 'b':
                    case 'b':
                      regno = micromips_to_32_reg_b_map[GET_OP (insn, MB)];
                      regno = micromips_to_32_reg_b_map[GET_OP (insn, MB)];
                      iprintf (is, "%s", mips_gpr_names[regno]);
                      infprintf (is, "%s", mips_gpr_names[regno]);
                      break;
                      break;
 
 
                    case 'c':
                    case 'c':
                      regno = micromips_to_32_reg_c_map[GET_OP (insn, MC)];
                      regno = micromips_to_32_reg_c_map[GET_OP (insn, MC)];
                      iprintf (is, "%s", mips_gpr_names[regno]);
                      infprintf (is, "%s", mips_gpr_names[regno]);
                      break;
                      break;
 
 
                    case 'd':
                    case 'd':
                      regno = micromips_to_32_reg_d_map[GET_OP (insn, MD)];
                      regno = micromips_to_32_reg_d_map[GET_OP (insn, MD)];
                      iprintf (is, "%s", mips_gpr_names[regno]);
                      infprintf (is, "%s", mips_gpr_names[regno]);
                      break;
                      break;
 
 
                    case 'e':
                    case 'e':
                      regno = micromips_to_32_reg_e_map[GET_OP (insn, ME)];
                      regno = micromips_to_32_reg_e_map[GET_OP (insn, ME)];
                      iprintf (is, "%s", mips_gpr_names[regno]);
                      infprintf (is, "%s", mips_gpr_names[regno]);
                      break;
                      break;
 
 
                    case 'f':
                    case 'f':
                      /* Save lastregno for "mt" to print out later.  */
                      /* Save lastregno for "mt" to print out later.  */
                      lastregno = micromips_to_32_reg_f_map[GET_OP (insn, MF)];
                      lastregno = micromips_to_32_reg_f_map[GET_OP (insn, MF)];
                      iprintf (is, "%s", mips_gpr_names[lastregno]);
                      infprintf (is, "%s", mips_gpr_names[lastregno]);
                      break;
                      break;
 
 
                    case 'g':
                    case 'g':
                      regno = micromips_to_32_reg_g_map[GET_OP (insn, MG)];
                      regno = micromips_to_32_reg_g_map[GET_OP (insn, MG)];
                      iprintf (is, "%s", mips_gpr_names[regno]);
                      infprintf (is, "%s", mips_gpr_names[regno]);
                      break;
                      break;
 
 
                    case 'h':
                    case 'h':
                      regno = micromips_to_32_reg_h_map[GET_OP (insn, MH)];
                      regno = micromips_to_32_reg_h_map[GET_OP (insn, MH)];
                      iprintf (is, "%s", mips_gpr_names[regno]);
                      infprintf (is, "%s", mips_gpr_names[regno]);
                      break;
                      break;
 
 
                    case 'i':
                    case 'i':
                      regno = micromips_to_32_reg_i_map[GET_OP (insn, MI)];
                      regno = micromips_to_32_reg_i_map[GET_OP (insn, MI)];
                      iprintf (is, "%s", mips_gpr_names[regno]);
                      infprintf (is, "%s", mips_gpr_names[regno]);
                      break;
                      break;
 
 
                    case 'j':
                    case 'j':
                      iprintf (is, "%s", mips_gpr_names[GET_OP (insn, MJ)]);
                      infprintf (is, "%s", mips_gpr_names[GET_OP (insn, MJ)]);
                      break;
                      break;
 
 
                    case 'l':
                    case 'l':
                      regno = micromips_to_32_reg_l_map[GET_OP (insn, ML)];
                      regno = micromips_to_32_reg_l_map[GET_OP (insn, ML)];
                      iprintf (is, "%s", mips_gpr_names[regno]);
                      infprintf (is, "%s", mips_gpr_names[regno]);
                      break;
                      break;
 
 
                    case 'm':
                    case 'm':
                      regno = micromips_to_32_reg_m_map[GET_OP (insn, MM)];
                      regno = micromips_to_32_reg_m_map[GET_OP (insn, MM)];
                      iprintf (is, "%s", mips_gpr_names[regno]);
                      infprintf (is, "%s", mips_gpr_names[regno]);
                      break;
                      break;
 
 
                    case 'n':
                    case 'n':
                      regno = micromips_to_32_reg_n_map[GET_OP (insn, MN)];
                      regno = micromips_to_32_reg_n_map[GET_OP (insn, MN)];
                      iprintf (is, "%s", mips_gpr_names[regno]);
                      infprintf (is, "%s", mips_gpr_names[regno]);
                      break;
                      break;
 
 
                    case 'p':
                    case 'p':
                      /* Save lastregno for "mt" to print out later.  */
                      /* Save lastregno for "mt" to print out later.  */
                      lastregno = GET_OP (insn, MP);
                      lastregno = GET_OP (insn, MP);
                      iprintf (is, "%s", mips_gpr_names[lastregno]);
                      infprintf (is, "%s", mips_gpr_names[lastregno]);
                      break;
                      break;
 
 
                    case 'q':
                    case 'q':
                      regno = micromips_to_32_reg_q_map[GET_OP (insn, MQ)];
                      regno = micromips_to_32_reg_q_map[GET_OP (insn, MQ)];
                      iprintf (is, "%s", mips_gpr_names[regno]);
                      infprintf (is, "%s", mips_gpr_names[regno]);
                      break;
                      break;
 
 
                    case 'r':   /* program counter.  */
                    case 'r':   /* program counter.  */
                      iprintf (is, "$pc");
                      infprintf (is, "$pc");
                      break;
                      break;
 
 
                    case 's':   /* stack pointer.  */
                    case 's':   /* stack pointer.  */
                      lastregno = 29;
                      lastregno = 29;
                      iprintf (is, "%s", mips_gpr_names[29]);
                      infprintf (is, "%s", mips_gpr_names[29]);
                      break;
                      break;
 
 
                    case 't':
                    case 't':
                      iprintf (is, "%s", mips_gpr_names[lastregno]);
                      infprintf (is, "%s", mips_gpr_names[lastregno]);
                      break;
                      break;
 
 
                    case 'z':   /* $0.  */
                    case 'z':   /* $0.  */
                      iprintf (is, "%s", mips_gpr_names[0]);
                      infprintf (is, "%s", mips_gpr_names[0]);
                      break;
                      break;
 
 
                    case 'A':
                    case 'A':
                      /* Sign-extend the immediate.  */
                      /* Sign-extend the immediate.  */
                      immed = ((GET_OP (insn, IMMA) ^ 0x40) - 0x40) << 2;
                      immed = ((GET_OP (insn, IMMA) ^ 0x40) - 0x40) << 2;
                      iprintf (is, "%d", immed);
                      infprintf (is, "%d", immed);
                      break;
                      break;
 
 
                    case 'B':
                    case 'B':
                      immed = micromips_imm_b_map[GET_OP (insn, IMMB)];
                      immed = micromips_imm_b_map[GET_OP (insn, IMMB)];
                      iprintf (is, "%d", immed);
                      infprintf (is, "%d", immed);
                      break;
                      break;
 
 
                    case 'C':
                    case 'C':
                      immed = micromips_imm_c_map[GET_OP (insn, IMMC)];
                      immed = micromips_imm_c_map[GET_OP (insn, IMMC)];
                      iprintf (is, "0x%lx", immed);
                      infprintf (is, "0x%lx", immed);
                      break;
                      break;
 
 
                    case 'D':
                    case 'D':
                      /* Sign-extend the displacement.  */
                      /* Sign-extend the displacement.  */
                      delta = (GET_OP (insn, IMMD) ^ 0x200) - 0x200;
                      delta = (GET_OP (insn, IMMD) ^ 0x200) - 0x200;
Line 2795... Line 2803...
                      (*info->print_address_func) (info->target, info);
                      (*info->print_address_func) (info->target, info);
                      break;
                      break;
 
 
                    case 'F':
                    case 'F':
                      immed = GET_OP (insn, IMMF);
                      immed = GET_OP (insn, IMMF);
                      iprintf (is, "0x%x", immed);
                      infprintf (is, "0x%x", immed);
                      break;
                      break;
 
 
                    case 'G':
                    case 'G':
                      immed = (insn >> MICROMIPSOP_SH_IMMG) + 1;
                      immed = (insn >> MICROMIPSOP_SH_IMMG) + 1;
                      immed = (immed & MICROMIPSOP_MASK_IMMG) - 1;
                      immed = (immed & MICROMIPSOP_MASK_IMMG) - 1;
                      iprintf (is, "%d", immed);
                      infprintf (is, "%d", immed);
                      break;
                      break;
 
 
                    case 'H':
                    case 'H':
                      immed = GET_OP (insn, IMMH) << 1;
                      immed = GET_OP (insn, IMMH) << 1;
                      iprintf (is, "%d", immed);
                      infprintf (is, "%d", immed);
                      break;
                      break;
 
 
                    case 'I':
                    case 'I':
                      immed = (insn >> MICROMIPSOP_SH_IMMI) + 1;
                      immed = (insn >> MICROMIPSOP_SH_IMMI) + 1;
                      immed = (immed & MICROMIPSOP_MASK_IMMI) - 1;
                      immed = (immed & MICROMIPSOP_MASK_IMMI) - 1;
                      iprintf (is, "%d", immed);
                      infprintf (is, "%d", immed);
                      break;
                      break;
 
 
                    case 'J':
                    case 'J':
                      immed = GET_OP (insn, IMMJ) << 2;
                      immed = GET_OP (insn, IMMJ) << 2;
                      iprintf (is, "%d", immed);
                      infprintf (is, "%d", immed);
                      break;
                      break;
 
 
                    case 'L':
                    case 'L':
                      immed = GET_OP (insn, IMML);
                      immed = GET_OP (insn, IMML);
                      iprintf (is, "%d", immed);
                      infprintf (is, "%d", immed);
                      break;
                      break;
 
 
                    case 'M':
                    case 'M':
                      immed = (insn >> MICROMIPSOP_SH_IMMM) - 1;
                      immed = (insn >> MICROMIPSOP_SH_IMMM) - 1;
                      immed = (immed & MICROMIPSOP_MASK_IMMM) + 1;
                      immed = (immed & MICROMIPSOP_MASK_IMMM) + 1;
                      iprintf (is, "%d", immed);
                      infprintf (is, "%d", immed);
                      break;
                      break;
 
 
                    case 'N':
                    case 'N':
                      immed = GET_OP (insn, IMMN);
                      immed = GET_OP (insn, IMMN);
                      if (immed == 0)
                      if (immed == 0)
                        iprintf (is, "%s,%s",
                        infprintf (is, "%s,%s",
                                 mips_gpr_names[16],
                                 mips_gpr_names[16],
                                 mips_gpr_names[31]);
                                 mips_gpr_names[31]);
                      else
                      else
                        iprintf (is, "%s-%s,%s",
                        infprintf (is, "%s-%s,%s",
                                 mips_gpr_names[16],
                                 mips_gpr_names[16],
                                 mips_gpr_names[16 + immed],
                                 mips_gpr_names[16 + immed],
                                 mips_gpr_names[31]);
                                 mips_gpr_names[31]);
                      break;
                      break;
 
 
                    case 'O':
                    case 'O':
                      immed = GET_OP (insn, IMMO);
                      immed = GET_OP (insn, IMMO);
                      iprintf (is, "0x%x", immed);
                      infprintf (is, "0x%x", immed);
                      break;
                      break;
 
 
                    case 'P':
                    case 'P':
                      immed = GET_OP (insn, IMMP) << 2;
                      immed = GET_OP (insn, IMMP) << 2;
                      iprintf (is, "%d", immed);
                      infprintf (is, "%d", immed);
                      break;
                      break;
 
 
                    case 'Q':
                    case 'Q':
                      /* Sign-extend the immediate.  */
                      /* Sign-extend the immediate.  */
                      immed = (GET_OP (insn, IMMQ) ^ 0x400000) - 0x400000;
                      immed = (GET_OP (insn, IMMQ) ^ 0x400000) - 0x400000;
                      immed <<= 2;
                      immed <<= 2;
                      iprintf (is, "%d", immed);
                      infprintf (is, "%d", immed);
                      break;
                      break;
 
 
                    case 'U':
                    case 'U':
                      immed = GET_OP (insn, IMMU) << 2;
                      immed = GET_OP (insn, IMMU) << 2;
                      iprintf (is, "%d", immed);
                      infprintf (is, "%d", immed);
                      break;
                      break;
 
 
                    case 'W':
                    case 'W':
                      immed = GET_OP (insn, IMMW) << 2;
                      immed = GET_OP (insn, IMMW) << 2;
                      iprintf (is, "%d", immed);
                      infprintf (is, "%d", immed);
                      break;
                      break;
 
 
                    case 'X':
                    case 'X':
                      /* Sign-extend the immediate.  */
                      /* Sign-extend the immediate.  */
                      immed = (GET_OP (insn, IMMX) ^ 0x8) - 0x8;
                      immed = (GET_OP (insn, IMMX) ^ 0x8) - 0x8;
                      iprintf (is, "%d", immed);
                      infprintf (is, "%d", immed);
                      break;
                      break;
 
 
                    case 'Y':
                    case 'Y':
                      /* Sign-extend the immediate.  */
                      /* Sign-extend the immediate.  */
                      immed = (GET_OP (insn, IMMY) ^ 0x100) - 0x100;
                      immed = (GET_OP (insn, IMMY) ^ 0x100) - 0x100;
                      if (immed >= -2 && immed <= 1)
                      if (immed >= -2 && immed <= 1)
                        immed ^= 0x100;
                        immed ^= 0x100;
                      immed = immed << 2;
                      immed = immed << 2;
                      iprintf (is, "%d", immed);
                      infprintf (is, "%d", immed);
                      break;
                      break;
 
 
                    default:
                    default:
                      /* xgettext:c-format */
                      /* xgettext:c-format */
                      iprintf (is,
                      infprintf (is,
                               _("# internal disassembler error, "
                               _("# internal disassembler error, "
                                 "unrecognized modifier (m%c)"),
                                 "unrecognized modifier (m%c)"),
                               *s);
                               *s);
                      abort ();
                      abort ();
                    }
                    }
                  break;
                  break;
 
 
                default:
                default:
                  /* xgettext:c-format */
                  /* xgettext:c-format */
                  iprintf (is,
                  infprintf (is,
                           _("# internal disassembler error, "
                           _("# internal disassembler error, "
                             "unrecognized modifier (%c)"),
                             "unrecognized modifier (%c)"),
                           *s);
                           *s);
                  abort ();
                  abort ();
                }
                }
Line 2935... Line 2943...
          return length;
          return length;
        }
        }
    }
    }
#undef GET_OP
#undef GET_OP
 
 
  iprintf (is, "0x%x", insn);
  infprintf (is, "0x%x", insn);
  info->insn_type = dis_noninsn;
  info->insn_type = dis_noninsn;
 
 
  return length;
  return length;
}
}
 
 

powered by: WebSVN 2.1.0

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