30th Anniversary Promotion: 30% OFF on all online purchased products from 24 May to 13 June (Max 1 seat per order & order must be placed by end user)
State-of-the-art binary code analysis tools
Operand types

Detailed Description

Various types of instruction operands.

The kernel already knows about some operand types and associates them with fields in op_t.

IDA also allows you define processor specific operand types (o_idpspec...). You are free to give any meaning to these types. We suggest you to create a #define to use mnemonic names. However, don't forget that the kernel will know nothing about operands of those types. You may use any additional fields of op_t to store processor specific operand information.


const optype_t o_void = 0
 No Operand.
const optype_t o_reg = 1
 General Register (al,ax,es,ds...). More...
const optype_t o_mem = 2
 Direct Memory Reference (DATA). More...
const optype_t o_phrase = 3
 Memory Ref [Base Reg + Index Reg]. More...
const optype_t o_displ = 4
 Memory Ref [Base Reg + Index Reg + Displacement]. More...
const optype_t o_imm = 5
 Immediate Value. More...
const optype_t o_far = 6
 Immediate Far Address (CODE). More...
const optype_t o_near = 7
 Immediate Near Address (CODE). More...
const optype_t o_idpspec0 = 8
 processor specific type.
const optype_t o_idpspec1 = 9
 processor specific type.
const optype_t o_idpspec2 = 10
 processor specific type.
const optype_t o_idpspec3 = 11
 processor specific type.
const optype_t o_idpspec4 = 12
 processor specific type.
const optype_t o_idpspec5 = 13
 processor specific type. More...

Variable Documentation

◆ o_reg

o_reg = 1

General Register (al,ax,es,ds...).

The register number should be stored in op_t::reg.

All processor registers, including special registers, can be represented by this operand type.

◆ o_mem

o_mem = 2

Direct Memory Reference (DATA).

A direct memory data reference whose target address is known at compilation time.

The target virtual address is stored in op_t::addr and the full address is calculated as to_ea( \insn_t{cs}, op_t::addr ). For the processors with complex memory organization the final address can be calculated using other segment registers. For flat memories, op_t::addr is the final address and \insn_t{cs} is usually equal to zero. In any case, the address within the segment should be stored in op_t::addr.

◆ o_phrase

o_phrase = 3

Memory Ref [Base Reg + Index Reg].

A memory reference using register contents.

Indexed, register based, and other addressing modes can be represented with the operand type. This addressing mode cannot contain immediate values (use o_displ instead). The phrase number should be stored in op_t::phrase. To denote the pre-increment and similar features please use additional operand fields like op_t::specflag... Usually op_t::phrase contains the register number and additional information is stored in op_t::specflags... Please note that this operand type cannot contain immediate values (except the scaling coefficients).

◆ o_displ

o_displ = 4

Memory Ref [Base Reg + Index Reg + Displacement].

A memory reference using register contents with displacement.

The displacement should be stored in the op_t::addr field. The rest of information is stored the same way as in o_phrase.

◆ o_imm

o_imm = 5

Immediate Value.

Any operand consisting of only a number is represented by this operand type.

The value should be stored in op_t::value. You may sign extend short (1-2 byte) values. In any case don't forget to specify op_t::dtype (should be set for all operand types).

◆ o_far

o_far = 6

Immediate Far Address (CODE).

If the current processor has a special addressing mode for inter-segment references, then this operand type should be used instead of o_near.

If you want, you may use PR_CHK_XREF in processor_t::flag to disable inter-segment calls if o_near operand type is used. Currently only IBM PC uses this flag.

◆ o_near

o_near = 7

Immediate Near Address (CODE).

A direct memory code reference whose target address is known at the compilation time.

The target virtual address is stored in op_t::addr and the final address is always to_ea(\insn_t{cs}, op_t::addr). Usually this operand type is used for the branches and calls whose target address is known. If the current processor has 2 different types of references for inter-segment and intra-segment references, then this should be used only for intra-segment references.

If the above operand types do not cover all possible addressing modes, then use o_idpspec... operand types.

◆ o_idpspec5

const optype_t o_idpspec5 = 13

processor specific type.

(there can be more processor specific types)