libudis86/decode.c
unsigned int
ud_decode(struct ud *u)
{
  inp_start(u);
  clear_insn(u);
  u->le = &ud_lookup_table_list[0];
  u->error = decode_prefixes(u) == -1 || 
             decode_opcode(u)   == -1 ||
             u->error;
  /* Handle decode error. */
  if (u->error) {
    /* clear out the decode data. */
	clear_insn(u);
    /* mark the sequence of bytes as invalid. */
    u->itab_entry = &ud_itab[0]; /* entry 0 is invalid */
    u->mnemonic = u->itab_entry->mnemonic;
  } 

    /* maybe this stray segment override byte
     * should be spewed out?
     */
    if ( !P_SEG( u->itab_entry->prefix ) && 
			u->operand[0].type != UD_OP_MEM &&
            u->operand[1].type != UD_OP_MEM )
        u->pfx_seg = 0;

  u->insn_offset = u->pc; /* set offset of instruction */
  u->asm_buf_fill = 0;   /* set translation buffer index to 0 */
  u->pc += u->inp_ctr;    /* move program counter by bytes decoded */

  /* return number of bytes disassembled. */
  return u->inp_ctr;
}
/* =============================================================================
 * ud_decode() - Instruction decoder. Returns the number of bytes decoded.
 * =============================================================================
 */
Instruction decoder. Returns the number of bytes decoded.
Instruction decoder . Returns the number of bytes decoded .
unsigned int
ud_decode(struct ud *u)
{
  inp_start(u);
  clear_insn(u);
  u->le = &ud_lookup_table_list[0];
  u->error = decode_prefixes(u) == -1 || 
             decode_opcode(u)   == -1 ||
             u->error;
  if (u->error) {
	clear_insn(u);
    u->itab_entry = &ud_itab[0]; 
    u->mnemonic = u->itab_entry->mnemonic;
  } 
    if ( !P_SEG( u->itab_entry->prefix ) && 
			u->operand[0].type != UD_OP_MEM &&
            u->operand[1].type != UD_OP_MEM )
        u->pfx_seg = 0;
  u->insn_offset = u->pc; 
  u->asm_buf_fill = 0;   
  u->pc += u->inp_ctr;    
  return u->inp_ctr;
}
unsigned int ud_decode ( struct ud * u ) { inp_start ( u ) ; clear_insn ( u ) ; u -> le = & ud_lookup_table_list [ 0 ] ; u -> error = decode_prefixes ( u ) == -1 || decode_opcode ( u ) == -1 || u -> error ; if ( u -> error ) { clear_insn ( u ) ; u -> itab_entry = & ud_itab [ 0 ] ; u -> mnemonic = u -> itab_entry -> mnemonic ; } if ( ! P_SEG ( u -> itab_entry -> prefix ) && u -> operand [ 0 ] . type != UD_OP_MEM && u -> operand [ 1 ] . type != UD_OP_MEM ) u -> pfx_seg = 0 ; u -> insn_offset = u -> pc ; u -> asm_buf_fill = 0 ; u -> pc += u -> inp_ctr ; return u -> inp_ctr ; }
ud_decode() - Instruction decoder.
ud_decode () - Instruction decoder .
/* Handle decode error. */ /* clear out the decode data. */ /* mark the sequence of bytes as invalid. */ /* entry 0 is invalid */ /* maybe this stray segment override byte
     * should be spewed out?
     */ /* set offset of instruction */ /* set translation buffer index to 0 */ /* move program counter by bytes decoded */ /* return number of bytes disassembled. */