Beispiel #1
0
//----------------------------------------------------------------------
static void out_address(ea_t ea, op_t &x, bool mapping, bool at)
{
  regnum_t reg = get_mapped_register(ea);
  if ( mapping && reg != rnone) out_register(ph.regNames[reg] );
  else
  {
#ifndef TMS320C54_NO_NAME_NO_REF
    char buf[MAXSTR];
    // since tms320c54 uses memory mapping, we turn off verification
    // of name expression values (3d arg of get_name_expr is BADADDR)
    if ( get_name_expr(cmd.ea+x.offb, x.n, ea, BADADDR, buf, sizeof(buf)) > 0 )
    {
      if ( at)
        out_symbol('@' );
      OutLine(buf);
    }
    else
#endif
    {
      out_tagon(COLOR_ERROR);
      OutValue(x, OOFW_IMM|OOF_ADDR);
      out_tagoff(COLOR_ERROR);
      QueueMark(Q_noName, cmd.ea);
    }
  }
}
Beispiel #2
0
//----------------------------------------------------------------------
bool create_func_frame(func_t *pfn)
{
  if ( pfn != NULL )
  {
    if ( pfn->frame == BADNODE )
    {
      ea_t ea = pfn->startEA;
      int regsize = 0;
      while (ea < pfn->endEA) // check for register pushs
      {
        if ( !decode_insn(ea) )
          break;
        if (cmd.itype != TMS320C54_pshm )
          break;
        if ( cmd.Op1.type != o_mem && cmd.Op1.type != o_mmr )
          break;
        if ( get_mapped_register(cmd.Op1.addr) == rnone )
          break;
        regsize++;
        ea += cmd.size;
      }
      int localsize = 0;
      while (ea < pfn->endEA) // check for frame creation
      {
        if (cmd.itype == TMS320C54_frame && cmd.Op1.type == o_imm)
        {
          localsize = -(int)cmd.Op1.value;
          break;
        }
        ea += cmd.size;
        if ( !decode_insn(ea) )
          break;
      }
      add_frame(pfn, localsize+regsize, 0, 0);
    }
  }
  return 0;
}
Beispiel #3
0
//----------------------------------------------------------------------
static void out_address(op_t &op)
{
  ea_t ea;
  if (op.type == o_near)
    ea = calc_code_mem(op.addr);
  else if (op.type == o_mem)
    ea = calc_data_mem(op);
  else if (op.type == o_io)
   ea = calc_io_mem(op);

  int reg = -1;
  if (op.type == o_mem) reg = get_mapped_register(ea);

  // print begin of the modifier
  switch(op.tms_modifier)
  {
    case TMS_MODIFIER_NULL:
      break;
    case TMS_MODIFIER_DMA:
      if ((int)reg == -1) out_symbol('@');
      break;
    case TMS_MODIFIER_ABS16:
    case TMS_MODIFIER_PTR:
      out_symbol('*');
      if (op.tms_modifier == TMS_MODIFIER_ABS16) out_line("abs16", COLOR_SYMBOL);
      out_line("(#", COLOR_SYMBOL);
      break;
    case TMS_MODIFIER_MMAP:
      out_line("mmap(@", COLOR_SYMBOL);
      break;
    case TMS_MODIFIER_PORT:
      out_line("port(#", COLOR_SYMBOL);
      break;
    case TMS_MODIFIER_PORT_AT:
      out_line("port(@", COLOR_SYMBOL);
      break;
    default:
      error("interr: out: o_address: modifier_begin");
  }


  if (op.type != o_io)
  {
    if (int(reg) != -1) // memory mapped register
      out_register(ph.regNames[reg]);
    else
    {
#ifndef TMS320C55_NO_NAME_NO_REF
      if ( !out_name_expr(op, ea, ea) )
#endif
      {
        out_tagon(COLOR_ERROR);
        if (op.type != o_mem)
          OutLong(op.addr, 16);
        else
          OutLong(op.addr, 16);
        out_tagoff(COLOR_ERROR);
        QueueMark(Q_noName, cmd.ea);
      }
    }
  }
  else // IO address
  {
    if (ea != BADADDR)
    {
      const char *name = NULL;
      if (idpflags & TMS320C55_IO) name = find_sym(ea);
      if (name)
        out_line(name, COLOR_IMPNAME);
      else
        OutLong(ea, 16);
    }
    else
    {
      out_tagon(COLOR_ERROR);
      OutLong(op.addr, 16);
      out_tagoff(COLOR_ERROR);
    }
  }

  // print end of the modifier
  switch(op.tms_modifier)
  {
    case TMS_MODIFIER_NULL:
    case TMS_MODIFIER_DMA:
      break;
    case TMS_MODIFIER_ABS16:
    case TMS_MODIFIER_PTR:
    case TMS_MODIFIER_MMAP:
    case TMS_MODIFIER_PORT:
    case TMS_MODIFIER_PORT_AT:
      out_symbol(')'); break;
    default:
      error("interr: out: o_address: modifier_begin");
  }
}