IDA SDK

- Main Page
- Header Files
- Classes
- Modules

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Attributes | Public Member Functions | Public Types | List of all members
processor_t Struct Reference

## 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.

## Public Attributes
int | version
| Expected kernel version, should be IDP_INTERFACE_VERSION.
int | id
| one of Processor IDs
uint32 | flag
| Processor feature bits
int | cnbits
| Number of bits in a byte for code segments (usually 8). More...
int | dnbits
| Number of bits in a byte for non-code segments (usually 8). More...
const asm_t *const * | assemblers
| pointer to array of target assembler definitions. More...
int(idaapi * | notify )(idp_notify msgid,...)
| Various notifications for the idp.
bool(idaapi * | cmp_opnd )(const op_t &op1, const op_t &op2)
| Compare instruction operands. More...
bool(idaapi * | can_have_type )(op_t &op)
| Can the operand have a type as offset, segment, decimal, etc. More...
int | regsNum
| number of registers
const char *const * | regNames
| array of register names
int(idaapi * | is_far_jump )(int icode)
| is indirect far jump or call instruction?. More...
ea_t(idaapi * | translate )(ea_t base, adiff_t offset)
| Translation function for offsets. More...
size_t | tbyte_size
| Size of long double (tbyte) for this processor (meaningful only if asm_t::a_tbyte != NULL)
int(idaapi * | realcvt )(void *m, uint16 *e, uint16 swt)
| Floating point -> IEEE conversion function. More...
char | real_width [4]
| Number of digits in floating numbers after the decimal point. More...
bool(idaapi * | is_switch )(switch_info_ex_t *si)
| Find 'switch' idiom. More...
int32(idaapi * | gen_map_file )(FILE *fp)
| Generate map file. More...
ea_t(idaapi * | extract_address )(ea_t ea, const char *string, int x)
| Extract address from a string. More...
int(idaapi * | is_sp_based )(const op_t &x)
| Check whether the operand is relative to stack pointer or frame pointer. More...
bool(idaapi * | create_func_frame )(func_t *pfn)
| Create a function frame for a newly created function. More...
int(idaapi * | get_frame_retsize )(func_t *pfn)
| Get size of function return address in bytes. More...
void(idaapi * | gen_stkvar_def )(char *buf, size_t bufsize, const class member_t *mptr, sval_t v)
| Generate stack variable definition line. More...
bool(idaapi * | u_outspec )(ea_t ea, uchar segtype)
| Generate text representation of an item in a special segment. More...
int | icode_return
| Icode of return instruction. It is ok to give any of possible return instructions.
set_options_t * | set_idp_options
| Set IDP-specific option.
int(idaapi * | is_align_insn )(ea_t ea)
| Is the instruction created only for alignment purposes?. More...
void * | unused_slot
| Reserved, currently equals to NULL.
int | high_fixup_bits
| If the FIXUP_VHIGH and FIXUP_VLOW fixup types are supported then the number of bits in the HIGH part. More...
Names
IDP module may support several compatible processors. The following arrays define processor names:
const char *const * | psnames
| short processor names (NULL terminated). More...
const char *const * | plnames
| long processor names (NULL terminated). More...
Warning
The following pointers should be NULL:
const AbstractRegister *(idaapi * | getreg )(int regnum)
| Get register value. More...
int | rFiles
| number of register files
const char *const * | rFnames
| register names for files
const rginfo * | rFdescs
| description of registers
const class WorkReg * | CPUregs
| pointer to CPU registers
Segment registers
Segment register information (use virtual CS and DS registers if your processor doesn't have segment registers):
int | regFirstSreg
| number of first segment register
int | regLastSreg
| number of last segment register
int | 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.
int | regCodeSreg
| number of CS register
int | regDataSreg
| number of DS register
Empirics
const bytes_t * | codestart
| Array of typical code start sequences. More...
const bytes_t * | retcodes
| Array of 'return' instruction opcodes. More...

## Public Member Functions
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 | ti2 (void) const
| PR_TINFO
bool | stkup (void) const
| PR_STACK_UP
bool | use_tbyte (void) const
| PR_USE_TBYTE
int | get_segm_bitness (void) const
| Get segment bitness. More...
int | get_stkvar_scale (void)
| Get the stack variable scaling factor. More...
| int (idaapi *u_ana)(void)
| Analyze one instruction and fill 'cmd' structure. More...
| int (idaapi *u_emu)(void)
| Emulate instruction, create cross-references, plan to analyze subsequent instructions, modify flags etc. More...
| void (idaapi *u_out)(void)
| Generate text representation of an instruction in cmd structure. More...
| bool (idaapi *u_outop)(op_t &op)
| Generate text representation of an instruction operand. More...
| void (idaapi *d_out)(ea_t ea)
| Generate text representation of data items. More...
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

## Public Types
enum | idp_notify { init, term, newprc, newasm, newfile, oldfile, newbinary, endbinary, newseg, assemble, obsolete_makemicro, outlabel, rename, may_show_sreg, closebase, load_idasgn, coagulate, auto_empty, auto_queue_empty, func_bounds, may_be_func, is_sane_insn, is_jump_func, gen_regvar_def, setsgr, set_compiler, is_basic_block_end, reglink, get_vxd_name, custom_ana, custom_out, custom_emu, custom_outop, custom_mnem, undefine, make_code, make_data, moving_segm, move_segm, is_call_insn, is_ret_insn, get_stkvar_scale_factor, create_flat_group, kernel_config_loaded, might_change_sp, is_alloca_probe, out_3byte, get_reg_name, savebase, gen_asm_or_lst, out_src_file_lnnum, get_autocmt, is_insn_table_jump, auto_empty_finally, loader_finished, loader_elf_machine, is_indirect_jump, verify_noreturn, verify_sp, renamed, add_func, del_func, set_func_start, set_func_end, treat_hindering_item, str2reg, create_switch_xrefs, calc_switch_cases, determined_main, preprocess_chart, get_bg_color, validate_flirt_func, get_operand_string, add_cref, add_dref, del_cref, del_dref, coagulate_dref, register_custom_fixup, custom_refinfo, set_proc_options, adjust_libfunc_ea, extlang_changed, delay_slot_insn, adjust_refinfo, last_cb_before_debugger, obsolete_get_operand_info = 100, next_exec_insn, calc_step_over, get_macro_insn_head, get_dbr_opnum, insn_reads_tbit, get_operand_info, calc_next_eas, clean_tbit, get_reg_info2, last_cb_before_type_callbacks, setup_til, based_ptr, max_ptr_size, get_default_enum_size, calc_cdecl_purged_bytes2, get_stkarg_offset2, til_for_file, equal_reglocs, decorate_name3, calc_retloc3, calc_varglocs3, calc_arglocs3, use_stkarg_type3, use_regarg_type3, use_arg_types3, calc_purged_bytes3, shadow_args_size, get_varcall_regs3, get_fastcall_regs3, get_thiscall_regs3, get_func_cvtarg_map, get_simd_types, loader =1000 }
| Callback notification codes. More...
typedef const regval_t &idaapi * | regval_getter_t(const char *name, const regval_t *regvalues)

## Disassembly sections
The following functions generate portions of the disassembled text.
void(idaapi * | header )(void)
| Function to produce start of disassembled text.
void(idaapi * | footer )(void)
| Function to produce end of disassembled text.
void(idaapi * | segstart )(ea_t ea)
| Function to produce start of segment.
| void (idaapi *segend)(ea_t ea)
| Function to produce end of segment.
| void (idaapi *assumes)(ea_t ea)
| Function to produce assume directives when segment register value changes. More...

## Instruction set
int | instruc_start
| icode of the first instruction
int | instruc_end
| icode of the last instruction + 1
const instruc_t * | instruc
| Array of instructions.
bool | is_canon_insn (uint16 itype) const
| Does the given value specify a valid instruction for this instruction set?. More...

## Member Enumeration Documentation

enum processor_t::idp_notify

Callback notification codes.

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

If you are not developing a processor module, many of these codes 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.

Enumerator
  init | The IDP module is just loaded. Parameters
  idp_modname | (const char *) processor module name
Returns 0 on failure
term | The IDP module is being unloaded.
  newprc | Before changing processor type. Parameters
  pnum | (int) processor number in the array of processor names
  Return values
  1 | ok
  0 | prohibit
  newasm | Before setting a new assembler. Parameters
  asmnum | (int)
  newfile | A new file is loaded (already). Parameters
  fname | (char *) input file name
  oldfile | An old file is loaded (already). Parameters
  fname | (char *) input file name
  newbinary | Before loading a binary file. Parameters
  filename | (char *) binary file name
  fileoff | (uint32) offset in the file
  basepara | (ea_t) base loading paragraph
  binoff | (ea_t) loader offset
  nbytes | (uint32) number of bytes to load
  endbinary | After loading a binary file. Parameters
  ok | (bool) file loaded successfully?
  newseg | A new segment is about to be created. Parameters
  seg | (segment_t *)
  Return values
  1 | ok
  <=0 | segment should not be created
  assemble | Assemble an instruction. (display a warning if an error is found). Parameters
  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
  bin | (uchar *) pointer to output opcode buffer
Returns size of the instruction in bytes
  obsolete_makemicro | Generate microcode for the instruction in 'cmd' structure. Parameters
  block | (mblock_t *)
Returns MICRO_... error codes
  outlabel | The kernel is going to generate an instruction label line or a function header. Parameters
  ea | (ea_t)
  colored_name | (const char *)
Returns <=0 if the kernel should not generate the label
  rename | The kernel is going to rename a byte. Parameters
  ea | (ea_t)
  new_name | (const char *)
  flags | (int) Set name flags
Returns <=0 if the kernel should not rename it. 2 to inhibit the notification. I.e., the kernel should not rename, but 'set_name()' should return 'true'. also see renamed
  may_show_sreg | The kernel wants to display the segment registers in the messages window. Parameters
  current_ea | (ea_t)
Returns <=0 if the kernel should not show the segment registers. (assuming that the module has done it)
closebase | The database will be closed now.
  load_idasgn | FLIRT signature has been loaded for normal processing (not for recognition of startup sequences). Parameters
  short_sig_name | (const char *)
Returns void
  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 + 1
  auto_empty | Info: all analysis queues are empty. This callback is called once when the initial analysis is finished. If the queue is not empty upon the return from this callback, it will be called later again. See also auto_empty_finally. Parameters
  none |
Returns void
  auto_queue_empty | One analysis queue is empty. This callback can be called many times, so only the autoMark() functions can be used from it (other functions may work but it is not tested). Parameters
  type | (atype_t)
  Return values
  1 | yes, keep the queue empty (default)
  <=0 | no, the queue is not empty anymore
  func_bounds | find_func_bounds() finished its work. The module may fine tune the function bounds Parameters
  possible_return_code | (int *)
  pfn | (func_t *)
  max_func_end_ea | (ea_t) (from the kernel's point of view)
Returns void
  may_be_func | Can a function start here?. the instruction is in 'cmd', the idp module is allowed to modify 'cmd' Parameters
  state | (int) autoanalysis phase 0: creating functions 1: creating chunks
Returns probability 0..100
  is_sane_insn | Is the instruction sane for the current file type?. The instruction is in 'cmd'. Parameters
  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
  1 | ok
  <=0 | no, the instruction isn't likely to appear in the program
  is_jump_func | Is the function a trivial "jump" function?. Parameters
  pfn | (func_t *)
  jump_target | (ea_t *)
  func_pointer | (ea_t *)
  Return values
  <=0 | no
  1 | don't know
  2 | yes, see 'jump_target' and 'func_pointer'
  gen_regvar_def | Generate register variable definition line. Parameters
  v | (regvar_t *)
  Return values
  <=0 | ok, generated the definition text
  setsgr | The kernel has changed a segment register value. Parameters
  startEA | (ea_t)
  endEA | (ea_t)
  regnum | (int)
  value | (sel_t)
  old_value | (sel_t)
  tag | (uchar) Segment register area tags
Returns success
set_compiler | The kernel has changed the compiler information. ( idainfo::cc structure; idainfo::abiname)
  is_basic_block_end | Is the current instruction end of a basic block?. This function should be defined for processors with delayed jump slots. The current instruction is stored in cmd Parameters
  call_insn_stops_block | (bool)
  Return values
  1 | unknown
  <=0 | no
  2 | yes
reglink | IBM PC only, ignore it.
  get_vxd_name | IBM PC only, ignore it. Get Vxd function name Parameters
  vxdnum | (int)
  funcnum | (int)
  outbuf | (char *)
Returns void
  custom_ana | Parameters
  none | the address to analyze is in insn_t::ea. insn_t::ip and insn_t::cs are initialized too insn_t::itype must be set >= 0x8000 insn_t::size must be set to the instruction length
(a good plugin would fill the whole cmd including the operand fields) in the case of error the cmd structure should be kept intact Returns 1 + insn_t::size
  custom_out | Generate instruction text using the printf_line() function. Optional notification (depends on the processor module) Parameters
  none | (cmd structure contains information about the instruction)
Returns 2
  custom_emu | Parameters
  none | (cmd structure contains information about the instruction)
Optional notification. if absent, the instruction is supposed to be an regular one the kernel will proceed to the analysis of the next instruction Returns 2
  custom_outop | Parameters
  op | (op_t *)
Optional notification to generate operand text. if absent, the standard operand output function will be called. the output buffer is inited with init_output_buffer() and this notification may use out_...() functions from ua.hpp to form the operand text Returns 2
  custom_mnem | Parameters
  buf | (char *)
  bufsize | (size_t)
cmd structure contains information about the instruction. Optional notification. if absent, the IDC function GetMnem() won't work. At least one of custom_out or custom_mnem should be implemented. custom_ana should always be implemented. These custom_... callbacks will be called for all instructions. It is the responsibility of the plugin to ignore the undesired callbacks Returns 2
  undefine | An item in the database (insn or data) is being deleted. Parameters
  ea | (ea_t)
Returns >0-ok, <=0-the kernel should stop. if the return value is positive: bit0 ignored bit1 do not delete srareas at the item end
  make_code | An instruction is being created. Parameters
  ea | (ea_t)
  size | (asize_t)
  Return values
  1 | ok
  <=0 | the kernel should stop
  make_data | A data item is being created. Parameters
  ea | (ea_t)
  flags | (flags_t)
  tid | (tid_t)
  len | (asize_t)
  Return values
  1 | ok
  <=0 | the kernel should stop
  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
  1 | yes
  <=0 | the kernel should stop
  move_segm | A segment is moved. Fix processor dependent address sensitive information Parameters
  from | (ea_t) old segment address
  seg | (segment_t *) moved segment
Returns void
  is_call_insn | Is the instruction a "call"? Parameters
  ea | (ea_t) instruction address
  Return values
  1 | unknown
  <=0 | no
  2 | yes
  is_ret_insn | Is the instruction a "return"? Parameters
  ea | (ea_t) instruction address
  strict | (bool) 1: report only ret instructions 0: include instructions like "leave" which begins the function epilog
  Return values
  1 | unknown
  <=0 | no
  2 | yes
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 Note PR_SCALE_STKVARS should be set to use this callback Returns scaling factor
  create_flat_group | Create special segment representing the flat group. (to use for PC mainly) Parameters
  image_base | (ea_t)
  bitness | (int)
  dataseg_sel | (sel_t)
  kernel_config_loaded | This callback is called when ida.cfg is parsed. Parameters
  none |
Returns void
  might_change_sp | Does the instruction at 'ea' modify the stack pointer? (not used yet). Parameters
  ea | (ea_t)
  Return values
  1 | yes
  <=0 | no
  is_alloca_probe | Does the function at 'ea' behave as __alloca_probe? Parameters
  ea | (ea_t)
  Return values
  2 | yes
  1 | no
  out_3byte | Generate text representation of 3byte data. init_output_buffer() is called before this function and all Out... function can be used. uFlag contains the flags. This callback might be implemented by the processor module to generate custom representation of 3byte data. Parameters
  dataea | (ea_t) address of the data item
  value | (uint32) value value to output
  analyze_only | (bool) only create xrefs if necessary. do not generate text representation
  Return values
  2 | success
  1 | failed
  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::regNames[reg] does not provide the correct register name. Parameters
  reg | (int) internal register number as defined in the processor module
  width | (size_t) register width in bytes
  buf | (char *) output buffer
  bufsize | (size_t) size of output buffer
  reghi | (int) if not -1 then this function will return the register pair
Returns -1 if error, strlen(buf)+2 otherwise
savebase | The database is being saved. Processor module should save its local data
  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 | (gen_outline_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
Returns void
  out_src_file_lnnum | Callback: generate analog of: #line "file.c" 123 directive. Parameters
  file | (const char *) source file (may be NULL)
  lnnum | (size_t) line number
  Return values
  2 | directive has been generated
  get_autocmt | Callback: get dynamic auto comment. Will be called if the autocomments are enabled and the comment retrieved from ida.int starts with '$!'. cmd contains valid info. Parameters
  buf | (char *) output buffer
  bufsize | (size_t) output buffer size
  Return values
  2 | new comment has been generated
  1 | callback has not been handled. the buffer must not be changed in this case
  is_insn_table_jump | Callback: determine if instruction is a table jump or call. If CF_JUMP bit can not describe all kinds of table jumps, please define this callback. It will be called for insns with CF_JUMP bit set. Parameters
  none | cmd structure contains the current instruction
  Return values
  1 | yes
  <=0 | no
  auto_empty_finally | Info: all analysis queues are empty definitively. This callback is called only once. See also auto_empty. Parameters
  none |
Returns void
  loader_finished | Event: external file loader finished its work. Use this event to augment the existing loader functionality. Parameters
  li | (linput_t *)
  neflags | (uint16) Load file flags
  filetypename | (const char *)
  loader_elf_machine | Event: 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. 'set_reloc' can be later used by the plugin to specify relocations. This event occurs for each newly loaded ELF file Parameters
  li | (linput_t *)
  machine_type | (int)
  p_procname | (const char **)
  p_pd | (proc_def **) (see ldr\elf.h)
  set_reloc | (set_elf_reloc_t *)
Returns e_machine value (if it is different from the original e_machine value, procname and 'p_pd' will be ignored and the new value will be used)
  is_indirect_jump | Callback: determine if instruction is an indirect jump. If CF_JUMP bit can not describe all jump types jumps, please define this callback. Parameters
  none | cmd structure contains the current instruction
  Return values
  1 | use CF_JUMP
  2 | no
  3 | yes
  verify_noreturn | The kernel wants to set 'noreturn' flags for a function. Parameters
  pfn | (func_t *)
Returns 1: ok. any other value: do not set 'noreturn' flag
  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
  1 | ok
  <=0 | bad stack pointer
  renamed | The kernel has renamed a byte. See also the rename event Parameters
  ea | (ea_t)
  new_name | (const char *)
  local_name | (bool)
Returns void
  add_func | The kernel has added a function. Parameters
  pfn | (func_t *)
Returns void
  del_func | The kernel is about to delete a function. Parameters
  pfn | (func_t *)
  Return values
  1 | ok
  <=0 | do not delete
  set_func_start | Function chunk start address will be changed. Parameters
  pfn | (func_t *)
  new_start | (ea_t)
  Return values
  1 | ok
  <=0 | do not change
  set_func_end | Function chunk end address will be changed. Parameters
  pfn | (func_t *)
  new_end | (ea_t)
  Return values
  1 | ok
  <=0 | do not change
  treat_hindering_item | An item hinders creation of another item. Parameters
  hindering_item_ea | (ea_t)
  new_item_flags | (flags_t) (0 for code)
  new_item_ea | (ea_t)
  new_item_length | (asize_t)
  Return values
  1 | no reaction
  <=0 | the kernel may delete the hindering item
  str2reg | Convert a register name to a register number. The register number is the register index in the processor_t::regNames array Most processor modules do not need to implement this callback It is useful only if processor_t::regNames[reg] does not provide the correct register names Parameters
  regname | (const char *)
Returns register number + 2
  create_switch_xrefs | Create xrefs for a custom jump table. Parameters
  jumpea | (ea_t) address of the jump insn
  si | (switch_info_ex_t *) switch information
Returns must return 2
  calc_switch_cases | Calculate case values and targets for a custom jump table. Parameters
  insn_ea | (ea_t) address of the 'indirect jump' instruction
  si | (switch_info_ex_t *) switch information
  casevec | (::casevec_t *) vector of case values (may be NULL)
  targets | (eavec_t *) corresponding target addresses (my be NULL)
  Return values
  2 | ok
  1 | failed
  determined_main | The main() function has been determined. Parameters
  main | (ea_t) address of the main() function
Returns void
  preprocess_chart | Gui has retrieved a function flow chart. Plugins may modify the flow chart in this callback. Parameters
  fc | (qflow_chart_t *)
Returns void
  get_bg_color | Get item background color. Plugins can hook this callback to color disassembly lines dynamically Parameters
  ea | (ea_t)
  color | (bgcolor_t)
  Return values
  1 | not implemented
  2 | color set
  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. The idp module is allowed to modify cmd Parameters
  start_ea | (ea_t)
  funcname | (const char *)
  Return values
  -1 | do not create a function,
  1 | function is validated
  get_operand_string | Request text string for operand (cli, java, ...). (cmd structure must contain info for the desired insn) Parameters
  opnum | (int) operand number, -1 means any string operand
  buf | (char *)
  buflen | (size_t)
Returns 1 no string (or empty string) >1 original string length with terminating zero
  add_cref | A code reference is being created. Parameters
  from | (ea_t)
  to | (ea_t)
  type | (cref_t)
Returns < 0 - cancel cref creation
  add_dref | A data reference is being created. Parameters
  from | (ea_t)
  to | (ea_t)
  type | (dref_t)
Returns < 0 - cancel dref creation
  del_cref | A code reference is being deleted. Parameters
  from | (ea_t)
  to | (ea_t)
  expand | (bool)
Returns < 0 - cancel cref deletion
  del_dref | A data reference is being deleted. Parameters
  from | (ea_t)
  to | (ea_t)
Returns < 0 - cancel dref deletion
  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 *)
Returns < 0 - cancel dref analysis
  register_custom_fixup | Request to register a new custom fixup type. Parameters
  name | (const char *)
Returns fixup id + 1
  custom_refinfo | Called from get_offset_expr, when refinfo_t contains flag REFINFO_CUSTOM. Normally this notification used in a combination with custom_fixup Parameters
  ea | (ea_t)
  numop | (int)
  opval | (ea_t *)
  ri | (const refinfo_t*)
  buf | (char *)
  bufsize | (size_t)
  target | (ea_t *)
  fullvalue | (ea_t *)
  from | (ea_t)
  getn_flags | (int)
  Return values
  2 | buf filled as simple expression
  3 | buf filled as complex expression
  4 | apply standard processing (with possible changed values)
  other | can't convert to offset expression
  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
Returns < 0 if bad option string
  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
  2 | the ea_t pointed to by the third argument was modified.
  other | not modified. use default algorithm.
  extlang_changed | The list of extlangs or the default extlang was changed. Parameters
  kind | (int) 0: extlang installed 1: extlang removed 2: default extlang changed
  el | (const extlang_t *) pointer to the extlang affected
Returns void
  delay_slot_insn | Get delay slot instruction. Parameters
  ea | (ea_t *) instruction address in question, if answer is positive then set 'ea' to the delay slot insn address
  bexec | (bool *) execute slot if jumping, initially set to 'true'
  fexec | (bool *) execute slot if not jumping, initally set to 'true'
  Return values
  2 | positive answer
  <2 | ordinal insn
Note Input 'ea' may point to the instruction with a delay slot or to the delay slot instruction itself.
  adjust_refinfo | Called from apply_fixup before converting operand to reference. Can be used for changing the reference info. Parameters
  ea | (ea_t) instruction address
  n | (int) operand number
  fd | (const fixup_data_t *)
  ri | (refinfo_t *)
Returns < 0 - do not create an offset
last_cb_before_debugger | START OF DEBUGGER CALLBACKS.
obsolete_get_operand_info | Get operand information. same as get_operand_info (below), but uses idd_opinfo_old_t* as the last argument (less info)
  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
  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
  target | (ea_t *) pointer to the answer
  Return values
  1 | unimplemented
  <=0 | implemented
  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 can not calculate the address, return BADADDR. Parameters
  ip | (ea_t) instruction address
  target | (ea_t *) pointer to the answer
  Return values
  1 | unimplemented
  <=0 | implemented
  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
  ip | (ea_t) instruction address
  head | (ea_t *) answer, BADADDR means normal instruction
  Return values
  1 | unimplemented
  <=0 | implemented
  get_dbr_opnum | Get the number of the operand to be displayed in the debugger reference view (text mode). Parameters
  ea | (ea_t) instruction address
  opnum | (int *) operand number (out, -1 means no such operand)
  Return values
  1 | unimplemented
  <=0 | implemented
  insn_reads_tbit | Check if insn will read the TF bit. 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
  3 | yes, will generate 'step' exception
  2 | yes, will store the TF bit in memory
  1 | no
  get_operand_info | Get operand information. This callback is used to calculate the operand value for double clicking on it, hints, etc. Parameters
  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
  opinf | (idd_opinfo_t *) the output buffer
Returns <=0-ok, otherwise failed
  calc_next_eas | Calculate list of addresses the instruction in cmd may pass control to. This callback is required for source level debugging. Parameters
  over | (bool) calculate for step over (ignore call targets)
  res | (ea_t *) array for the results. this array has NEXTEAS_ANSWER_SIZE elements.
  nsubcalls | (int *) number of addresses of called functions in the above array. they must be put at the beginning of the array. if over=true, this answer will be zero.
Returns number of calculated addresses+1. If there are too many addresses or they are incalculable (indirect jumps, for example), return -1.
  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
  2 | ok
  1 | failed
  get_reg_info2 | 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::regNames and they all have the same size Parameters
  regname | (const char *)
  main_regname | (const char **) (NULL-failed)
  bitrange | (bitrange_t *) position and size of the value within 'main_regname' (empty bitrange == whole register)
  Return values
  1 | unimplemented
  2 | implemented
  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 |
Returns void
  based_ptr | Get prefix and size of 'segment based' ptr type. (something like char _ss *ptr, see based_ptr_name_and_size()) Parameters
  ptrt | (unsigned)
  ptrname | (const char **)
Returns size of type
  max_ptr_size | Get maximal size of a pointer in bytes. Parameters
  none |
Returns max possible size of a pointer plus 1
  get_default_enum_size | Get default enum size. Parameters
  cm | (cm_t)
Returns sizeof(enum)
calc_cdecl_purged_bytes2 | Calculate number of purged bytes after call. param ea (ea_t) address of the call instruction Returns number of purged bytes+2 (usually add sp, N)
  get_stkarg_offset2 | Get offset from SP to the first stack argument. For example: pc: 0, hppa: -0x34, ppc: 0x38 Parameters
  none |
Returns the offset + 2
til_for_file | Internal notification, do not use.
  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
  1 | not implemented
  2 | yes
  -1 | no
  decorate_name3 | Decorate/undecorate a C symbol name. The kernel uses this callback only if PR_TINFO is set. Parameters
  outbuf | (qstring *) output buffer
  name | (const char *) name of symbol
  mangle | (bool) true-mangle, false-unmangle
  cc | (cm_t) calling convention
Returns 2 if success
  calc_retloc3 | Calculate return value location. The kernel uses this callback only if PR_TINFO is set. Parameters
  | rettype | (const tinfo_t *)
  | cc | (cm_t)
  [out] | retloc | (argloc_t *)
Returns 1 not implemented 2 ok, -1 error
  calc_varglocs3 | Calculate locations of the arguments that correspond to '...'. The kernel uses this callback only if PR_TINFO is set. Parameters
  ftd | (const func_type_data_t *) info about all arguments (including varargs)
  regs | (regobjs_t *) buffer for register values
  stkargs | (relobj_t *) stack arguments
  nfixed | (int) number of fixed arguments
  Return values
  1 | not implemented
  2 | ok
  -1 | error
  calc_arglocs3 | Calculate function argument locations. This callback should fill retloc, all arglocs, and stkargs. This callback supersedes calc_argloc2. This callback is never called for CM_CC_SPECIAL functions. The kernel uses this callback only if PR_TINFO is set. Parameters
  fti | (func_type_data_t *) points to the func type info
  Return values
  1 | not implemented
  2 | ok
  -1 | error
  use_stkarg_type3 | Use information about a stack argument. The kernel uses this callback only if PR_TINFO is set. 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
  true | ok
  false | failed, the kernel will create a comment with the argument name or type for the instruction
  use_regarg_type3 | Use information about register argument. The kernel uses this callback only if PR_TINFO is set. 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)
Returns 2
  use_arg_types3 | Use information about callee arguments. The kernel uses this callback only if PR_TINFO and PR_USE_ARG_TYPES are set. 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
Returns 2 (and removes handled arguments from fti and rargs)
  calc_purged_bytes3 | Calculate number of purged bytes by the given function type. The kernel uses this callback only if PR_TINFO is set. Parameters
  [out] | p_purged_bytes | (int *) ptr to output
  | fti | (const func_type_data_t *) func type details
Returns 2
  shadow_args_size | Get size of shadow args in bytes. Parameters
  [out] | shadow_args_size | (int *)
  | pfn | (func_t *) (may be NULL)
Returns 2 if filled *shadow_args_size
  get_varcall_regs3 | Get register allocation convention used in the ellipsis (...) calling convention. Parameters
  regs | (callregs_t *)
Returns max_possible_number_of_varcall_regs+2
  get_fastcall_regs3 | Get register allocation convention used in the fastcall calling convention. Parameters
  regs | (callregs_t *)
Returns max_possible_number_of_fastcall_regs+2
  get_thiscall_regs3 | Get register allocation convention used in the thiscall calling convention. Parameters
  regs | (callregs_t *)
Returns max_possible_number_of_fastcall_regs+2
  get_func_cvtarg_map | Get function arguments which should be converted to pointers lowering function prototype. Parameters
  fti | (const func_type_data_t *) func type details
  argnums | (intvec_t *) - number of arguments to be converted to pointers (special values -1/-2 for return value, position of hidden 'retstr' argument: -1 - at the beginning, -2 - at the end)
Returns 2
  get_simd_types | Get SIMD-related types according to given attributes ant/or argument location. Parameters
  simd_attrs | (const simd_info_t *)
  argloc | (const argloc_t *)
  out | (::simd_info_vec_t *)
  create_tifs | (bool) return valid tinfo_t objects, create if neccessary
Returns number of found types+1, -1-error If name==NULL, initialize all SIMD types
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

int processor_t::get_segm_bitness | ( | void |  | ) | const
| inline

Get segment bitness.

Return values

  2 | PR_DEFSEG64
  1 | PR_DEFSEG32
  0 | none specified

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)

processor_t::void | ( | idaapi * | assumes | ) |

Function to produce assume directives when segment register value changes.

If your processor has no segment registers, you may define it as NULL

processor_t::int | ( | idaapi * | u_ana | ) |

Analyze one instruction and fill 'cmd' structure.

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

Returns
  length of the instruction in bytes, 0 if instruction can't be decoded.

processor_t::int | ( | idaapi * | u_emu | ) |

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 cmd structure. If zero is returned, the kernel will delete the instruction.

processor_t::void | ( | idaapi * | u_out | ) |

Generate text representation of an instruction in cmd structure.

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

processor_t::bool | ( | idaapi * | u_outop | ) |

Generate text representation of an instruction operand.

This function shouldn't change the database, flags or anything else. All these actions should be performed only by u_emu() function. The output text is placed in the output buffer initialized with init_output_buffer() This function uses out_...() functions from ua.hpp to generate the operand text

Return values

  1 | ok
  0 | operand is hidden.

processor_t::void | ( | idaapi * | d_out | ) |

Generate text representation of data items.

This function MAY change the database and create cross-references, etc.

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

int processor_t::cnbits

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

IDA supports values up to 32 bits

int processor_t::dnbits

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

IDA supports values up to 32 bits

const char* const* processor_t::psnames

short processor names (NULL terminated).

Each name should be shorter than 9 characters

const char* const* processor_t::plnames

long processor names (NULL terminated).

No restriction on name lengths.

const asm_t* const* processor_t::assemblers

pointer to array of target assembler definitions.

You may change this array when current processor is changed. (NULL terminated)

bool(idaapi * processor_t::cmp_opnd) (const op_t &op1, const op_t &op2)

Compare instruction operands.

This pointer may be NULL.

Return values

  1 | equal
  0 | not equal

bool(idaapi * processor_t::can_have_type) (op_t &op)

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) This pointer may be NULL.

const AbstractRegister*(idaapi * processor_t::getreg) (int regnum)

Get register value.

If specified, will be used in the determining predefined comment based on the register value

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.

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, NULL } This array may be NULL Better way of handling return instructions is to define the is_ret_insn callback in the notify() function

int(idaapi * processor_t::is_far_jump) (int icode)

is indirect far jump or call instruction?.

meaningful only if the processor has 'near' and 'far' reference types

ea_t(idaapi * processor_t::translate) (ea_t base, adiff_t offset)

Translation function for offsets.

Currently used in the offset display functions to calculate the referenced address

int(idaapi * processor_t::realcvt) (void *m, uint16 *e, uint16 swt)

Floating point -> IEEE conversion function.

Returns
  Floating point/IEEE Conversion codes on error

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 }

bool(idaapi * processor_t::is_switch) (switch_info_ex_t *si)

Find 'switch' idiom.

This function may use (and modify) cmd (you can assume cmd is correct). It will be called for instructions marked with CF_JUMP.

Return values

  1 | switch is found, 'si' is filled
  0 | switch is not found

int32(idaapi * processor_t::gen_map_file) (FILE *fp)

Generate map file.

If this pointer is NULL, the kernel itself will create the map file.

Return values

  0 | empty file
  -1 | write error
  other | number of lines in output file

ea_t(idaapi * processor_t::extract_address) (ea_t ea, const char *string, int x)

Extract address from a string.

Return values

  BADADDR | if can't extract.
  BADADDR-1 | if kernel should use standard algorithm.

int(idaapi * processor_t::is_sp_based) (const op_t &x)

Check whether the operand is relative to stack pointer or frame pointer.

This function is used to determine how to output a stack variable This function may be absent. If it is absent, then all operands are sp based by default. Define this function only if some stack references use frame pointer instead of stack pointer.

Returns
  combination of SP/FP operand flags

bool(idaapi * processor_t::create_func_frame) (func_t *pfn)

Create a function frame for a newly created function.

Set up frame size, its attributes etc. This function may be absent.

int(idaapi * processor_t::get_frame_retsize) (func_t *pfn)

Get size of function return address in bytes.

If this function is absent, the kernel will assume

- 4 bytes for 32-bit function
- 2 bytes otherwise
  Parameters

    pfn | pointer to function structure, can't be NULL

void(idaapi * processor_t::gen_stkvar_def) (char *buf, size_t bufsize, const class member_t *mptr, sval_t v)

Generate stack variable definition line.

If this function is NULL, then the kernel will create this line itself. Default line is varname = type ptr value, where 'type' is one of byte,word,dword,qword,tbyte

bool(idaapi * processor_t::u_outspec) (ea_t ea, uchar segtype)

Generate text representation of an item in a special segment.

i.e. absolute symbols, externs, communal definitions etc.

Return values

  1 | overflow
  0 | ok

int(idaapi * processor_t::is_align_insn) (ea_t ea)

Is the instruction created only for alignment purposes?.

Do not directly call this function, use is_align_insn() returns: number of bytes in the instruction

int processor_t::high_fixup_bits

If the FIXUP_VHIGH and FIXUP_VLOW fixup types are supported then the number of bits in the HIGH part.

For example, SPARC will have here 22 because it has HIGH22 and LOW10 relocations. See also: the description of PR_FULL_HIFXP bit

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

- idp.hpp