IDA C++ SDK 9.2
|
Various types of instruction operands. More...
Variables | |
const optype_t | o_void = 0 |
No Operand. | |
const optype_t | o_reg = 1 |
General Register (al,ax,es,ds...). | |
const optype_t | o_mem = 2 |
A direct memory reference to a data item. | |
const optype_t | o_phrase = 3 |
An indirect memory reference that uses a register: [reg] There can be several registers but no displacement. | |
const optype_t | o_displ = 4 |
An indirect memory reference that uses a register and has an immediate constant added to it: [reg+N] There can be several registers. | |
const optype_t | o_imm = 5 |
An immediate Value (constant). | |
const optype_t | o_far = 6 |
An immediate far code reference (inter-segment) | |
const optype_t | o_near = 7 |
An immediate near code reference (intra-segment) | |
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. |
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...).
The register number should be stored in op_t::reg.
All processor registers, including special registers, can be represented by this operand type.
const optype_t o_mem = 2 |
A direct memory reference to a data item.
A direct memory data reference whose target address is known at compilation time.
Use this operand type when the address can be calculated statically.
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.
const optype_t o_phrase = 3 |
An indirect memory reference that uses a register: [reg] There can be several registers but no displacement.
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).
const optype_t o_displ = 4 |
An indirect memory reference that uses a register and has an immediate constant added to it: [reg+N] There can be several registers.
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.
const optype_t o_imm = 5 |
An immediate Value (constant).
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).
const optype_t o_far = 6 |
An immediate far code reference (inter-segment)
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.
const optype_t o_near = 7 |
An immediate near code reference (intra-segment)
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.
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.
(there can be more processor specific types)