Latest available version: IDA and decompilers v8.4.240320sp1 see all releases
Hex-Rays logo State-of-the-art binary code analysis tools
email icon

Describes a processor module (IDP). More...

#include <idp.hpp>

Public Types

enum  event_t {
  ev_init , ev_term , ev_newprc , ev_newasm ,
  ev_newfile , ev_oldfile , ev_newbinary , ev_endbinary ,
  ev_set_idp_options , ev_set_proc_options , ev_ana_insn , ev_emu_insn ,
  ev_out_header , ev_out_footer , ev_out_segstart , ev_out_segend ,
  ev_out_assumes , ev_out_insn , ev_out_mnem , ev_out_operand ,
  ev_out_data , ev_out_label , ev_out_special_item , ev_gen_stkvar_def ,
  ev_gen_regvar_def , ev_gen_src_file_lnnum , ev_creating_segm , ev_moving_segm ,
  ev_coagulate , ev_undefine , ev_treat_hindering_item , ev_rename ,
  ev_is_far_jump , ev_is_sane_insn , ev_is_cond_insn , ev_is_call_insn ,
  ev_is_ret_insn , ev_may_be_func , ev_is_basic_block_end , ev_is_indirect_jump ,
  ev_is_insn_table_jump , ev_is_switch , ev_calc_switch_cases , ev_create_switch_xrefs ,
  ev_is_align_insn , ev_is_alloca_probe , ev_delay_slot_insn , ev_is_sp_based ,
  ev_can_have_type , ev_cmp_operands , ev_adjust_refinfo , ev_get_operand_string ,
  ev_get_reg_name , ev_str2reg , ev_get_autocmt , ev_get_bg_color ,
  ev_is_jump_func , ev_func_bounds , ev_verify_sp , ev_verify_noreturn ,
  ev_create_func_frame , ev_get_frame_retsize , ev_get_stkvar_scale_factor , ev_demangle_name ,
  ev_add_cref , ev_add_dref , ev_del_cref , ev_del_dref ,
  ev_coagulate_dref , ev_may_show_sreg , ev_loader_elf_machine , ev_auto_queue_empty ,
  ev_validate_flirt_func , ev_adjust_libfunc_ea , ev_assemble , ev_extract_address ,
  ev_realcvt , ev_gen_asm_or_lst , ev_gen_map_file , ev_create_flat_group ,
  ev_getreg , ev_analyze_prolog , ev_calc_spdelta , ev_calcrel ,
  ev_find_reg_value , ev_find_op_value , ev_replaying_undo , ev_ending_undo ,
  ev_set_code16_mode , ev_get_code16_mode , ev_get_procmod , ev_asm_installed ,
  ev_get_reg_accesses , ev_is_control_flow_guard , ev_broadcast , ev_create_merge_handlers ,
  ev_privrange_changed , ev_cvt64_supval , ev_cvt64_hashval , ev_get_regfinder ,
  ev_last_cb_before_debugger , ev_next_exec_insn = 1000 , ev_calc_step_over , ev_calc_next_eas ,
  ev_get_macro_insn_head , ev_get_dbr_opnum , ev_insn_reads_tbit , ev_clean_tbit ,
  ev_get_idd_opinfo , ev_get_reg_info , ev_update_call_stack , ev_last_cb_before_type_callbacks ,
  ev_setup_til = 2000 , ev_get_abi_info , ev_max_ptr_size , ev_get_default_enum_size ,
  ev_get_cc_regs , ev_obsolete1 , ev_obsolete2 , ev_get_simd_types ,
  ev_calc_cdecl_purged_bytes , ev_calc_purged_bytes , ev_calc_retloc , ev_calc_arglocs ,
  ev_calc_varglocs , ev_adjust_argloc , ev_lower_func_type , ev_equal_reglocs ,
  ev_use_stkarg_type , ev_use_regarg_type , ev_use_arg_types , ev_arg_addrs_ready ,
  ev_decorate_name , ev_arch_changed , ev_get_stkarg_area_info , ev_last_cb_before_loader ,
  ev_loader =3000
}
 Callback notification codes. More...
 
typedef const regval_t &idaapi regval_getter_t(const char *name, const regval_t *regvalues)
 

Public Member Functions

bool has_idp_opts (void) const
 #PR_IDP_OPTS
 
bool has_realcvt (void) const
 #PR_REALCVT
 
bool has_segregs (void) const
 PR_SEGS
 
bool use32 (void) const
 PR_USE64 or PR_USE32
 
bool use64 (void) const
 PR_USE64
 
bool ti (void) const
 PR_TYPEINFO
 
bool stkup (void) const
 PR_STACK_UP
 
bool use_tbyte (void) const
 PR_USE_TBYTE
 
bool use_mappings (void) const
 PR2_MAPPINGS
 
bool has_code16_bit (void) const
 PR2_CODE16_BIT
 
bool supports_macros (void) const
 PR2_MACRO
 
bool supports_calcrel (void) const
 PR2_USE_CALCREL
 
bool calcrel_in_bits (void) const
 PR2_REL_BITS
 
int get_default_segm_bitness (bool is_64bit_app) const
 Get default segment bitness. More...
 
int get_proc_index ()
 
bool delay_slot_insn (ea_t *ea, bool *bexec, bool *fexec)
 Helper function to get the delay slot instruction.
 
ssize_t privrange_changed (const range_t &old_privrange, adiff_t delta, qstring *errbuf=nullptr)
 
ssize_t cvt64_supval (nodeidx_t node, uchar tag, nodeidx_t idx, const uchar *data, size_t datlen, qstring *errbuf=nullptr)
 
ssize_t cvt64_hashval (nodeidx_t node, uchar tag, const char *name, const uchar *data, size_t datlen, qstring *errbuf=nullptr)
 
int get_stkvar_scale (void)
 Get the stack variable scaling factor. More...
 
void ensure_processor (void)
 
size_t sizeof_ldbl () const
 Get size of long double.
 
bool is_funcarg_off (const func_t *pfn, uval_t frameoff) const
 Does the given offset lie within the arguments section?
 
sval_t lvar_off (const func_t *pfn, uval_t frameoff) const
 Does the given offset lie within the local variables section?
 
bool is_lumina_usable () const
 
Byte size

Number of 8bit bytes required to hold one byte of the target processor.

int cbsize (void)
 for code segments
 
int dbsize (void)
 for non-code segments
 

Static Public Member Functions

static ssize_t notify (event_t event_code,...)
 
static ssize_t init (const char *idp_modname)
 
static ssize_t term ()
 
static ssize_t newprc (int pnum, bool keep_cfg)
 
static ssize_t newasm (int asmnum)
 
static ssize_t asm_installed (int asmnum)
 
static ssize_t newfile (const char *fname)
 
static ssize_t oldfile (const char *fname)
 
static ssize_t newbinary (const char *filename, qoff64_t fileoff, ea_t basepara, ea_t binoff, uint64 nbytes)
 
static ssize_t endbinary (bool ok)
 
static ssize_t creating_segm (segment_t *seg)
 
static ssize_t assemble (uchar *_bin, ea_t ea, ea_t cs, ea_t ip, bool _use32, const char *line)
 
static ssize_t ana_insn (insn_t *out)
 
static ssize_t emu_insn (const insn_t &insn)
 
static ssize_t out_header (outctx_t &ctx)
 
static ssize_t out_footer (outctx_t &ctx)
 
static ssize_t out_segstart (outctx_t &ctx, segment_t *seg)
 
static ssize_t out_segend (outctx_t &ctx, segment_t *seg)
 
static ssize_t out_assumes (outctx_t &ctx)
 
static ssize_t out_insn (outctx_t &ctx)
 
static ssize_t out_mnem (outctx_t &ctx)
 
static ssize_t out_operand (outctx_t &ctx, const op_t &op)
 
static ssize_t out_data (outctx_t &ctx, bool analyze_only)
 
static ssize_t out_label (outctx_t &ctx, const char *colored_name)
 
static ssize_t out_special_item (outctx_t &ctx, uchar segtype)
 
static ssize_t gen_stkvar_def (outctx_t &ctx, const class member_t *mptr, sval_t v)
 
static ssize_t gen_regvar_def (outctx_t &ctx, regvar_t *v)
 
static ssize_t gen_src_file_lnnum (outctx_t &ctx, const char *file, size_t lnnum)
 
static ssize_t rename (ea_t ea, const char *new_name, int flags)
 
static ssize_t may_show_sreg (ea_t current_ea)
 
static ssize_t coagulate (ea_t start_ea)
 
static void auto_queue_empty (int type)
 
static ssize_t func_bounds (int *possible_return_code, func_t *pfn, ea_t max_func_end_ea)
 
static ssize_t may_be_func (const insn_t &insn, int state)
 
static ssize_t is_sane_insn (const insn_t &insn, int no_crefs)
 
static ssize_t cmp_operands (const op_t &op1, const op_t &op2)
 
static ssize_t is_jump_func (func_t *pfn, ea_t *jump_target, ea_t *func_pointer)
 
static ssize_t is_basic_block_end (const insn_t &insn, bool call_insn_stops_block)
 
static ssize_t getreg (uval_t *rv, int regnum)
 
static ssize_t undefine (ea_t ea)
 
static ssize_t moving_segm (segment_t *seg, ea_t to, int flags)
 
static ssize_t is_sp_based (const insn_t &insn, const op_t &x)
 
static ssize_t is_far_jump (int icode)
 
static ssize_t is_call_insn (const insn_t &insn)
 
static ssize_t is_ret_insn (const insn_t &insn, bool strict)
 
static ssize_t is_align_insn (ea_t ea)
 
static ssize_t can_have_type (const op_t &op)
 
static ssize_t get_stkvar_scale_factor ()
 
static ssize_t demangle_name (int32 *res, qstring *out, const char *name, uint32 disable_mask, int demreq)
 
static ssize_t create_flat_group (ea_t image_base, int bitness, sel_t dataseg_sel)
 
static ssize_t is_alloca_probe (ea_t ea)
 
static ssize_t get_reg_name (qstring *buf, int reg, size_t width, int reghi)
 
static ssize_t gen_asm_or_lst (bool starting, FILE *fp, bool is_asm, int flags, void *outline)
 
static ssize_t gen_map_file (int *nlines, FILE *fp)
 
static ssize_t get_autocmt (qstring *buf, const insn_t &insn)
 
static ssize_t loader_elf_machine (linput_t *li, int machine_type, const char **p_procname, proc_def_t **p_pd, elf_loader_t *ldr, reader_t *reader)
 
static ssize_t is_indirect_jump (const insn_t &insn)
 
static ssize_t verify_noreturn (func_t *pfn)
 
static ssize_t verify_sp (func_t *pfn)
 
static ssize_t create_func_frame (func_t *pfn)
 
static ssize_t get_frame_retsize (int *retsize, const func_t *pfn)
 
static ssize_t analyze_prolog (ea_t fct_ea)
 
static ssize_t calc_spdelta (sval_t *spdelta, const insn_t &ins)
 
static ssize_t calcrel (bytevec_t *out_relbits, size_t *out_consumed, ea_t ea)
 
static ssize_t get_reg_accesses (reg_accesses_t *accvec, const insn_t &insn, int flags)
 
static ssize_t is_control_flow_guard (int *p_reg, const insn_t *insn)
 
static ssize_t find_reg_value (uval_t *out, const insn_t &insn, int reg)
 
static ssize_t find_op_value (uval_t *out, const insn_t &insn, int op)
 
static ssize_t treat_hindering_item (ea_t hindering_item_ea, flags64_t new_item_flags, ea_t new_item_ea, asize_t new_item_length)
 
static ssize_t extract_address (ea_t *out_ea, ea_t screen_ea, const char *string, size_t x)
 
static ssize_t str2reg (const char *regname)
 
static ssize_t is_switch (switch_info_t *si, const insn_t &insn)
 
static ssize_t create_switch_xrefs (ea_t jumpea, const switch_info_t &si)
 
static ssize_t calc_switch_cases (void *casevec, eavec_t *targets, ea_t insn_ea, const switch_info_t &si)
 
static ssize_t get_bg_color (bgcolor_t *color, ea_t ea)
 
static ssize_t validate_flirt_func (ea_t start_ea, const char *funcname)
 
static ssize_t get_operand_string (qstring *buf, const insn_t &insn, int opnum)
 
static ssize_t add_cref (ea_t from, ea_t to, cref_t type)
 
static ssize_t add_dref (ea_t from, ea_t to, dref_t type)
 
static ssize_t del_cref (ea_t from, ea_t to, bool expand)
 
static ssize_t del_dref (ea_t from, ea_t to)
 
static ssize_t coagulate_dref (ea_t from, ea_t to, bool may_define, ea_t *code_ea)
 
static const char * set_idp_options (const char *keyword, int vtype, const void *value, bool idb_loaded=true)
 
static ssize_t set_proc_options (const char *options, int confidence)
 
static ssize_t adjust_libfunc_ea (const idasgn_t &sig, const libfunc_t &libfun, ea_t *ea)
 
static fpvalue_error_t realcvt (void *m, fpvalue_t *e, uint16 swt)
 
static ssize_t adjust_refinfo (refinfo_t *ri, ea_t ea, int n, const fixup_data_t &fd)
 
static ssize_t is_cond_insn (const insn_t &insn)
 
static ssize_t set_code16_mode (ea_t ea, bool code16=true)
 
static bool get_code16_mode (ea_t ea)
 
static ssize_t next_exec_insn (ea_t *target, ea_t ea, int tid, regval_getter_t *_getreg, const regval_t &regvalues)
 
static ssize_t calc_step_over (ea_t *target, ea_t ip)
 
static ssize_t get_macro_insn_head (ea_t *head, ea_t ip)
 
static ssize_t get_dbr_opnum (int *opnum, const insn_t &insn)
 
static ssize_t insn_reads_tbit (const insn_t &insn, regval_getter_t *_getreg, const regval_t &regvalues)
 
static ssize_t get_idd_opinfo (idd_opinfo_t *opinf, ea_t ea, int n, int thread_id, regval_getter_t *_getreg, const regval_t &regvalues)
 
static ssize_t calc_next_eas (eavec_t *res, const insn_t &insn, bool over)
 
static ssize_t clean_tbit (ea_t ea, regval_getter_t *_getreg, const regval_t &regvalues)
 
static const char * get_reg_info (const char *regname, bitrange_t *bitrange)
 Get register information - useful for registers like al, ah, dil, etc. More...
 
static ssize_t update_call_stack (call_stack_t *stack, int tid, regval_getter_t *_getreg, const regval_t &regvalues)
 
static ssize_t setup_til ()
 
static ssize_t max_ptr_size ()
 
static ssize_t calc_cdecl_purged_bytes (ea_t ea)
 
static ssize_t equal_reglocs (const argloc_t &a1, const argloc_t &a2)
 
static ssize_t decorate_name (qstring *outbuf, const char *name, bool mangle, cm_t cc, const tinfo_t &type)
 
static ssize_t calc_retloc (argloc_t *retloc, const tinfo_t &rettype, cm_t cc)
 
static ssize_t calc_varglocs (func_type_data_t *ftd, regobjs_t *regs, relobj_t *stkargs, int nfixed)
 
static ssize_t calc_arglocs (func_type_data_t *fti)
 
static ssize_t use_stkarg_type (ea_t ea, const funcarg_t &arg)
 
static ssize_t use_regarg_type (int *idx, ea_t ea, void *rargs)
 
static ssize_t use_arg_types (ea_t ea, func_type_data_t *fti, void *rargs)
 
static ssize_t calc_purged_bytes (int *p_purged_bytes, const func_type_data_t &fti)
 
static ssize_t get_stkarg_area_info (stkarg_area_info_t *out, cm_t cc)
 
static ssize_t get_cc_regs (callregs_t *regs, cm_t cc)
 
static ssize_t get_simd_types (void *out, const simd_info_t *simd_attrs, const argloc_t *argloc, bool create_tifs)
 
static ssize_t arg_addrs_ready (ea_t caller, int n, const tinfo_t &tif, ea_t *addrs)
 
static ssize_t adjust_argloc (argloc_t *argloc, const tinfo_t *type, int size)
 
static ssize_t lower_func_type (intvec_t *argnums, func_type_data_t *fti)
 
static ssize_t get_abi_info (qstrvec_t *abi_names, qstrvec_t *abi_opts, comp_t comp)
 
static ssize_t arch_changed ()
 
static ssize_t create_merge_handlers (merge_data_t *md)
 
static reg_finder_t * get_regfinder ()
 

Public Attributes

int32 version
 Expected kernel version, should be IDP_INTERFACE_VERSION.
 
int32 id
 one of Processor IDs
 
uint32 flag
 an ORed combination of Processor feature bits
 
uint32 flag2
 an ORed combination of Processor additional feature bits
 
int32 cnbits
 Number of bits in a byte for code segments (usually 8). More...
 
int32 dnbits
 Number of bits in a byte for non-code segments (usually 8). More...
 
const asm_t *const * assemblers
 pointer to array of target More...
 
hook_cb_t_notify
 Event notification handler.
 
const char *const * reg_names
 array of register names
 
int32 regs_num
 number of registers
 
size_t tbyte_size
 Size of long double (tbyte) for this processor (meaningful only if asm_t::a_tbyte != nullptr)
 
char real_width [4]
 Number of digits in floating numbers after the decimal point. More...
 
int32 icode_return
 Icode of return instruction. It is ok to give any of possible return instructions.
 
void * unused_slot
 Reserved, currently equals to nullptr.
 
Names

IDP module may support several compatible processors.

The following arrays define processor names:

const char *const * psnames
 short processor names (nullptr terminated). More...
 
const char *const * plnames
 long processor names (nullptr terminated). More...
 
Segment registers

Segment register information (use virtual CS and DS registers if your processor doesn't have segment registers):

int32 reg_first_sreg
 number of first segment register
 
int32 reg_last_sreg
 number of last segment register
 
int32 segreg_size
 size of a segment register in bytes
 
Virtual segment registers

If your processor doesn't have segment registers, you should define 2 virtual segment registers for CS and DS.

Let's call them rVcs and rVds.

int32 reg_code_sreg
 number of CS register
 
int32 reg_data_sreg
 number of DS register
 
Empirics
const bytes_tcodestart
 Array of typical code start sequences. More...
 
const bytes_tretcodes
 Array of 'return' instruction opcodes. More...
 

Instruction set

int32 instruc_start
 icode of the first instruction
 
int32 instruc_end
 icode of the last instruction + 1
 
const instruc_tinstruc
 Array of instructions.
 
bool is_canon_insn (uint16 itype) const
 Does the given value specify a valid instruction for this instruction set?. More...
 
const char * get_canon_mnem (uint16 itype) const
 Get the instruction name.
 
uint32 get_canon_feature (uint16 itype) const
 Get the instruction features (combination of Instruction feature bits)
 

Detailed Description

Describes a processor module (IDP).

An IDP file may have only one such structure called LPH. The kernel will copy it to ::ph structure and use ::ph.

Member Enumeration Documentation

◆ event_t

Callback notification codes.

These are passed to notify() when certain events occur in the kernel, allowing the processor module to take the appropriate action.

If you are not developing a processor module, you do not need to use the codes directly many of them already have a corresponding function to use instead ( is_call_insn vs is_call_insn(ea_t), for example).

If you are developing a processor module, your notify() function must implement the desired behavior when called with a given code. Not all events need to be handled, some of them are optional.

Enumerator
ev_init 

The IDP module is just loaded.

Parameters
idp_modname(const char *) processor module name
Return values
<0on failure
ev_term 

The IDP module is being unloaded.

ev_newprc 

Before changing processor type.

Parameters
pnum(int) processor number in the array of processor names
keep_cfg(bool) true: do not modify kernel configuration
Return values
1ok
<0prohibit
ev_newasm 

Before setting a new assembler.

Parameters
asmnum(int) See also ev_asm_installed
ev_newfile 

A new file has been loaded.

Parameters
fname(char *) input file name
ev_oldfile 

An old file has been loaded.

Parameters
fname(char *) input file name
ev_newbinary 

IDA is about to load a binary file.

Parameters
filename(char *) binary file name
fileoff(qoff64_t) offset in the file
basepara(::ea_t) base loading paragraph
binoff(::ea_t) loader offset
nbytes(::uint64) number of bytes to load
ev_endbinary 

IDA has loaded a binary file.

Parameters
ok(bool) file loaded successfully?
ev_set_idp_options 

Set IDP-specific configuration option Also see set_options_t in config.hpp.

Parameters
keyword(const char *)
value_type(int)
value(const void *)
errbuf(const char **) - a error message will be returned here (can be nullptr)
idb_loaded(bool) true if the ev_oldfile/ev_newfile events have been generated
Return values
1ok
0not implemented
-1error (and message in errbuf)
ev_set_proc_options 

Called if the user specified an option string in the command line: -p<processor name>:<options>.

Can be used for setting a processor subtype. Also called if option string is passed to set_processor_type() and IDC's SetProcessorType().

Parameters
options(const char *)
confidence(int) 0: loader's suggestion 1: user's decision
Return values
<0if bad option string
ev_ana_insn 

Analyze one instruction and fill 'out' structure.

This function shouldn't change the database, flags or anything else. All these actions should be performed only by emu_insn() function. \insn_t{ea} contains address of instruction to analyze.

Parameters
out(insn_t *)
Returns
length of the instruction in bytes, 0 if instruction can't be decoded.
Return values
0if instruction can't be decoded.
ev_emu_insn 

Emulate instruction, create cross-references, plan to analyze subsequent instructions, modify flags etc.

Upon entrance to this function, all information about the instruction is in 'insn' structure.

Parameters
insn(const insn_t *)
Return values
1ok
-1the kernel will delete the instruction
ev_out_header 

Function to produce start of disassembled text.

Parameters
outctx(outctx_t *)
Return values
void
ev_out_footer 

Function to produce end of disassembled text.

Parameters
outctx(outctx_t *)
Return values
void
ev_out_segstart 

Function to produce start of segment.

Parameters
outctx(outctx_t *)
seg(segment_t *)
Return values
1ok
0not implemented
ev_out_segend 

Function to produce end of segment.

Parameters
outctx(outctx_t *)
seg(segment_t *)
Return values
1ok
0not implemented
ev_out_assumes 

Function to produce assume directives when segment register value changes.

Parameters
outctx(outctx_t *)
Return values
1ok
0not implemented
ev_out_insn 

Generate text representation of an instruction in 'ctx.insn' outctx_t provides functions to output the generated text.

This function shouldn't change the database, flags or anything else. All these actions should be performed only by emu_insn() function.

Parameters
outctx(outctx_t *)
Return values
void
ev_out_mnem 

Generate instruction mnemonics.

This callback should append the colored mnemonics to ctx.outbuf Optional notification, if absent, out_mnem will be called.

Parameters
outctx(outctx_t *)
Return values
1if appended the mnemonics
0not implemented
ev_out_operand 

Generate text representation of an instruction operand outctx_t provides functions to output the generated text.

All these actions should be performed only by emu_insn() function.

Parameters
outctx(outctx_t *)
op(const op_t *)
Return values
1ok
-1operand is hidden
ev_out_data 

Generate text representation of data items This function may change the database and create cross-references if analyze_only is set.

Parameters
outctx(outctx_t *)
analyze_only(bool)
Return values
1ok
0not implemented
ev_out_label 

The kernel is going to generate an instruction label line or a function header.

Parameters
outctx(outctx_t *)
colored_name(const char *)
Return values
<0if the kernel should not generate the label
0not implemented or continue
ev_out_special_item 

Generate text representation of an item in a special segment i.e.

absolute symbols, externs, communal definitions etc

Parameters
outctx(outctx_t *)
segtype(uchar)
Return values
1ok
0not implemented
-1overflow
ev_gen_stkvar_def 

Generate stack variable definition line Default line is varname = type ptr value, where 'type' is one of byte,word,dword,qword,tbyte.

Parameters
outctx(outctx_t *)
mptr(const member_t *)
v(sval_t)
Return values
1ok
0not implemented
ev_gen_regvar_def 

Generate register variable definition line.

Parameters
outctx(outctx_t *)
v(regvar_t *)
Return values
>0ok, generated the definition text
0not implemented
ev_gen_src_file_lnnum 

Callback: generate analog of:

< #line "file.c" 123
<

directive.

Parameters
outctx(outctx_t *) output context
file(const char *) source file (may be nullptr)
lnnum(size_t) line number
Return values
1directive has been generated
0not implemented
ev_creating_segm 

A new segment is about to be created.

Parameters
seg(segment_t *)
Return values
1ok
<0segment should not be created
ev_moving_segm 

May the kernel move the segment?

Parameters
seg(segment_t *) segment to move
to(::ea_t) new segment start address
flags(int) combination of Move segment flags
Return values
0yes
<0the kernel should stop
ev_coagulate 

Try to define some unexplored bytes.

This notification will be called if the kernel tried all possibilities and could not find anything more useful than to convert to array of bytes. The module can help the kernel and convert the bytes into something more useful.

Parameters
start_ea(::ea_t)
Returns
number of converted bytes
ev_undefine 

An item in the database (insn or data) is being deleted.

Parameters
ea(ea_t)
Return values
1do not delete srranges at the item end
0srranges can be deleted
ev_treat_hindering_item 

An item hinders creation of another item.

Parameters
hindering_item_ea(::ea_t)
new_item_flags(flags64_t) (0 for code)
new_item_ea(::ea_t)
new_item_length(::asize_t)
Return values
0no reaction
!=0the kernel may delete the hindering item
ev_rename 

The kernel is going to rename a byte.

Parameters
ea(::ea_t)
new_name(const char *)
flags(int) Set name flags
Return values
<0if the kernel should not rename it.
2to inhibit the notification. I.e., the kernel should not rename, but 'set_name()' should return 'true'. also see renamed the return value is ignored when kernel is going to delete name
ev_is_far_jump 

is indirect far jump or call instruction? meaningful only if the processor has 'near' and 'far' reference types

Parameters
icode(int)
Return values
0not implemented
1yes
-1no
ev_is_sane_insn 

Is the instruction sane for the current file type?.

Parameters
insn(const insn_t*) the instruction
no_crefs(int) 1: the instruction has no code refs to it. ida just tries to convert unexplored bytes to an instruction (but there is no other reason to convert them into an instruction) 0: the instruction is created because of some coderef, user request or another weighty reason.
Return values
>=0ok
<0no, the instruction isn't likely to appear in the program
ev_is_cond_insn 

Is conditional instruction?

Parameters
insn(const insn_t *) instruction address
Return values
1yes
-1no
0not implemented or not instruction
ev_is_call_insn 

Is the instruction a "call"?

Parameters
insn(const insn_t *) instruction
Return values
0unknown
<0no
1yes
ev_is_ret_insn 

Is the instruction a "return"?

Parameters
insn(const insn_t *) instruction
strict(bool) 1: report only ret instructions 0: include instructions like "leave" which begins the function epilog
Return values
0unknown
<0no
1yes
ev_may_be_func 

Can a function start here?

Parameters
insn(const insn_t*) the instruction
state(int) autoanalysis phase 0: creating functions 1: creating chunks
Returns
probability 1..100
Note
Actually IDA uses 3 intervals of a probability: 0..50 not a function, 51..99 a function (IDA needs another proof), 100 a function (no other proofs needed)
ev_is_basic_block_end 

Is the current instruction end of a basic block?.

This function should be defined for processors with delayed jump slots.

Parameters
insn(const insn_t*) the instruction
call_insn_stops_block(bool)
Return values
0unknown
<0no
1yes
ev_is_indirect_jump 

Determine if instruction is an indirect jump.

If CF_JUMP bit cannot describe all jump types jumps, please define this callback.

Parameters
insn(const insn_t*) the instruction
Return values
0use CF_JUMP
1no
2yes
ev_is_insn_table_jump 

Reserved.

ev_is_switch 

Find 'switch' idiom or override processor module's decision.

It will be called for instructions marked with CF_JUMP.

Parameters
si(switch_info_t *), out
insn(const insn_t *) instruction possibly belonging to a switch
Return values
1switch is found, 'si' is filled. IDA will create the switch using the filled 'si'
-1no switch found. This value forbids switch creation by the processor module
0not implemented
ev_calc_switch_cases 

Calculate case values and targets for a custom jump table.

Parameters
casevec(::casevec_t *) vector of case values (may be nullptr)
targets(eavec_t *) corresponding target addresses (my be nullptr)
insn_ea(::ea_t) address of the 'indirect jump' instruction
si(switch_info_t *) switch information
Return values
1ok
<=0failed
ev_create_switch_xrefs 

Create xrefs for a custom jump table.

Parameters
jumpea(::ea_t) address of the jump insn
si(const switch_info_t *) switch information
Returns
must return 1 Must be implemented if module uses custom jump tables, SWI_CUSTOM
ev_is_align_insn 

Is the instruction created only for alignment purposes?.

Do not directly call this function, use is_align_insn()

Parameters
ea(ea_t) - instruction address
Return values
numberof bytes in the instruction
ev_is_alloca_probe 

Does the function at 'ea' behave as __alloca_probe?

Parameters
ea(::ea_t)
Return values
1yes
0no
ev_delay_slot_insn 

Get delay slot instruction.

Parameters
ea(::ea_t *) in: instruction address in question, out: (if the answer is positive) if the delay slot contains valid insn: the address of the delay slot insn else: BADADDR (invalid insn, e.g. a branch)
bexec(bool *) execute slot if jumping, initially set to 'true'
fexec(bool *) execute slot if not jumping, initally set to 'true'
Return values
1positive answer
<=0ordinary insn
Note
Input EA may point to the instruction with a delay slot or to the delay slot instruction itself.
ev_is_sp_based 

Check whether the operand is relative to stack pointer or frame pointer This event is used to determine how to output a stack variable If not implemented, then all operands are sp based by default.

Implement this event only if some stack references use frame pointer instead of stack pointer.

Parameters
mode(int *) out, combination of SP/FP operand flags
insn(const insn_t *)
op(const op_t *)
Return values
0not implemented
1ok
ev_can_have_type 

Can the operand have a type as offset, segment, decimal, etc? (for example, a register AX can't have a type, meaning that the user can't change its representation.

see bytes.hpp for information about types and flags)

Parameters
op(const op_t *)
Return values
0unknown
<0no
1yes
ev_cmp_operands 

Compare instruction operands.

Parameters
op1(const op_t*)
op2(const op_t*)
Return values
1equal
-1not equal
0not implemented
ev_adjust_refinfo 

Called from apply_fixup before converting operand to reference.

Can be used for changing the reference info. (e.g. the PPC module adds REFINFO_NOBASE for some references)

Parameters
ri(refinfo_t *)
ea(::ea_t) instruction address
n(int) operand number
fd(const fixup_data_t *)
Return values
<0do not create an offset
0not implemented or refinfo adjusted
ev_get_operand_string 

Request text string for operand (cli, java, ...).

Parameters
buf(qstring *)
insn(const insn_t*) the instruction
opnum(int) operand number, -1 means any string operand
Return values
0no string (or empty string)
>0original string length without terminating zero
ev_get_reg_name 

Generate text representation of a register.

Most processor modules do not need to implement this callback. It is useful only if processor_t::reg_names[reg] does not provide the correct register name.

Parameters
buf(qstring *) output buffer
reg(int) internal register number as defined in the processor module
width(size_t) register width in bytes
reghi(int) if not -1 then this function will return the register pair
Return values
-1if error
strlen(buf)if success
ev_str2reg 

Convert a register name to a register number.

The register number is the register index in the processor_t::reg_names array Most processor modules do not need to implement this callback It is useful only if processor_t::reg_names[reg] does not provide the correct register names

Parameters
regname(const char *)
Return values
registernumber + 1
0not implemented or could not be decoded
ev_get_autocmt 

Callback: get dynamic auto comment.

Will be called if the autocomments are enabled and the comment retrieved from ida.int starts with '$!'. 'insn' contains valid info.

Parameters
buf(qstring *) output buffer
insn(const insn_t*) the instruction
Return values
1new comment has been generated
0callback has not been handled. the buffer must not be changed in this case
ev_get_bg_color 

Get item background color.

Plugins can hook this callback to color disassembly lines dynamically

Parameters
color(bgcolor_t *), out
ea(::ea_t)
Return values
0not implemented
1color set
ev_is_jump_func 

Is the function a trivial "jump" function?.

Parameters
pfn(func_t *)
jump_target(::ea_t *)
func_pointer(::ea_t *)
Return values
<0no
0don't know
1yes, see 'jump_target' and 'func_pointer'
ev_func_bounds 

find_func_bounds() finished its work.

The module may fine tune the function bounds

Parameters
possible_return_code(int *), in/out
pfn(func_t *)
max_func_end_ea(::ea_t) (from the kernel's point of view)
Return values
void
ev_verify_sp 

All function instructions have been analyzed.

Now the processor module can analyze the stack pointer for the whole function

Parameters
pfn(func_t *)
Return values
0ok
<0bad stack pointer
ev_verify_noreturn 

The kernel wants to set 'noreturn' flags for a function.

Parameters
pfn(func_t *)
Return values
0ok. any other value: do not set 'noreturn' flag
ev_create_func_frame 

Create a function frame for a newly created function Set up frame size, its attributes etc.

Parameters
pfn(func_t *)
Return values
1ok
0not implemented
ev_get_frame_retsize 

Get size of function return address in bytes If this event is not implemented, the kernel will assume.

  • 8 bytes for 64-bit function
  • 4 bytes for 32-bit function
  • 2 bytes otherwise
    Parameters
    frsize(int *) frame size (out)
    pfn(const func_t *), can't be nullptr
    Return values
    1ok
    0not implemented
ev_get_stkvar_scale_factor 

Should stack variable references be multiplied by a coefficient before being used in the stack frame?.

Currently used by TMS320C55 because the references into the stack should be multiplied by 2

Returns
scaling factor
Return values
0not implemented
Note
PR_SCALE_STKVARS should be set to use this callback
ev_demangle_name 

Demangle a C++ (or another language) name into a user-readable string.

This event is called by demangle_name()

Parameters
res(int32 *) value to return from demangle_name()
out(qstring *) output buffer. may be nullptr
name(const char *) mangled name
disable_mask(uint32) flags to inhibit parts of output or compiler info/other (see MNG_)
demreq(demreq_type_t) operation to perform
Return values
1if success
0not implemented
Note
if you call demangle_name() from the handler, protect against recursion!
ev_add_cref 

A code reference is being created.

Parameters
from(::ea_t)
to(::ea_t)
type(cref_t)
Return values
<0cancel cref creation
0not implemented or continue
ev_add_dref 

A data reference is being created.

Parameters
from(::ea_t)
to(::ea_t)
type(dref_t)
Return values
<0cancel dref creation
0not implemented or continue
ev_del_cref 

A code reference is being deleted.

Parameters
from(::ea_t)
to(::ea_t)
expand(bool)
Return values
<0cancel cref deletion
0not implemented or continue
ev_del_dref 

A data reference is being deleted.

Parameters
from(::ea_t)
to(::ea_t)
Return values
<0cancel dref deletion
0not implemented or continue
ev_coagulate_dref 

Data reference is being analyzed.

plugin may correct 'code_ea' (e.g. for thumb mode refs, we clear the last bit)

Parameters
from(::ea_t)
to(::ea_t)
may_define(bool)
code_ea(::ea_t *)
Return values
<0failed dref analysis, >0 done dref analysis
0not implemented or continue
ev_may_show_sreg 

The kernel wants to display the segment registers in the messages window.

Parameters
current_ea(::ea_t)
Return values
<0if the kernel should not show the segment registers. (assuming that the module has done it)
0not implemented
ev_loader_elf_machine 

ELF loader machine type checkpoint.

A plugin check of the 'machine_type'. If it is the desired one, the the plugin fills 'p_procname' with the processor name (one of the names present in processor_t::psnames). 'p_pd' is used to handle relocations, otherwise can be left untouched. This event occurs for each newly loaded ELF file

Parameters
li(linput_t *)
machine_type(int)
p_procname(const char **)
p_pd(proc_def_t **) (see ldr\elf.h)
loader(elf_loader_t *) (see ldr\elf.h)
reader(reader_t *) (see ldr\elf.h)
Return values
e_machinevalue (if it is different from the original e_machine value, procname and 'p_pd' will be ignored and the new value will be used) before replacing pd it is a good idea to delete the previous instance using 'delete pd;' The 'loader' and 'reader' arguments are available starting from IDA v7.7.
ev_auto_queue_empty 

One analysis queue is empty.

Parameters
type(atype_t)
Return values
voidsee also idb_event::auto_empty_finally
ev_validate_flirt_func 

Flirt has recognized a library function.

This callback can be used by a plugin or proc module to intercept it and validate such a function.

Parameters
start_ea(::ea_t)
funcname(const char *)
Return values
-1do not create a function,
0function is validated
ev_adjust_libfunc_ea 

Called when a signature module has been matched against bytes in the database.

This is used to compute the offset at which a particular module's libfunc should be applied.

Parameters
sig(const idasgn_t *)
libfun(const libfunc_t *)
ea(::ea_t *)
Note
'ea' initially contains the ea_t of the start of the pattern match
Return values
1the ea_t pointed to by the third argument was modified.
<=0not modified. use default algorithm.
ev_assemble 

Assemble an instruction.

(display a warning if an error is found).

Parameters
bin(uchar *) pointer to output opcode buffer
ea(::ea_t) linear address of instruction
cs(::ea_t) cs of instruction
ip(::ea_t) ip of instruction
use32(bool) is 32bit segment?
line(const char *) line to assemble
Returns
size of the instruction in bytes
ev_extract_address 

Extract address from a string.

Parameters
out_ea(ea_t *), out
screen_ea(ea_t)
string(const char *)
position(size_t)
Return values
1ok
0kernel should use the standard algorithm
-1error
ev_realcvt 

Floating point -> IEEE conversion.

Parameters
m(void *) ptr to processor-specific floating point value
e(fpvalue_t *) IDA representation of a floating point value
swt(uint16) operation (see realcvt() in ieee.h)
Return values
0not implemented
1ok

ref REAL_ERROR_ on error

ev_gen_asm_or_lst 

Callback: generating asm or lst file.

The kernel calls this callback twice, at the beginning and at the end of listing generation. The processor module can intercept this event and adjust its output

Parameters
starting(bool) beginning listing generation
fp(FILE *) output file
is_asm(bool) true:assembler, false:listing
flags(int) flags passed to gen_file()
outline(html_line_cb_t **) ptr to ptr to outline callback. if this callback is defined for this code, it will be used by the kernel to output the generated lines
Return values
void
ev_gen_map_file 

Generate map file.

If not implemented the kernel itself will create the map file.

Parameters
nlines(int *) number of lines in map file (-1 means write error)
fp(FILE *) output file
Return values
0not implemented
1ok
-1write error
ev_create_flat_group 

Create special segment representing the flat group.

Parameters
image_base(::ea_t)
bitness(int)
dataseg_sel(::sel_t) return value is ignored
ev_getreg 

IBM PC only internal request, should never be used for other purpose Get register value by internal index.

Parameters
regval(uval_t *), out
regnum(int)
Return values
1ok
0not implemented
-1failed (undefined value or bad regnum)
ev_analyze_prolog 

Analyzes function prolog, epilog, and updates purge, and function attributes.

Parameters
ea(::ea_t) start of function
Return values
1ok
0not implemented
ev_calc_spdelta 

Calculate amount of change to sp for the given insn.

This event is required to decompile code snippets.

Parameters
spdelta(sval_t *)
insn(const insn_t *)
Return values
1ok
0not implemented
ev_calcrel 

Reserved.

ev_find_reg_value 

Find register value via a register tracker.

The returned value in 'out' is valid before executing the instruction.

Parameters
out(uval_t *) pointer to the found value
pinsn(const insn_t *) instruction
reg(int) register index
Return values
1if implemented, and value was found
0not implemented, -1 decoding failed, or no value found
ev_find_op_value 

Find operand value via a register tracker.

The returned value in 'out' is valid before executing the instruction.

Parameters
out(uval_t *) pointer to the found value
pinsn(const insn_t *) instruction
opn(int) operand index
Return values
1if implemented, and value was found
0not implemented, -1 decoding failed, or no value found
ev_replaying_undo 

Replaying an undo/redo buffer.

Parameters
action_name(const char *) action that we perform undo/redo for. may be nullptr for intermediary buffers.
vec(const undo_records_t *)
is_undo(bool) true if performing undo, false if performing redo This event may be generated multiple times per undo/redo
ev_ending_undo 

Ended undoing/redoing an action.

Parameters
action_name(const char *) action that we finished undoing/redoing. is not nullptr.
is_undo(bool) true if performing undo, false if performing redo
ev_set_code16_mode 

Some processors have ISA 16-bit mode e.g.

ARM Thumb mode, PPC VLE, MIPS16 Set ISA 16-bit mode

Parameters
ea(ea_t) address to set new ISA mode
code16(bool) true for 16-bit mode, false for 32-bit mode
ev_get_code16_mode 

Get ISA 16-bit mode.

Parameters
ea(ea_t) address to get the ISA mode
Return values
116-bit mode
0not implemented or 32-bit mode
ev_get_procmod 

Get pointer to the processor module object.

All processor modules must implement this. The pointer is returned as size_t.

ev_asm_installed 

After setting a new assembler.

Parameters
asmnum(int) See also ev_newasm
ev_get_reg_accesses 

Get info about the registers that are used/changed by an instruction.

Parameters
accvec(reg_accesses_t*) out: info about accessed registers
insn(const insn_t *) instruction in question
flags(int) reserved, must be 0
Return values
-1if accvec is nullptr
1found the requested access (and filled accvec)
0not implemented
ev_is_control_flow_guard 

Detect if an instruction is a "thunk call" to a flow guard function (equivalent to call reg/return/nop)

Parameters
p_reg(int *) indirect register number, may be -1
insn(const insn_t *) call/jump instruction
Return values
-1no thunk detected
1indirect call
2security check routine call (NOP)
3return thunk
0not implemented
ev_broadcast 

Broadcast call.

Parameters
magic(::int64) a magic number Other parameters and the return value depend on the magic
ev_create_merge_handlers 

Create merge handlers, if needed.

Parameters
md(merge_data_t *) This event is generated immediately after opening idbs.
Returns
must be 0
ev_privrange_changed 

Privrange interval has been moved to a new location.

Most common actions to be done by module in this case: fix indices of netnodes used by module

Parameters
old_privrange(const range_t *) - old privrange interval
delta(::adiff_t)
errbuf(qstring *) - a error message will be returned here (can be nullptr)
Returns
0 Ok
-1 error (and message in errbuf)
ev_cvt64_supval 

perform 32-64 conversion for a netnode array element

Parameters
node(::nodeidx_t)
tag(uchar)
idx(::nodeidx_t)
data(const uchar *)
datlen(::size_t)
errbuf(qstring *) - a error message will be returned here (can be nullptr)
Returns
0 nothing was done
1 converted successfully
-1 error (and message in errbuf)
ev_cvt64_hashval 

perform 32-64 conversion for a hash value

Parameters
node(::nodeidx_t)
tag(uchar)
name(const ::char *)
data(const uchar *)
datlen(::size_t)
errbuf(qstring *) - a error message will be returned here (can be nullptr)
Returns
0 nothing was done
1 converted successfully
-1 error (and message in errbuf)
ev_get_regfinder 

Get pointer to the regfinder object.

This event is called by ::find_reg_value() when it detects that the processor module does not support the ev_find_reg_value event.

Returns
(::reg_finder_t *)
Return values
0reg_finder_t is not supported
ev_last_cb_before_debugger 

START OF DEBUGGER CALLBACKS.

ev_next_exec_insn 

Get next address to be executed This function must return the next address to be executed.

If the instruction following the current one is executed, then it must return BADADDR Usually the instructions to consider are: jumps, branches, calls, returns. This function is essential if the 'single step' is not supported in hardware.

Parameters
target(::ea_t *), out: pointer to the answer
ea(::ea_t) instruction address
tid(int) current therad id
getreg(::processor_t::regval_getter_t *) function to get register values
regvalues(const regval_t *) register values array
Return values
0unimplemented
1implemented
ev_calc_step_over 

Calculate the address of the instruction which will be executed after "step over".

The kernel will put a breakpoint there. If the step over is equal to step into or we cannot calculate the address, return BADADDR.

Parameters
target(::ea_t *) pointer to the answer
ip(::ea_t) instruction address
Return values
0unimplemented
1implemented
ev_calc_next_eas 

Calculate list of addresses the instruction in 'insn' may pass control to.

This callback is required for source level debugging.

Parameters
res(eavec_t *), out: array for the results.
insn(const insn_t*) the instruction
over(bool) calculate for step over (ignore call targets)
Return values
<0incalculable (indirect jumps, for example)
>=0number of addresses of called functions in the array. They must be put at the beginning of the array (0 if over=true)
ev_get_macro_insn_head 

Calculate the start of a macro instruction.

This notification is called if IP points to the middle of an instruction

Parameters
head(::ea_t *), out: answer, BADADDR means normal instruction
ip(::ea_t) instruction address
Return values
0unimplemented
1implemented
ev_get_dbr_opnum 

Get the number of the operand to be displayed in the debugger reference view (text mode).

Parameters
opnum(int *) operand number (out, -1 means no such operand)
insn(const insn_t*) the instruction
Return values
0unimplemented
1implemented
ev_insn_reads_tbit 

Check if insn will read the TF bit.

Parameters
insn(const insn_t*) the instruction
getreg(::processor_t::regval_getter_t *) function to get register values
regvalues(const regval_t *) register values array
Return values
2yes, will generate 'step' exception
1yes, will store the TF bit in memory
0no
ev_clean_tbit 

Clear the TF bit after an insn like pushf stored it in memory.

Parameters
ea(::ea_t) instruction address
getreg(::processor_t::regval_getter_t *) function to get register values
regvalues(const regval_t *) register values array
Return values
1ok
0failed
ev_get_idd_opinfo 

Get operand information.

This callback is used to calculate the operand value for double clicking on it, hints, etc.

Parameters
opinf(idd_opinfo_t *) the output buffer
ea(::ea_t) instruction address
n(int) operand number
thread_id(int) current thread id
getreg(::processor_t::regval_getter_t *) function to get register values
regvalues(const regval_t *) register values array
Return values
1ok
0failed
ev_get_reg_info 

Get register information by its name.

example: "ah" returns:

  • main_regname="eax"
  • bitrange_t = { offset==8, nbits==8 }

This callback may be unimplemented if the register names are all present in processor_t::reg_names and they all have the same size

Parameters
main_regname(const char **), out
bitrange(bitrange_t *), out: position and size of the value within 'main_regname' (empty bitrange == whole register)
regname(const char *)
Return values
1ok
-1failed (not found)
0unimplemented
ev_update_call_stack 

Calculate the call stack trace for the given thread.

This callback is invoked when the process is suspended and should fill the 'trace' object with the information about the current call stack. Note that this callback is NOT invoked if the current debugger backend implements stack tracing via debugger_t::event_t::ev_update_call_stack. The debugger-specific algorithm takes priority. Implementing this callback in the processor module is useful when multiple debugging platforms follow similar patterns, and thus the same processor-specific algorithm can be used for different platforms.

Parameters
stack(call_stack_t *) result
tid(int) thread id
getreg(::processor_t::regval_getter_t *) function to get register values
regvalues(const regval_t *) register values array
Return values
1ok
-1failed
0unimplemented
ev_setup_til 

Setup default type libraries.

(called after loading a new file into the database). The processor module may load tils, setup memory model and perform other actions required to set up the type system. This is an optional callback.

Parameters
none
Return values
void
ev_get_abi_info 

Get all possible ABI names and optional extensions for given compiler abiname/option is a string entirely consisting of letters, digits and underscore.

Parameters
abi_names(qstrvec_t *) - all possible ABis each in form abiname-opt1-opt2-...
abi_opts(qstrvec_t *) - array of all possible options in form "opt:description" or opt:hint-line#description
comp(comp_t) - compiler ID
Return values
0not implemented
1ok
ev_max_ptr_size 

Get maximal size of a pointer in bytes.

Parameters
none
Returns
max possible size of a pointer
ev_get_default_enum_size 

Get default enum size.

Not generated anymore. inf_get_cc_size_e() is used instead

ev_get_cc_regs 

Get register allocation convention for given calling convention.

Parameters
regs(callregs_t *), out
cc(cm_t)
Return values
1
0not implemented
ev_obsolete1 

ev_get_stkarg_offset is obsolete.

See ev_get_stkarg_area_info

ev_obsolete2 

ev_shadow_args_size is obsolete.

See ev_get_stkarg_area_info

ev_get_simd_types 

Get SIMD-related types according to given attributes ant/or argument location.

Parameters
out(::simd_info_vec_t *)
simd_attrs(const simd_info_t *), may be nullptr
argloc(const argloc_t *), may be nullptr
create_tifs(bool) return valid tinfo_t objects, create if neccessary
Return values
numberof found types
-1error If name==nullptr, initialize all SIMD types
ev_calc_cdecl_purged_bytes 

Calculate number of purged bytes after call.

Parameters
ea(::ea_t) address of the call instruction
Returns
number of purged bytes (usually add sp, N)
ev_calc_purged_bytes 

Calculate number of purged bytes by the given function type.

Parameters
[out]p_purged_bytes(int *) ptr to output
fti(const func_type_data_t *) func type details
Return values
1
0not implemented
ev_calc_retloc 

Calculate return value location.

Parameters
[out]retloc(argloc_t *)
rettype(const tinfo_t *)
cc(cm_t)
Return values
0not implemented
1ok,
-1error
ev_calc_arglocs 

Calculate function argument locations.

This callback should fill retloc, all arglocs, and stkargs. This callback is never called for CM_CC_SPECIAL functions.

Parameters
fti(func_type_data_t *) points to the func type info
Return values
0not implemented
1ok
-1error
ev_calc_varglocs 

Calculate locations of the arguments that correspond to '...'.

Parameters
ftd(func_type_data_t *), inout: info about all arguments (including varargs)
[out]aux_regs(regobjs_t *) buffer for hidden register arguments, may be nullptr
[out]aux_stkargs(relobj_t *) buffer for hidden stack arguments, may be nullptr
nfixed(int) number of fixed arguments
Return values
0not implemented
1ok
-1error On some platforms variadic calls require passing additional information: for example, number of floating variadic arguments must be passed in rax on gcc-x64. The locations and values that constitute this additional information are returned in the buffers pointed by aux_regs and aux_stkargs
ev_adjust_argloc 

Adjust argloc according to its type/size and platform endianess.

Parameters
argloc(argloc_t *), inout
type(const tinfo_t *), may be nullptr nullptr means primitive type of given size
size(int) 'size' makes no sense if type != nullptr (type->get_size() should be used instead)
Return values
0not implemented
1ok
-1error
ev_lower_func_type 

Get function arguments which should be converted to pointers when lowering function prototype.

The processor module can also modify 'fti' in order to make non-standard conversion of some arguments.

Parameters
argnums(intvec_t *), out - numbers of arguments to be converted to pointers in acsending order
fti(func_type_data_t *), inout func type details (special values -1/-2 for return value - position of hidden 'retstr' argument: -1 - at the beginning, -2 - at the end)
Return values
0not implemented
1argnums was filled
2argnums was filled and made substantial changes to fti
ev_equal_reglocs 

Are 2 register arglocs the same?.

We need this callback for the pc module.

Parameters
a1(argloc_t *)
a2(argloc_t *)
Return values
1yes
-1no
0not implemented
ev_use_stkarg_type 

Use information about a stack argument.

Parameters
ea(::ea_t) address of the push instruction which pushes the function argument into the stack
arg(const funcarg_t *) argument info
Return values
1ok
<=0failed, the kernel will create a comment with the argument name or type for the instruction
ev_use_regarg_type 

Use information about register argument.

Parameters
[out]idx(int *) pointer to the returned value, may contain:
  • idx of the used argument, if the argument is defined in the current instruction, a comment will be applied by the kernel
  • idx | REG_SPOIL - argument is spoiled by the instruction
  • -1 if the instruction doesn't change any registers
  • -2 if the instruction spoils all registers
ea(::ea_t) address of the instruction
rargs(const funcargvec_t *) vector of register arguments (including regs extracted from scattered arguments)
Return values
1
0not implemented
ev_use_arg_types 

Use information about callee arguments.

Parameters
ea(::ea_t) address of the call instruction
fti(func_type_data_t *) info about function type
rargs(funcargvec_t *) array of register arguments
Return values
1(and removes handled arguments from fti and rargs)
0not implemented
ev_arg_addrs_ready 

Argument address info is ready.

Parameters
caller(::ea_t)
n(int) number of formal arguments
tif(tinfo_t *) call prototype
addrs(::ea_t *) argument intilization addresses
Return values
<0do not save into idb; other values mean "ok to save"
ev_decorate_name 

Decorate/undecorate a C symbol name.

Parameters
outbuf(qstring *) output buffer
name(const char *) name of symbol
mangle(bool) true-mangle, false-unmangle
cc(cm_t) calling convention
type(const tinfo_t *) name type (nullptr-unknown)
Return values
1if success
0not implemented or failed
ev_arch_changed 

The loader is done parsing arch-related information, which the processor module might want to use to finish its initialization.

Return values
1if success
0not implemented or failed
ev_get_stkarg_area_info 

Get some metrics of the stack argument area.

Parameters
[out]out(stkarg_area_info_t *) ptr to stkarg_area_info_t
cc(cm_t) calling convention
Return values
1if success
0not implemented
ev_loader 

This code and higher ones are reserved for the loaders.

The arguments and the return values are defined by the loaders

Member Function Documentation

◆ get_default_segm_bitness()

int processor_t::get_default_segm_bitness ( bool  is_64bit_app) const
inline

Get default segment bitness.

Return values
2PR_DEFSEG64
1PR_DEFSEG32
0none specified

◆ get_proc_index()

int processor_t::get_proc_index ( void  )
inline
Return values
currentlyselected processor subtype (index into psnames/plnames)

◆ get_reg_info()

const char * processor_t::get_reg_info ( const char *  regname,
bitrange_t bitrange 
)
inlinestatic

Get register information - useful for registers like al, ah, dil, etc.

Example: this function for "al" returns "eax" in 32bit mode

Returns
main register name (nullptr no such register)

◆ get_stkvar_scale()

int processor_t::get_stkvar_scale ( void  )
inline

Get the stack variable scaling factor.

Useful for processors who refer to the stack with implicit scaling factor. TMS320C55 for example: SP(#1) really refers to (SP+2)

◆ is_canon_insn()

bool processor_t::is_canon_insn ( uint16  itype) const
inline

Does the given value specify a valid instruction for this instruction set?.

See instruc_start and instruc_end

Member Data Documentation

◆ cnbits

int32 processor_t::cnbits

Number of bits in a byte for code segments (usually 8).

IDA supports values up to supported address bits size

◆ dnbits

int32 processor_t::dnbits

Number of bits in a byte for non-code segments (usually 8).

IDA supports values up to supported address bit size

◆ psnames

const char* const* processor_t::psnames

short processor names (nullptr terminated).

Each name should be shorter than 9 characters

◆ plnames

const char* const* processor_t::plnames

long processor names (nullptr terminated).

No restriction on name lengths.

◆ assemblers

const asm_t* const* processor_t::assemblers

pointer to array of target

assembler definitions. You may change this array when current processor is changed. (nullptr terminated)

◆ codestart

const bytes_t* processor_t::codestart

Array of typical code start sequences.

This array is used when a new file is loaded to find the beginnings of code sequences. This array is terminated with a zero length item.

◆ retcodes

const bytes_t* processor_t::retcodes

Array of 'return' instruction opcodes.

This array is used to determine form of autogenerated locret_... labels. The last item of it should be { 0, nullptr } This array may be nullptr Better way of handling return instructions is to define the is_ret_insn callback in the notify() function

◆ real_width

char processor_t::real_width[4]

Number of digits in floating numbers after the decimal point.

If an element of this array equals 0, then the corresponding floating point data is not used for the processor. This array is used to align numbers in the output.

  • real_width[0] - number of digits for short floats (only PDP-11 has them)
  • real_width[1] - number of digits for "float"
  • real_width[2] - number of digits for "double"
  • real_width[3] - number of digits for "long double"

Example: IBM PC module has { 0,7,15,19 }


The documentation for this struct was generated from the following files: