IDA SDK

- Main Page
- Header Files
- Classes
- Modules

Modules | Macros | Functions
Instruction/Data operands
Flags structure

## Detailed Description

Represent instruction/data operands.

IDA keeps 2 bitmasks:

- representation of the first operand
- representation of other operands (we will call this 'representation of second operand' although it is also applied to third, fourth,etc operands too)

For data bytes, only the first bitmask is used (i.e. all elements of an array have the same type).

## Modules
| Bits: instruction operand types
| Functions: examine operand flags (specific operands)
| Functions: examine operand flags (arbitrary operand)
| Functions: get type information bits for flags
| Functions: set operand representation
| Bits: data bytes
| Functions: examine data bits
| Functions: manipulate data bits

## Macros
#define | OPND_OUTER 0x80
| outer offset base (combined with operand number). More...
#define | OPND_MASK 0x07
| mask for operand number
#define | OPND_ALL OPND_MASK
| all operands

## Functions
idaman bool ida_export | op_adds_xrefs (flags_t F, int n)
| Should processor module create xrefs from the operand?. More...
idaman bool ida_export | set_op_type (ea_t ea, flags_t type, int n)
| (internal function) change representation of operand(s). More...
idaman bool ida_export | op_seg (ea_t ea, int n)
| Set operand representation to be 'segment'. More...
idaman bool ida_export | op_enum (ea_t ea, int n, enum_t id, uchar serial)
| Set operand representation to be 'enum_t'. More...
idaman enum_t ida_export | get_enum_id (ea_t ea, int n, uchar *serial)
| Get enum id of 'enum' operand. More...
idaman bool ida_export | op_stroff (ea_t ea, int n, const tid_t *path, int path_len, adiff_t delta)
| Set operand representation to be 'struct offset'. More...
idaman int ida_export | get_stroff_path (ea_t ea, int n, tid_t *path, adiff_t *delta)
| Get struct path of operand. More...
idaman bool ida_export | op_stkvar (ea_t ea, int n)
| Set operand representation to be 'stack variable'. More...
idaman bool ida_export | set_forced_operand (ea_t ea, int n, const char *op)
| Set forced operand. More...
idaman ssize_t ida_export | get_forced_operand (ea_t ea, int n, char *buf, size_t bufsize)
| Get forced operand. More...
idaman bool ida_export | is_forced_operand (ea_t ea, int n)
| Is operand manually defined?. More...
idaman bool ida_export | op_custfmt (ea_t ea, int n, int fid)
| Set custom data format for operand (fid-custom data format id)
idaman bool ida_export | noType (ea_t ea, int n)
| Remove operand representation information. More...
idaman int ida_export | getDefaultRadix (void)
| Get default base of number for the current processor. More...
idaman int ida_export | getRadix (flags_t F, int n)
| Get radix of the operand, in: flags. More...
idaman int ida_export | getRadixEA (ea_t ea, int n)
| Get radix of the operand, in: address. More...

## Macro Definition Documentation

#define OPND_OUTER 0x80

outer offset base (combined with operand number).

used only in set,get,del_offset() functions

## Function Documentation

idaman bool ida_export op_adds_xrefs | ( | flags_t | F,
|  | int | n
| ) |  |

Should processor module create xrefs from the operand?.

Currently 'offset' and 'structure offset' operands create xrefs

idaman bool ida_export set_op_type | ( | ea_t | ea,
|  | flags_t | type,
|  | int | n
| ) |  |

(internal function) change representation of operand(s).

Parameters

  ea | linear address
  type | new flag value (should be obtained from charflag(), numflag() and similar functions)
  n | number of operand (0,1,-1)

Return values

  1 | ok
  0 | failed (applied to a tail byte)

idaman bool ida_export op_seg | ( | ea_t | ea,
|  | int | n
| ) |  |

Set operand representation to be 'segment'.

If applied to unexplored bytes, converts them to 16/32bit word data

Parameters

  ea | linear address
  n | number of operand (0,1,-1)

Returns
  success

idaman bool ida_export op_enum | ( | ea_t | ea,
|  | int | n,
|  | enum_t | id,
|  | uchar | serial
| ) |  |

Set operand representation to be 'enum_t'.

If applied to unexplored bytes, converts them to 16/32bit word data

Parameters

  ea | linear address
  n | number of operand (0,1,-1)
  id | id of enum
  serial | the serial number of the constant in the enumeration, usually 0. the serial numbers are used if the enumeration contains several constants with the same value

Returns
  success

idaman enum_t ida_export get_enum_id | ( | ea_t | ea,
|  | int | n,
|  | uchar * | serial
| ) |  |

Get enum id of 'enum' operand.

Parameters

  ea | linear address
  n | number of operand (0,1,-1)
  serial | pointer to variable to hold the serial number of the constant in the enumeration

Returns
  id of enum or BADNODE

idaman bool ida_export op_stroff | ( | ea_t | ea,
|  | int | n,
|  | const tid_t * | path,
|  | int | path_len,
|  | adiff_t | delta
| ) |  |

Set operand representation to be 'struct offset'.

If applied to unexplored bytes, converts them to 16/32bit word data

Parameters

  ea | linear address
  n | number of operand (0,1,-1)
  path | structure path (strpath). see nalt.hpp for more info.
  path_len | length of the structure path
  delta | struct offset delta. usually 0. denotes the difference between the structure base and the pointer into the structure.

Returns
  success

idaman int ida_export get_stroff_path | ( | ea_t | ea,
|  | int | n,
|  | tid_t * | path,
|  | adiff_t * | delta
| ) |  |

Get struct path of operand.

Parameters

  ea | linear address
  n | number of operand (0,1,-1)
  path | buffer for structure path (strpath). see nalt.hpp for more info.
  delta | struct offset delta

Returns
  length of strpath

idaman bool ida_export op_stkvar | ( | ea_t | ea,
|  | int | n
| ) |  |

Set operand representation to be 'stack variable'.

Should be applied to an instruction within a function. Should be applied after creating a stack var using ua_stkvar().

Parameters

  ea | linear address
  n | number of operand (0,1,-1)

Returns
  success

idaman bool ida_export set_forced_operand | ( | ea_t | ea,
|  | int | n,
|  | const char * | op
| ) |  |

Set forced operand.

Parameters

  ea | linear address
  n | number of operand (0,1,2)
  op | text of operand

Returns
  success

idaman ssize_t ida_export get_forced_operand | ( | ea_t | ea,
|  | int | n,
|  | char * | buf,
|  | size_t | bufsize
| ) |  |

Get forced operand.

Parameters

  ea | linear address
  n | number of operand (0,1,2)
  buf | output buffer, may be NULL
  bufsize | size of output buffer

Returns
  size of forced operand or -1

idaman bool ida_export is_forced_operand | ( | ea_t | ea,
|  | int | n
| ) |  |

Is operand manually defined?.

Parameters

  ea | linear address
  n | number of operand (0,1,2)

idaman bool ida_export noType | ( | ea_t | ea,
|  | int | n
| ) |  |

Remove operand representation information.

(set operand representation to be 'undefined')

Parameters

  ea | linear address
  n | number of operand (0,1,-1)

Returns
  1

idaman int ida_export getDefaultRadix | ( | void |  | ) |

Get default base of number for the current processor.

Returns
  2,8,10,16

idaman int ida_export getRadix | ( | flags_t | F,
|  | int | n
| ) |  |

Get radix of the operand, in: flags.

If the operand is not a number, returns getDefaultRadix()

Parameters

  F | flags
  n | number of operand (0,1,-1)

Returns
  2,8,10,16

idaman int ida_export getRadixEA | ( | ea_t | ea,
|  | int | n
| ) |  |

Get radix of the operand, in: address.

If the operand is not a number, returns getDefaultRadix()

Parameters

  ea | linear address
  n | number of operand (0,1,-1)

Returns
  2,8,10,16