IDA SDK

- Main Page
- Header Files
- Classes
- Modules

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

Public Attributes | Public Member Functions | List of all members
op_t Class Reference
Operands » Operand structure

## Detailed Description

Operand of an instruction.

This structure is filled by the analyzer. Upon entrance to the analyzer, some fields of this structure are initialized:

- type: o_void
- offb: 0
- offo: 0
- flags: OF_SHOW

## Public Attributes
uchar | n
| Number of operand (0,1,2). More...
optype_t | type
| Type of operand (see Operand types)
char | offb
| Offset of operand value from the instruction start (0 means unknown). More...
char | offo
| Same as offb (some operands have 2 numeric values used to form an operand). More...
uchar | flags
| Operand flags
char | dtyp
| Type of operand value (see Operand value types). More...
union {
uint16 reg
| number of register (o_reg)
uint16 phrase
| number of register phrase (o_phrase,o_displ). More...
}; |
union {
uval_t value
| operand value (o_imm) or outer displacement (o_displ+OF_OUTER_DISP). More...
struct {
uint16 low
uint16 high
} value_shorts
| This structure is defined for your convenience only.
}; |
union {
ea_t addr
| virtual address pointed or used by the operand. More...
struct {
uint16 low
uint16 high
} addr_shorts
| This structure is defined for your convenience only.
}; |
union {
ea_t specval
| This field may be used as you want. More...
struct {
uint16 low
| IBM PC: segment register number (o_mem,o_far,o_near)
uint16 high
| IBM PC: segment selector value (o_mem,o_far,o_near)
} specval_shorts
| This structure is defined for your convenience only.
}; |
Special flags
The following fields are used only in idp modules. You may use them as you want to store additional information about the operand.
char | specflag1
char | specflag2
char | specflag3
char | specflag4

## Public Member Functions
void | set_shown ()
| Set operand to be shown.
void | clr_shown ()
| Set operand to hidden.
bool | shown () const
| Is operand set to be shown?
bool | is_reg (int r) const
| Is register operand?
bool | is_imm (uval_t v) const
| Is immediate operand?

## Member Data Documentation

uchar op_t::n

Number of operand (0,1,2).

Initialized once at the start of work. You have no right to change its value.

char op_t::offb

Offset of operand value from the instruction start (0 means unknown).

Of course this field is meaningful only for certain types of operands. Leave it equal to zero if the operand has no offset. This offset should point to the 'interesting' part of operand. For example, it may point to the address of a function in

    call func

or it may point to bytes holding '5' in

    mov  ax, [bx+5]

Usually bytes pointed to this offset are relocated (have fixup information).

char op_t::offo

Same as offb (some operands have 2 numeric values used to form an operand).

This field is used for the second part of operand if it exists. Currently this field is used only for outer offsets of Motorola processors. Leave it equal to zero if the operand has no offset.

char op_t::dtyp

Type of operand value (see Operand value types).

Usually first 9 types are used. This is the type of the operand itself, not the size of the addressing mode. for example, byte ptr [epb+32_bit_offset] will have dt_byte type.

uint16 op_t::phrase

number of register phrase (o_phrase,o_displ).

you yourself define numbers of phrases as you like

uval_t op_t::value

operand value (o_imm) or outer displacement (o_displ+OF_OUTER_DISP).

integer values should be in IDA's (little-endian) order. when using ieee_realcvt(), floating point values should be in the processor's native byte order. dt_double values take up 8 bytes (value and addr fields for 32-bit modules). NB: in case a dt_dword/dt_qword immediate is forced to float by user, the kernel converts it to processor's native order before calling FP conversion routines.

ea_t op_t::addr

virtual address pointed or used by the operand.

(o_mem,o_displ,o_far,o_near)

ea_t op_t::specval

This field may be used as you want.

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

- ua.hpp