Struct iced_x86::OpCodeInfo

source ·
pub struct OpCodeInfo { /* private fields */ }
Expand description

Opcode info, returned by Code::op_code() and Instruction::op_code()

Implementations§

source§

impl OpCodeInfo

source

pub const fn code(&self) -> Code

Gets the code

Examples
use iced_x86::*;

let op_code = Code::EVEX_Vmovapd_ymm_k1z_ymmm256.op_code();
assert_eq!(op_code.code(), Code::EVEX_Vmovapd_ymm_k1z_ymmm256);
source

pub fn mnemonic(&self) -> Mnemonic

Gets the mnemonic

Examples
use iced_x86::*;

let op_code = Code::EVEX_Vmovapd_ymm_k1z_ymmm256.op_code();
assert_eq!(op_code.mnemonic(), Mnemonic::Vmovapd);
source

pub const fn encoding(&self) -> EncodingKind

Gets the encoding

Examples
use iced_x86::*;

let op_code = Code::EVEX_Vmovapd_ymm_k1z_ymmm256.op_code();
assert_eq!(op_code.encoding(), EncodingKind::EVEX);
source

pub fn is_instruction(&self) -> bool

true if it’s an instruction, false if it’s eg. Code::INVALID, db, dw, dd, dq, zero_bytes

Examples
use iced_x86::*;

assert!(Code::EVEX_Vmovapd_ymm_k1z_ymmm256.op_code().is_instruction());
assert!(!Code::INVALID.op_code().is_instruction());
assert!(!Code::DeclareByte.op_code().is_instruction());
source

pub const fn mode16(&self) -> bool

true if it’s an instruction available in 16-bit mode

source

pub const fn mode32(&self) -> bool

true if it’s an instruction available in 32-bit mode

source

pub const fn mode64(&self) -> bool

true if it’s an instruction available in 64-bit mode

source

pub const fn fwait(&self) -> bool

true if an FWAIT (9B) instruction is added before the instruction

source

pub const fn operand_size(&self) -> u32

(Legacy encoding) Gets the required operand size (16,32,64) or 0

source

pub const fn address_size(&self) -> u32

(Legacy encoding) Gets the required address size (16,32,64) or 0

source

pub const fn l(&self) -> u32

(VEX/XOP/EVEX) L / L'L value or default value if is_lig() is true

source

pub const fn w(&self) -> u32

(VEX/XOP/EVEX/MVEX) W value or default value if is_wig() or is_wig32() is true

source

pub const fn is_lig(&self) -> bool

(VEX/XOP/EVEX) true if the L / L'L fields are ignored.

EVEX: if reg-only ops and {er} (EVEX.b is set), L'L is the rounding control and not ignored.

source

pub const fn is_wig(&self) -> bool

(VEX/XOP/EVEX/MVEX) true if the W field is ignored in 16/32/64-bit modes

source

pub const fn is_wig32(&self) -> bool

(VEX/XOP/EVEX/MVEX) true if the W field is ignored in 16/32-bit modes (but not 64-bit mode)

source

pub const fn tuple_type(&self) -> TupleType

(EVEX/MVEX) Gets the tuple type

source

pub fn mvex_eh_bit(&self) -> MvexEHBit

(MVEX) Gets the EH bit that’s required to encode this instruction

source

pub fn mvex_can_use_eviction_hint(&self) -> bool

(MVEX) true if the instruction supports eviction hint (if it has a memory operand)

source

pub fn mvex_can_use_imm_rounding_control(&self) -> bool

(MVEX) true if the instruction’s rounding control bits are stored in imm8[1:0]

source

pub fn mvex_ignores_op_mask_register(&self) -> bool

(MVEX) true if the instruction ignores op mask registers (eg. {k1})

source

pub fn mvex_no_sae_rc(&self) -> bool

(MVEX) true if the instruction must have MVEX.SSS=000 if MVEX.EH=1

source

pub fn mvex_tuple_type_lut_kind(&self) -> MvexTupleTypeLutKind

(MVEX) Gets the tuple type / conv lut kind

source

pub fn mvex_conversion_func(&self) -> MvexConvFn

(MVEX) Gets the conversion function, eg. Sf32

source

pub fn mvex_valid_conversion_funcs_mask(&self) -> u8

(MVEX) Gets flags indicating which conversion functions are valid (bit 0 == func 0)

source

pub fn mvex_valid_swizzle_funcs_mask(&self) -> u8

(MVEX) Gets flags indicating which swizzle functions are valid (bit 0 == func 0)

source

pub fn memory_size(&self) -> MemorySize

If it has a memory operand, gets the MemorySize (non-broadcast memory type)

source

pub fn broadcast_memory_size(&self) -> MemorySize

If it has a memory operand, gets the MemorySize (broadcast memory type)

source

pub const fn can_broadcast(&self) -> bool

(EVEX) true if the instruction supports broadcasting (EVEX.b bit) (if it has a memory operand)

source

pub const fn can_use_rounding_control(&self) -> bool

(EVEX/MVEX) true if the instruction supports rounding control

source

pub const fn can_suppress_all_exceptions(&self) -> bool

(EVEX/MVEX) true if the instruction supports suppress all exceptions

source

pub const fn can_use_op_mask_register(&self) -> bool

(EVEX/MVEX) true if an opmask register can be used

source

pub const fn require_op_mask_register(&self) -> bool

(EVEX/MVEX) true if a non-zero opmask register must be used

source

pub const fn can_use_zeroing_masking(&self) -> bool

(EVEX) true if the instruction supports zeroing masking (if one of the opmask registers K1-K7 is used and destination operand is not a memory operand)

source

pub const fn can_use_lock_prefix(&self) -> bool

true if the LOCK (F0) prefix can be used

source

pub const fn can_use_xacquire_prefix(&self) -> bool

true if the XACQUIRE (F2) prefix can be used

source

pub const fn can_use_xrelease_prefix(&self) -> bool

true if the XRELEASE (F3) prefix can be used

source

pub const fn can_use_rep_prefix(&self) -> bool

true if the REP / REPE (F3) prefixes can be used

source

pub const fn can_use_repne_prefix(&self) -> bool

true if the REPNE (F2) prefix can be used

source

pub const fn can_use_bnd_prefix(&self) -> bool

true if the BND (F2) prefix can be used

source

pub const fn can_use_hint_taken_prefix(&self) -> bool

true if the HINT-TAKEN (3E) and HINT-NOT-TAKEN (2E) prefixes can be used

source

pub const fn can_use_notrack_prefix(&self) -> bool

true if the NOTRACK (3E) prefix can be used

source

pub const fn ignores_rounding_control(&self) -> bool

true if rounding control is ignored (#UD is not generated)

source

pub const fn amd_lock_reg_bit(&self) -> bool

true if the LOCK prefix can be used as an extra register bit (bit 3) to access registers 8-15 without a REX prefix (eg. in 32-bit mode)

source

pub const fn default_op_size64(&self) -> bool

true if the default operand size is 64 in 64-bit mode. A 66 prefix can switch to 16-bit operand size.

source

pub const fn force_op_size64(&self) -> bool

true if the operand size is always 64 in 64-bit mode. A 66 prefix is ignored.

source

pub const fn intel_force_op_size64(&self) -> bool

true if the Intel decoder forces 64-bit operand size. A 66 prefix is ignored.

source

pub const fn must_be_cpl0(&self) -> bool

true if it can only be executed when CPL=0

source

pub const fn cpl0(&self) -> bool

true if it can be executed when CPL=0

source

pub const fn cpl1(&self) -> bool

true if it can be executed when CPL=1

source

pub const fn cpl2(&self) -> bool

true if it can be executed when CPL=2

source

pub const fn cpl3(&self) -> bool

true if it can be executed when CPL=3

source

pub const fn is_input_output(&self) -> bool

true if the instruction accesses the I/O address space (eg. IN, OUT, INS, OUTS)

source

pub const fn is_nop(&self) -> bool

true if it’s one of the many nop instructions (does not include FPU nop instructions, eg. FNOP)

source

pub const fn is_reserved_nop(&self) -> bool

true if it’s one of the many reserved nop instructions (eg. 0F0D, 0F18-0F1F)

source

pub const fn is_serializing_intel(&self) -> bool

true if it’s a serializing instruction (Intel CPUs)

source

pub const fn is_serializing_amd(&self) -> bool

true if it’s a serializing instruction (AMD CPUs)

source

pub const fn may_require_cpl0(&self) -> bool

true if the instruction requires either CPL=0 or CPL<=3 depending on some CPU option (eg. CR4.TSD, CR4.PCE, CR4.UMIP)

source

pub const fn is_cet_tracked(&self) -> bool

true if it’s a tracked JMP/CALL indirect instruction (CET)

source

pub const fn is_non_temporal(&self) -> bool

true if it’s a non-temporal hint memory access (eg. MOVNTDQ)

source

pub const fn is_fpu_no_wait(&self) -> bool

true if it’s a no-wait FPU instruction, eg. FNINIT

source

pub const fn ignores_mod_bits(&self) -> bool

true if the mod bits are ignored and it’s assumed modrm[7:6] == 11b

source

pub const fn no66(&self) -> bool

true if the 66 prefix is not allowed (it will #UD)

source

pub const fn nfx(&self) -> bool

true if the F2/F3 prefixes aren’t allowed

source

pub const fn requires_unique_reg_nums(&self) -> bool

true if the index reg’s reg-num (vsib op) (if any) and register ops’ reg-nums must be unique, eg. MNEMONIC XMM1,YMM1,[RAX+ZMM1*2] is invalid. Registers = XMM/YMM/ZMM/TMM.

source

pub const fn requires_unique_dest_reg_num(&self) -> bool

true if the destination register’s reg-num must not be present in any other operand, eg. MNEMONIC XMM1,YMM1,[RAX+ZMM1*2] is invalid. Registers = XMM/YMM/ZMM/TMM.

source

pub const fn is_privileged(&self) -> bool

true if it’s a privileged instruction (all CPL=0 instructions (except VMCALL) and IOPL instructions IN, INS, OUT, OUTS, CLI, STI)

source

pub const fn is_save_restore(&self) -> bool

true if it reads/writes too many registers

source

pub const fn is_stack_instruction(&self) -> bool

true if it’s an instruction that implicitly uses the stack register, eg. CALL, POP, etc

source

pub const fn ignores_segment(&self) -> bool

true if the instruction doesn’t read the segment register if it uses a memory operand

source

pub const fn is_op_mask_read_write(&self) -> bool

true if the opmask register is read and written (instead of just read). This also implies that it can’t be K0.

source

pub const fn real_mode(&self) -> bool

true if it can be executed in real mode

source

pub const fn protected_mode(&self) -> bool

true if it can be executed in protected mode

source

pub const fn virtual8086_mode(&self) -> bool

true if it can be executed in virtual 8086 mode

source

pub const fn compatibility_mode(&self) -> bool

true if it can be executed in compatibility mode

source

pub const fn long_mode(&self) -> bool

true if it can be executed in 64-bit mode

source

pub const fn use_outside_smm(&self) -> bool

true if it can be used outside SMM

source

pub const fn use_in_smm(&self) -> bool

true if it can be used in SMM

source

pub const fn use_outside_enclave_sgx(&self) -> bool

true if it can be used outside an enclave (SGX)

source

pub const fn use_in_enclave_sgx1(&self) -> bool

true if it can be used inside an enclave (SGX1)

source

pub const fn use_in_enclave_sgx2(&self) -> bool

true if it can be used inside an enclave (SGX2)

source

pub const fn use_outside_vmx_op(&self) -> bool

true if it can be used outside VMX operation

source

pub const fn use_in_vmx_root_op(&self) -> bool

true if it can be used in VMX root operation

source

pub const fn use_in_vmx_non_root_op(&self) -> bool

true if it can be used in VMX non-root operation

source

pub const fn use_outside_seam(&self) -> bool

true if it can be used outside SEAM

source

pub const fn use_in_seam(&self) -> bool

true if it can be used in SEAM

source

pub const fn tdx_non_root_gen_ud(&self) -> bool

true if #UD is generated in TDX non-root operation

source

pub const fn tdx_non_root_gen_ve(&self) -> bool

true if #VE is generated in TDX non-root operation

source

pub const fn tdx_non_root_may_gen_ex(&self) -> bool

true if an exception (eg. #GP(0), #VE) may be generated in TDX non-root operation

source

pub const fn intel_vm_exit(&self) -> bool

(Intel VMX) true if it causes a VM exit in VMX non-root operation

source

pub const fn intel_may_vm_exit(&self) -> bool

(Intel VMX) true if it may cause a VM exit in VMX non-root operation

source

pub const fn intel_smm_vm_exit(&self) -> bool

(Intel VMX) true if it causes an SMM VM exit in VMX root operation (if dual-monitor treatment is activated)

source

pub const fn amd_vm_exit(&self) -> bool

(AMD SVM) true if it causes a #VMEXIT in guest mode

source

pub const fn amd_may_vm_exit(&self) -> bool

(AMD SVM) true if it may cause a #VMEXIT in guest mode

source

pub const fn tsx_abort(&self) -> bool

true if it causes a TSX abort inside a TSX transaction

source

pub const fn tsx_impl_abort(&self) -> bool

true if it causes a TSX abort inside a TSX transaction depending on the implementation

source

pub const fn tsx_may_abort(&self) -> bool

true if it may cause a TSX abort inside a TSX transaction depending on some condition

source

pub const fn intel_decoder16(&self) -> bool

true if it’s decoded by iced’s 16-bit Intel decoder

source

pub const fn intel_decoder32(&self) -> bool

true if it’s decoded by iced’s 32-bit Intel decoder

source

pub const fn intel_decoder64(&self) -> bool

true if it’s decoded by iced’s 64-bit Intel decoder

source

pub const fn amd_decoder16(&self) -> bool

true if it’s decoded by iced’s 16-bit AMD decoder

source

pub const fn amd_decoder32(&self) -> bool

true if it’s decoded by iced’s 32-bit AMD decoder

source

pub const fn amd_decoder64(&self) -> bool

true if it’s decoded by iced’s 64-bit AMD decoder

source

pub fn decoder_option(&self) -> u32

Gets the decoder option that’s needed to decode the instruction or DecoderOptions::NONE. The return value is a DecoderOptions value.

source

pub const fn table(&self) -> OpCodeTableKind

Gets the opcode table

source

pub const fn mandatory_prefix(&self) -> MandatoryPrefix

Gets the mandatory prefix

source

pub const fn op_code(&self) -> u32

Gets the opcode byte(s). The low byte(s) of this value is the opcode. The length is in op_code_len(). It doesn’t include the table value, see table().

Examples
use iced_x86::*;

assert_eq!(Code::Ffreep_sti.op_code().op_code(), 0xDFC0);
assert_eq!(Code::Vmrunw.op_code().op_code(), 0x01D8);
assert_eq!(Code::Sub_r8_rm8.op_code().op_code(), 0x2A);
assert_eq!(Code::Cvtpi2ps_xmm_mmm64.op_code().op_code(), 0x2A);
source

pub const fn op_code_len(&self) -> u32

Gets the length of the opcode bytes (op_code()). The low bytes is the opcode value.

Examples
use iced_x86::*;

assert_eq!(Code::Ffreep_sti.op_code().op_code_len(), 2);
assert_eq!(Code::Vmrunw.op_code().op_code_len(), 2);
assert_eq!(Code::Sub_r8_rm8.op_code().op_code_len(), 1);
assert_eq!(Code::Cvtpi2ps_xmm_mmm64.op_code().op_code_len(), 1);
source

pub const fn is_group(&self) -> bool

true if it’s part of a group

source

pub const fn group_index(&self) -> i32

Group index (0-7) or -1. If it’s 0-7, it’s stored in the reg field of the modrm byte.

source

pub const fn is_rm_group(&self) -> bool

true if it’s part of a modrm.rm group

source

pub const fn rm_group_index(&self) -> i32

Group index (0-7) or -1. If it’s 0-7, it’s stored in the rm field of the modrm byte.

source

pub fn op_count(&self) -> u32

Gets the number of operands

source

pub const fn op0_kind(&self) -> OpCodeOperandKind

Gets operand #0’s opkind

source

pub const fn op1_kind(&self) -> OpCodeOperandKind

Gets operand #1’s opkind

source

pub const fn op2_kind(&self) -> OpCodeOperandKind

Gets operand #2’s opkind

source

pub const fn op3_kind(&self) -> OpCodeOperandKind

Gets operand #3’s opkind

source

pub const fn op4_kind(&self) -> OpCodeOperandKind

Gets operand #4’s opkind

source

pub fn op_kind(&self, operand: u32) -> OpCodeOperandKind

Gets an operand’s opkind

Arguments
  • operand: Operand number, 0-4
source

pub fn op_kinds(&self) -> &[OpCodeOperandKind]

Gets all operand kinds

source

pub const fn is_available_in_mode(&self, bitness: u32) -> bool

Checks if the instruction is available in 16-bit mode, 32-bit mode or 64-bit mode

Arguments
  • bitness: 16, 32 or 64
source

pub fn op_code_string(&self) -> &str

Gets the opcode string, eg. VEX.128.66.0F38.W0 78 /r, see also instruction_string()

Examples
use iced_x86::*;

let op_code = Code::EVEX_Vmovapd_ymm_k1z_ymmm256.op_code();
assert_eq!(op_code.op_code_string(), "EVEX.256.66.0F.W1 28 /r");
source

pub fn instruction_string(&self) -> &str

Gets the instruction string, eg. VPBROADCASTB xmm1, xmm2/m8, see also op_code_string()

Examples
use iced_x86::*;

let op_code = Code::EVEX_Vmovapd_ymm_k1z_ymmm256.op_code();
assert_eq!(op_code.instruction_string(), "VMOVAPD ymm1 {k1}{z}, ymm2/m256");

Trait Implementations§

source§

impl Clone for OpCodeInfo

source§

fn clone(&self) -> OpCodeInfo

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for OpCodeInfo

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for OpCodeInfo

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.