| IDA SDK

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 = 0
| Number of operand (0,1,2). More...
optype_t | type = o_void
| Type of operand (see Operand types)
char | offb = 0
| Offset of operand value from the instruction start (0 means unknown). More...
char | offo = 0
| Same as offb (some operands have 2 numeric values used to form an operand). More...
uchar | flags = 0
| Operand flags
op_dtype_t | dtype = 0
| 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 = 0
char | specflag2 = 0
char | specflag3 = 0
char | specflag4 = 0

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

## ◆ n

uchar op_t::n = 0

Number of operand (0,1,2).

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

## ◆ offb

char op_t::offb = 0

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

## ◆ offo

char op_t::offo = 0

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.

## ◆ dtype

op_dtype_t op_t::dtype = 0

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.

## ◆ phrase

uint16 op_t::phrase

number of register phrase (o_phrase,o_displ).

you yourself define numbers of phrases as you like

## ◆ value

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 and dt_qword 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.

## ◆ addr

ea_t op_t::addr

virtual address pointed or used by the operand.

(o_mem,o_displ,o_far,o_near)

## ◆ specval

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