Esempio n. 1
0
//----------------------------------------------------------------------
void idaapi out(void)
{
  char buf[MAXSTR];
  init_output_buffer(buf, sizeof(buf));

  // output instruction mnemonics
  char postfix[4];
  postfix[0] = '\0';

  OutMnem(8, postfix);

  bool comma = out_one_operand(0);
  if ( cmd.Op2.type != o_void )
  {
    if ( comma ) out_symbol(',');
    out_one_operand(1);
  }
  if ( cmd.Op3.type != o_void )
  {
    out_symbol(',');
    out_one_operand(2);
  }


  if ( isVoid(cmd.ea, uFlag, 0) ) OutImmChar(cmd.Op1);
  if ( isVoid(cmd.ea, uFlag, 1) ) OutImmChar(cmd.Op2);
  if ( isVoid(cmd.ea, uFlag, 3) ) OutImmChar(cmd.Op3);

  term_output_buffer();

  gl_comm = 1;
  MakeLine(buf);
}
Esempio n. 2
0
//----------------------------------------------------------------------
void out(void)
{
char buf[MAXSTR];

init_output_buffer(buf, sizeof(buf)); // setup the output pointer
OutMnem();                            // output instruction mnemonics

out_one_operand(0);                   // output the first operand

//Вывод операнда
if(cmd.Op2.type != o_void)
  {
  out_symbol(',');//вывод разделителя между операндами
  //если неуказан флаг UAS_NOSPA ставим пробел
  if(!(ash.uflag & UAS_NOSPA)) OutChar(' ');
  out_one_operand(1);
  }

if(cmd.Op3.type != o_void)
  {
  out_symbol(',');
  if(!(ash.uflag & UAS_NOSPA)) OutChar(' ');
  out_one_operand(2);
  }

if(isVoid(cmd.ea, uFlag, 0)) OutImmChar(cmd.Op1);
if(isVoid(cmd.ea, uFlag, 1)) OutImmChar(cmd.Op2);
if(isVoid(cmd.ea, uFlag, 2)) OutImmChar(cmd.Op3);

term_output_buffer();

gl_comm = 1;
MakeLine(buf);
}
Esempio n. 3
0
File: out.cpp Progetto: nealey/vera
void out( void )
{
    char buf[MAXSTR];

    init_output_buffer(buf, sizeof(buf));
    OutMnem();

    out_one_operand( 0 );

    if( cmd.Op2.type != o_void )
    {
        out_symbol( ',' );
        OutChar( ' ' );
        out_one_operand( 1 );
    }

    if( cmd.Op3.type != o_void )
    {
        out_symbol( ',' );
        OutChar( ' ' );
        out_one_operand( 2 );
    }

    if( isVoid( cmd.ea, uFlag, 0 ) )    OutImmChar( cmd.Op1 );
    if( isVoid( cmd.ea, uFlag, 1 ) )    OutImmChar( cmd.Op2 );
    if( isVoid( cmd.ea, uFlag, 2 ) )    OutImmChar( cmd.Op3 );

    term_output_buffer();
    gl_comm = 1;
    MakeLine( buf );
}
Esempio n. 4
0
// outputs an instruction
void idaapi out(void) {
    char buf[MAXSTR];

    init_output_buffer(buf, sizeof(buf));

    OutMnem();
    out_one_operand(0);        // output the first operand

    if ( cmd.Op2.type != o_void ) {
        out_symbol(',');
        OutChar(' ');
        out_one_operand(1);
    }

    if ( cmd.Op3.type != o_void ) {
        out_symbol(',');
        OutChar(' ');
        out_one_operand(2);
    }

    // output a character representation of the immediate values
    // embedded in the instruction as comments
    if ( isVoid(cmd.ea,uFlag,0)) OutImmChar(cmd.Op1 );
    if ( isVoid(cmd.ea,uFlag,1)) OutImmChar(cmd.Op2 );
    if ( isVoid(cmd.ea,uFlag,2)) OutImmChar(cmd.Op3 );

    term_output_buffer();                   // terminate the output string
    gl_comm = 1;                            // ask to attach a possible user-
                                            // defined comment to it
    MakeLine(buf);                          // pass the generated line to the
                                            // kernel
}
Esempio n. 5
0
//----------------------------------------------------------------------
// основная выводилка команд
void N78K_out(void)
{
  char buf[MAXSTR];
#if IDP_INTERFACE_VERSION > 37
   init_output_buffer(buf, sizeof(buf)); // setup the output pointer
#else
  uFlag = getFlags(cmd.ea);
   u_line = buf;
#endif
   // выведем мнемонику
   OutMnem();

   // выведем первый операнд
   if(cmd.Op1.type!=o_void)out_one_operand(0);
   // выведем второй операнд
   if(cmd.Op2.type != o_void) {
     out_symbol(',');
     OutChar(' ');
     out_one_operand(1);
   }
   // выведем непосредственные данные, если они есть
   if(isVoid(cmd.ea, uFlag, 0)) OutImmChar(cmd.Op1);
   if(isVoid(cmd.ea, uFlag, 1)) OutImmChar(cmd.Op2);
#if IDP_INTERFACE_VERSION > 37
   term_output_buffer();
#else
  *u_line = '\0';
#endif
   gl_comm = 1;
   MakeLine(buf);
}
Esempio n. 6
0
//----------------------------------------------------------------------
void out(void)
{
  char buf[MAXSTR];
  // output .org for enties without any labels
  if ( !has_any_name(uFlag) && helper.altval(cmd.ea) )
  {
    btoa(buf, sizeof(buf), cmd.ip);
    printf_line(inf.indent, COLSTR("%s %s", SCOLOR_ASMDIR), ash.origin, buf);
  }

  init_output_buffer(buf, sizeof(buf));

  OutMnem();

  out_one_operand(0);
  if ( cmd.Op2.type != o_void )
  {
    out_symbol(',');
    OutChar(' ');
    out_one_operand(1);
  }

  if ( isVoid(cmd.ea, uFlag, 0) ) OutImmChar(cmd.Op1);
  if ( isVoid(cmd.ea, uFlag, 1) ) OutImmChar(cmd.Op2);

  term_output_buffer();

  gl_comm = 1;
  MakeLine(buf);
}
Esempio n. 7
0
//----------------------------------------------------------------------
void out(void)
{
  char buf[MAXSTR];
  init_output_buffer(buf, sizeof(buf));

  const char *postfix = NULL;
       if ( cmd.auxpref & aux_byte ) postfix = ".b";
  else if ( cmd.auxpref & aux_word ) postfix = ".w";
  else if ( cmd.auxpref & aux_f    ) postfix = "/f";
  else if ( cmd.auxpref & aux_ne   ) postfix = "/ne";
  else if ( cmd.auxpref & aux_eq   ) postfix = "/eq";
  OutMnem(8, postfix);

  out_one_operand(0);
  if ( cmd.Op2.type != o_void )
  {
    out_symbol(',');
    OutChar(' ');
    out_one_operand(1);
  }

  if ( isVoid(cmd.ea, uFlag, 0) ) OutImmChar(cmd.Op1);
  if ( isVoid(cmd.ea, uFlag, 1) ) OutImmChar(cmd.Op2);

  term_output_buffer();
  gl_comm = 1;
  MakeLine(buf);
}
Esempio n. 8
0
File: out.cpp Progetto: nealey/vera
// Output an instruction
void out(void) {

    //
    // print insn mnemonic
    //

    char buf[MAXSTR];
    init_output_buffer(buf, sizeof(buf));

    char postfix[5];
    postfix[0] = '\0';

    if ( is_jmp_cc(cmd.itype) )
        qstrncpy(postfix, ConditionCodes[cmd.auxpref], sizeof(postfix));

    OutMnem(8, postfix);

    //
    // print insn operands
    //

    out_one_operand(0);        // output the first operand

    if ( cmd.Op2.type != o_void ) {
        out_symbol(',');
        OutChar(' ');
        out_one_operand(1);
    }

    if ( cmd.Op3.type != o_void ) {
        out_symbol(',');
        OutChar(' ');
        out_one_operand(2);
    }

    // output a character representation of the immediate values
    // embedded in the instruction as comments
    if ( isVoid(cmd.ea,uFlag,0)) OutImmChar(cmd.Op1 );
    if ( isVoid(cmd.ea,uFlag,1)) OutImmChar(cmd.Op2 );
    if ( isVoid(cmd.ea,uFlag,2)) OutImmChar(cmd.Op3 );

    if ( gr_cmt != NULL ) {
        OutChar(' ');
        out_line(ash.cmnt, COLOR_AUTOCMT);
        OutChar(' ');
        out_line(gr_cmt, COLOR_AUTOCMT);
        if ( ash.cmnt2 != NULL ) {
            OutChar(' ');
            out_line(ash.cmnt2, COLOR_AUTOCMT);
        }
        gr_cmt = NULL;
    }

    term_output_buffer();                   // terminate the output string
    gl_comm = 1;                            // ask to attach a possible user-
                                            // defined comment to it
    MakeLine(buf);                          // pass the generated line to the
                                            // kernel
}
Esempio n. 9
0
//----------------------------------------------------------------------
void out(void)
{
  char buf[MAXSTR];
  init_output_buffer(buf, sizeof(buf));

  int op;

  if (!(cmd.SpecialModes & TMS_MODE_USER_PARALLEL))
  {
    if ((cmd.SpecialModes & TMS_MODE_LR) || (cmd.SpecialModes & TMS_MODE_CR))
    {
      out_line(cmd.get_canon_mnem(), COLOR_INSN);
      out_line((cmd.SpecialModes & TMS_MODE_LR) ? ".lr ":".cr ", COLOR_INSN);
    }
    else
      OutMnem();
  }
  else
  { // user-defined parallelism
    out_line("|| ", COLOR_INSN);
    out_line(cmd.get_canon_mnem(), COLOR_INSN);
    out_line(" ", COLOR_INSN);
  }

  for (op = 0; op < UA_MAXOP; op++)
  {
    if (cmd.Operands[op].type == o_void) break;
    if (op != 0) // not the first operand
    {
      if (cmd.Parallel != TMS_PARALLEL_BIT && op == cmd.Parallel) // multi-line instruction
      {
        term_output_buffer();
        MakeLine(buf);
        // print the second instruction line
        init_output_buffer(buf, sizeof(buf));
        if (cmd.SpecialModes & TMS_MODE_SIMULATE_USER_PARALLEL)
          out_line("|| ", COLOR_INSN);
        else
          out_line(":: ", COLOR_INSN);
        const char *insn2 = cmd.get_canon_mnem();
        insn2 += strlen(insn2);
        insn2++;
        out_line(insn2, COLOR_INSN);
      }
      else
        out_symbol(',');
      OutChar(' ');
    }
    // print the operand
    out_one_operand(op);
  }

  // print immediate values
  for (op = 0; op < UA_MAXOP; op++)
    if ( isVoid(cmd.ea, uFlag, op) ) OutImmChar(cmd.Operands[op]);

  term_output_buffer();
  gl_comm = 1;
  MakeLine(buf);
}
Esempio n. 10
0
/*
#<pydoc>
def OutImmChar(op, outflags = 0):
    """
    Output operand value as a commented character constant
    @param op: operand (of type op_t)
    @return: None
    """
    pass
#</pydoc>
*/
static void py_OutImmChar(PyObject *x)
{
  PYW_GIL_CHECK_LOCKED_SCOPE();
  op_t *op = op_t_get_clink(x);
  if ( op != NULL )
    OutImmChar(*op);
}
Esempio n. 11
0
File: out.cpp Progetto: nealey/vera
//----------------------------------------------------------------------
void idaapi out(void)
{
  char buf[MAXSTR];
  init_output_buffer(buf, sizeof(buf));

  OutMnem();
  out_one_operand(0);
  if ( cmd.Op2.type != o_void )
  {
    out_symbol(',');
    OutChar(' ');
    out_one_operand(1);
    if ( cmd.IsParallel )
    { // new line for Parallel instructions
      term_output_buffer();
      MakeLine(buf);
      init_output_buffer(buf, sizeof(buf));
      out_line("|| ", COLOR_INSN);
      const char *insn2 = NULL;
      switch ( cmd.itype )
      {
        case TMS320C54_ld_mac:  insn2 = "mac  "; break;
        case TMS320C54_ld_macr: insn2 = "macr "; break;
        case TMS320C54_ld_mas:  insn2 = "mas  "; break;
        case TMS320C54_ld_masr: insn2 = "masr "; break;
        case TMS320C54_st_add:  insn2 = "add  "; break;
        case TMS320C54_st_sub:  insn2 = "sub  "; break;
        case TMS320C54_st_ld:   insn2 = "ld   "; break;
        case TMS320C54_st_mpy:  insn2 = "mpy  "; break;
        case TMS320C54_st_mac:  insn2 = "mac  "; break;
        case TMS320C54_st_macr: insn2 = "macr "; break;
        case TMS320C54_st_mas:  insn2 = "mas  "; break;
        case TMS320C54_st_masr: insn2 = "masr "; break;
        default: warning("interr: out parallel instruction");
      }
      out_line(insn2, COLOR_INSN);
    }
    if ( cmd.Op3.type != o_void )
    {
      if ( !cmd.IsParallel )
      {
        out_symbol(',');
        OutChar(' ');
      }
      out_one_operand(2);
      if ( cmd.Op4_type != 0 )
      {
        out_symbol(',');
        OutChar(' ');
        switch ( cmd.Op4_type )
        {
          case o_reg:
            out_register(ph.regNames[cmd.Op4_value]);
            break;
          case o_cond8:
            out_cond8(cmd.Op4_value);
            break;
          default:
            break;
        }
      }
    }
  }
  if ( isVoid(cmd.ea, uFlag, 0) ) OutImmChar(cmd.Op1);
  if ( isVoid(cmd.ea, uFlag, 1) ) OutImmChar(cmd.Op2);
  if ( isVoid(cmd.ea, uFlag, 2) ) OutImmChar(cmd.Op3);

  term_output_buffer();
  gl_comm = 1;
  MakeLine(buf);
}
Esempio n. 12
0
// output an instruction and its operands
void idaapi out(void)
{
  char buf[MAXSTR];
  init_output_buffer(buf, sizeof(buf));     // setup the output pointer

  // if this DSP instruction in executed in parallel with a NOP instruction
  // (example: nop || machi r1, r2), first print the NOP.
  if ( cmd.segpref & NEXT_INSN_PARALLEL_DSP )
  {
    out_line("nop", COLOR_INSN);
    OutChar(' ');
    out_symbol('|');
    out_symbol('|');
    OutChar(' ');
  }

  char postfix[3];                        // postfix to eventually insert after the insn name
  postfix[0] = '\0';                      // postfix is null by default

  // use synthetic option is selected
  if ( use_synthetic_insn() )
  {
    if ( cmd.segpref & SYNTHETIC_SHORT )
      qstrncpy(postfix, (cmd.itype == m32r_ldi ? "8" : ".s"), sizeof(postfix));
    if ( cmd.segpref & SYNTHETIC_LONG )
      qstrncpy(postfix, (cmd.itype == m32r_ldi ? "16" : ".l"), sizeof(postfix));
  }

  OutMnem(8, postfix);

  out_one_operand(0);                   // output the first operand

  if ( cmd.Op2.type != o_void )
  {
    out_symbol(',');
    OutChar(' ');
    out_one_operand(1);               // output the second operand
  }

  if ( cmd.Op3.type != o_void )
  {
    out_symbol(',');
    OutChar(' ');
    out_one_operand(2);               // output the third operand
  }

  // output a character representation of the immediate values
  // embedded in the instruction as comments
  if ( isVoid(cmd.ea,uFlag,0) ) OutImmChar(cmd.Op1);
  if ( isVoid(cmd.ea,uFlag,1) ) OutImmChar(cmd.Op2);
  if ( isVoid(cmd.ea,uFlag,2) ) OutImmChar(cmd.Op3);

  // print a parallel NOP instruction unless the current instruction
  // is either push or pop (in this special case, nop cannot be executed in //)
  if ( (cmd.itype != m32r_push && cmd.itype != m32r_pop)
    && cmd.segpref & NEXT_INSN_PARALLEL_NOP )
  {
    // don't print NOP if the instruction was ld/st reg, fp, and has been converted to ld/st reg, @(arg, fp)
    // (in other words, in the second operand is a stack variable).
    // because the o_displ form of ld/st insn is 32 bits, and cannot handle a parallel nop.
    if ( (cmd.itype != m32r_ld && cmd.itype != m32r_st) || !isStkvar1(uFlag) )
    {
      if ( cmd.Op1.type != o_void )
        OutChar(' ');
      out_symbol('|');
      out_symbol('|');
      OutChar(' ');
      out_line("nop", COLOR_INSN);
    }
  }

  if ( cmd.segpref & NEXT_INSN_PARALLEL_OTHER )
  {
    if ( cmd.Op1.type != o_void )
      OutChar(' ');
    out_symbol('|');
    out_symbol('|');
    out_symbol('\\');
  }

  term_output_buffer();                 // terminate the output string
  gl_comm = 1;                          // ask to attach a possible user-
                                        // defined comment to it
  MakeLine(buf);                        // pass the generated line to the
                                        // kernel
}
Esempio n. 13
0
File: out.cpp Progetto: nealey/vera
//----------------------------------------------------------------------
void out(void)
{
  char buf[MAXSTR];
  init_output_buffer(buf, sizeof(buf));

  // output instruction mnemonics
  char postfix[10];
  postfix[0] = '\0';

  OutMnem(8);

  bool comma = out_one_operand(0);
  if ( cmd.Op2.type != o_void )
  {
    if ( comma ) out_symbol(',');
    out_one_operand(1);
  }
  if ( cmd.Op3.type != o_void )
  {
    out_symbol(',');
    out_one_operand(2);
  }




  if ( isVoid(cmd.ea, uFlag, 0) ) OutImmChar(cmd.Op1);
  if ( isVoid(cmd.ea, uFlag, 1) ) OutImmChar(cmd.Op2);
  if ( isVoid(cmd.ea, uFlag, 3) ) OutImmChar(cmd.Op3);

  switch ( cmd.itype )
  {
    case OAK_Dsp_callr:
    case OAK_Dsp_ret:
    case OAK_Dsp_br:
    case OAK_Dsp_call:
    case OAK_Dsp_reti:
    case OAK_Dsp_brr:
    case OAK_Dsp_shfc:
    case OAK_Dsp_shr:
    case OAK_Dsp_shr4:
    case OAK_Dsp_shl:
    case OAK_Dsp_shl4:
    case OAK_Dsp_ror:
    case OAK_Dsp_rol:
    case OAK_Dsp_clr:
    case OAK_Dsp_not:
    case OAK_Dsp_neg:
    case OAK_Dsp_rnd:
    case OAK_Dsp_pacr:
    case OAK_Dsp_clrr:
    case OAK_Dsp_inc:
    case OAK_Dsp_dec:
    case OAK_Dsp_copy:
    case OAK_Dsp_maxd:
    case OAK_Dsp_max:
    case OAK_Dsp_min:
            qsnprintf(postfix, sizeof(postfix), "%s%s%s", ( (cmd.auxpref & aux_comma_cc) ? ", ": ""), \
            cc_text[cmd.auxpref & aux_cc], \
            ( (cmd.auxpref & aux_iret_context) ? ", context": "") );
            out_line(postfix, COLOR_REG);
            break;
  }

  term_output_buffer();

  gl_comm = 1;
  MakeLine(buf);
}