Skip to main content

opnd_create_base_disp_ex

Function opnd_create_base_disp_ex 

Source
pub unsafe extern "C" fn opnd_create_base_disp_ex(
    base_reg: reg_id_t,
    index_reg: reg_id_t,
    scale: c_int,
    disp: c_int,
    size: opnd_size_t,
    encode_zero_disp: bool_,
    force_full_disp: bool_,
    disp_short_addr: bool_,
) -> opnd_t
Expand description

Returns a memory reference operand that refers to the address:

  • disp(base_reg, index_reg, scale)

or, in other words,

  • base_reg + index_reg*scale + disp

The operand has data size \p data_size (must be a OPSZ_ constant). Both \p base_reg and \p index_reg must be DR_REG_ constants. \p scale must be either 0, 1, 2, 4, or 8. On ARM, a negative value for \p disp will be converted into a positive value with #DR_OPND_NEGATED set in opnd_get_flags(). On ARM, either \p index_reg must be #DR_REG_NULL or disp must be 0.

On x86, three boolean parameters give control over encoding optimizations (these are ignored on other architectures):

  • If \p encode_zero_disp, a zero value for disp will not be omitted;
  • If \p force_full_disp, a small value for disp will not occupy only one byte.
  • If \p disp_short_addr, short (16-bit for 32-bit mode, 32-bit for 64-bit mode) addressing will be used (note that this normally only needs to be specified for an absolute address; otherwise, simply use the desired short registers for base and/or index).

(The encoding optimization flags are all false when using opnd_create_base_disp()).