Struct iced_x86::OpCodeInfo
source · [−]pub struct OpCodeInfo { /* private fields */ }
Expand description
Opcode info, returned by Code::op_code()
and Instruction::op_code()
Implementations
sourceimpl OpCodeInfo
impl OpCodeInfo
sourcepub fn code(&self) -> Code
pub 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);
sourcepub fn mnemonic(&self) -> Mnemonic
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);
sourcepub fn encoding(&self) -> EncodingKind
pub 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);
sourcepub fn is_instruction(&self) -> bool
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());
sourcepub fn operand_size(&self) -> u32
pub fn operand_size(&self) -> u32
(Legacy encoding) Gets the required operand size (16,32,64) or 0
sourcepub fn address_size(&self) -> u32
pub fn address_size(&self) -> u32
(Legacy encoding) Gets the required address size (16,32,64) or 0
sourcepub fn w(&self) -> u32
pub fn w(&self) -> u32
(VEX/XOP/EVEX/MVEX) W
value or default value if is_wig()
or is_wig32()
is true
sourcepub fn is_lig(&self) -> bool
pub 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.
sourcepub fn is_wig(&self) -> bool
pub fn is_wig(&self) -> bool
(VEX/XOP/EVEX/MVEX) true
if the W
field is ignored in 16/32/64-bit modes
sourcepub fn is_wig32(&self) -> bool
pub 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)
sourcepub fn tuple_type(&self) -> TupleType
pub fn tuple_type(&self) -> TupleType
(EVEX/MVEX) Gets the tuple type
sourcepub fn memory_size(&self) -> MemorySize
pub fn memory_size(&self) -> MemorySize
If it has a memory operand, gets the MemorySize
(non-broadcast memory type)
sourcepub fn broadcast_memory_size(&self) -> MemorySize
pub fn broadcast_memory_size(&self) -> MemorySize
If it has a memory operand, gets the MemorySize
(broadcast memory type)
sourcepub fn can_broadcast(&self) -> bool
pub fn can_broadcast(&self) -> bool
(EVEX) true
if the instruction supports broadcasting (EVEX.b
bit) (if it has a memory operand)
sourcepub fn can_use_rounding_control(&self) -> bool
pub fn can_use_rounding_control(&self) -> bool
(EVEX/MVEX) true
if the instruction supports rounding control
sourcepub fn can_suppress_all_exceptions(&self) -> bool
pub fn can_suppress_all_exceptions(&self) -> bool
(EVEX/MVEX) true
if the instruction supports suppress all exceptions
sourcepub fn can_use_op_mask_register(&self) -> bool
pub fn can_use_op_mask_register(&self) -> bool
(EVEX/MVEX) true
if an opmask register can be used
sourcepub fn require_op_mask_register(&self) -> bool
pub fn require_op_mask_register(&self) -> bool
(EVEX/MVEX) true
if a non-zero opmask register must be used
sourcepub fn can_use_zeroing_masking(&self) -> bool
pub 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)
sourcepub fn can_use_lock_prefix(&self) -> bool
pub fn can_use_lock_prefix(&self) -> bool
true
if the LOCK
(F0
) prefix can be used
sourcepub fn can_use_xacquire_prefix(&self) -> bool
pub fn can_use_xacquire_prefix(&self) -> bool
true
if the XACQUIRE
(F2
) prefix can be used
sourcepub fn can_use_xrelease_prefix(&self) -> bool
pub fn can_use_xrelease_prefix(&self) -> bool
true
if the XRELEASE
(F3
) prefix can be used
sourcepub fn can_use_rep_prefix(&self) -> bool
pub fn can_use_rep_prefix(&self) -> bool
true
if the REP
/ REPE
(F3
) prefixes can be used
sourcepub fn can_use_repne_prefix(&self) -> bool
pub fn can_use_repne_prefix(&self) -> bool
true
if the REPNE
(F2
) prefix can be used
sourcepub fn can_use_bnd_prefix(&self) -> bool
pub fn can_use_bnd_prefix(&self) -> bool
true
if the BND
(F2
) prefix can be used
sourcepub fn can_use_hint_taken_prefix(&self) -> bool
pub fn can_use_hint_taken_prefix(&self) -> bool
true
if the HINT-TAKEN
(3E
) and HINT-NOT-TAKEN
(2E
) prefixes can be used
sourcepub fn can_use_notrack_prefix(&self) -> bool
pub fn can_use_notrack_prefix(&self) -> bool
true
if the NOTRACK
(3E
) prefix can be used
sourcepub fn ignores_rounding_control(&self) -> bool
pub fn ignores_rounding_control(&self) -> bool
true
if rounding control is ignored (#UD is not generated)
sourcepub fn amd_lock_reg_bit(&self) -> bool
pub 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)
sourcepub fn default_op_size64(&self) -> bool
pub 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.
sourcepub fn force_op_size64(&self) -> bool
pub fn force_op_size64(&self) -> bool
true
if the operand size is always 64 in 64-bit mode. A 66
prefix is ignored.
sourcepub fn intel_force_op_size64(&self) -> bool
pub fn intel_force_op_size64(&self) -> bool
true
if the Intel decoder forces 64-bit operand size. A 66
prefix is ignored.
sourcepub fn must_be_cpl0(&self) -> bool
pub fn must_be_cpl0(&self) -> bool
true
if it can only be executed when CPL=0
sourcepub fn is_input_output(&self) -> bool
pub fn is_input_output(&self) -> bool
true
if the instruction accesses the I/O address space (eg. IN
, OUT
, INS
, OUTS
)
sourcepub fn is_nop(&self) -> bool
pub fn is_nop(&self) -> bool
true
if it’s one of the many nop instructions (does not include FPU nop instructions, eg. FNOP
)
sourcepub fn is_reserved_nop(&self) -> bool
pub fn is_reserved_nop(&self) -> bool
true
if it’s one of the many reserved nop instructions (eg. 0F0D
, 0F18-0F1F
)
sourcepub fn is_serializing_intel(&self) -> bool
pub fn is_serializing_intel(&self) -> bool
true
if it’s a serializing instruction (Intel CPUs)
sourcepub fn is_serializing_amd(&self) -> bool
pub fn is_serializing_amd(&self) -> bool
true
if it’s a serializing instruction (AMD CPUs)
sourcepub fn may_require_cpl0(&self) -> bool
pub 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
)
sourcepub fn is_cet_tracked(&self) -> bool
pub fn is_cet_tracked(&self) -> bool
true
if it’s a tracked JMP
/CALL
indirect instruction (CET)
sourcepub fn is_non_temporal(&self) -> bool
pub fn is_non_temporal(&self) -> bool
true
if it’s a non-temporal hint memory access (eg. MOVNTDQ
)
sourcepub fn is_fpu_no_wait(&self) -> bool
pub fn is_fpu_no_wait(&self) -> bool
true
if it’s a no-wait FPU instruction, eg. FNINIT
sourcepub fn ignores_mod_bits(&self) -> bool
pub fn ignores_mod_bits(&self) -> bool
true
if the mod bits are ignored and it’s assumed modrm[7:6] == 11b
sourcepub fn requires_unique_reg_nums(&self) -> bool
pub 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
.
sourcepub fn requires_unique_dest_reg_num(&self) -> bool
pub 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
.
sourcepub fn is_privileged(&self) -> bool
pub 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
)
sourcepub fn is_save_restore(&self) -> bool
pub fn is_save_restore(&self) -> bool
true
if it reads/writes too many registers
sourcepub fn is_stack_instruction(&self) -> bool
pub fn is_stack_instruction(&self) -> bool
true
if it’s an instruction that implicitly uses the stack register, eg. CALL
, POP
, etc
sourcepub fn ignores_segment(&self) -> bool
pub fn ignores_segment(&self) -> bool
true
if the instruction doesn’t read the segment register if it uses a memory operand
sourcepub fn is_op_mask_read_write(&self) -> bool
pub 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
.
sourcepub fn protected_mode(&self) -> bool
pub fn protected_mode(&self) -> bool
true
if it can be executed in protected mode
sourcepub fn virtual8086_mode(&self) -> bool
pub fn virtual8086_mode(&self) -> bool
true
if it can be executed in virtual 8086 mode
sourcepub fn compatibility_mode(&self) -> bool
pub fn compatibility_mode(&self) -> bool
true
if it can be executed in compatibility mode
sourcepub fn use_outside_smm(&self) -> bool
pub fn use_outside_smm(&self) -> bool
true
if it can be used outside SMM
sourcepub fn use_in_smm(&self) -> bool
pub fn use_in_smm(&self) -> bool
true
if it can be used in SMM
sourcepub fn use_outside_enclave_sgx(&self) -> bool
pub fn use_outside_enclave_sgx(&self) -> bool
true
if it can be used outside an enclave (SGX)
sourcepub fn use_in_enclave_sgx1(&self) -> bool
pub fn use_in_enclave_sgx1(&self) -> bool
true
if it can be used inside an enclave (SGX1)
sourcepub fn use_in_enclave_sgx2(&self) -> bool
pub fn use_in_enclave_sgx2(&self) -> bool
true
if it can be used inside an enclave (SGX2)
sourcepub fn use_outside_vmx_op(&self) -> bool
pub fn use_outside_vmx_op(&self) -> bool
true
if it can be used outside VMX operation
sourcepub fn use_in_vmx_root_op(&self) -> bool
pub fn use_in_vmx_root_op(&self) -> bool
true
if it can be used in VMX root operation
sourcepub fn use_in_vmx_non_root_op(&self) -> bool
pub fn use_in_vmx_non_root_op(&self) -> bool
true
if it can be used in VMX non-root operation
sourcepub fn use_outside_seam(&self) -> bool
pub fn use_outside_seam(&self) -> bool
true
if it can be used outside SEAM
sourcepub fn use_in_seam(&self) -> bool
pub fn use_in_seam(&self) -> bool
true
if it can be used in SEAM
sourcepub fn tdx_non_root_gen_ud(&self) -> bool
pub fn tdx_non_root_gen_ud(&self) -> bool
true
if #UD is generated in TDX non-root operation
sourcepub fn tdx_non_root_gen_ve(&self) -> bool
pub fn tdx_non_root_gen_ve(&self) -> bool
true
if #VE is generated in TDX non-root operation
sourcepub fn tdx_non_root_may_gen_ex(&self) -> bool
pub 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
sourcepub fn intel_vm_exit(&self) -> bool
pub fn intel_vm_exit(&self) -> bool
(Intel VMX) true
if it causes a VM exit in VMX non-root operation
sourcepub fn intel_may_vm_exit(&self) -> bool
pub fn intel_may_vm_exit(&self) -> bool
(Intel VMX) true
if it may cause a VM exit in VMX non-root operation
sourcepub fn intel_smm_vm_exit(&self) -> bool
pub 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)
sourcepub fn amd_vm_exit(&self) -> bool
pub fn amd_vm_exit(&self) -> bool
(AMD SVM) true
if it causes a #VMEXIT in guest mode
sourcepub fn amd_may_vm_exit(&self) -> bool
pub fn amd_may_vm_exit(&self) -> bool
(AMD SVM) true
if it may cause a #VMEXIT in guest mode
sourcepub fn tsx_impl_abort(&self) -> bool
pub fn tsx_impl_abort(&self) -> bool
true
if it causes a TSX abort inside a TSX transaction depending on the implementation
sourcepub fn tsx_may_abort(&self) -> bool
pub fn tsx_may_abort(&self) -> bool
true
if it may cause a TSX abort inside a TSX transaction depending on some condition
sourcepub fn intel_decoder16(&self) -> bool
pub fn intel_decoder16(&self) -> bool
true
if it’s decoded by iced’s 16-bit Intel decoder
sourcepub fn intel_decoder32(&self) -> bool
pub fn intel_decoder32(&self) -> bool
true
if it’s decoded by iced’s 32-bit Intel decoder
sourcepub fn intel_decoder64(&self) -> bool
pub fn intel_decoder64(&self) -> bool
true
if it’s decoded by iced’s 64-bit Intel decoder
sourcepub fn amd_decoder16(&self) -> bool
pub fn amd_decoder16(&self) -> bool
true
if it’s decoded by iced’s 16-bit AMD decoder
sourcepub fn amd_decoder32(&self) -> bool
pub fn amd_decoder32(&self) -> bool
true
if it’s decoded by iced’s 32-bit AMD decoder
sourcepub fn amd_decoder64(&self) -> bool
pub fn amd_decoder64(&self) -> bool
true
if it’s decoded by iced’s 64-bit AMD decoder
sourcepub fn decoder_option(&self) -> u32
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.
sourcepub fn table(&self) -> OpCodeTableKind
pub fn table(&self) -> OpCodeTableKind
Gets the opcode table
sourcepub fn mandatory_prefix(&self) -> MandatoryPrefix
pub fn mandatory_prefix(&self) -> MandatoryPrefix
Gets the mandatory prefix
sourcepub fn op_code(&self) -> u32
pub 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);
sourcepub fn op_code_len(&self) -> u32
pub 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);
sourcepub fn group_index(&self) -> i32
pub 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.
sourcepub fn is_rm_group(&self) -> bool
pub fn is_rm_group(&self) -> bool
true
if it’s part of a modrm.rm group
sourcepub fn rm_group_index(&self) -> i32
pub 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.
sourcepub fn op0_kind(&self) -> OpCodeOperandKind
pub fn op0_kind(&self) -> OpCodeOperandKind
Gets operand #0’s opkind
sourcepub fn op1_kind(&self) -> OpCodeOperandKind
pub fn op1_kind(&self) -> OpCodeOperandKind
Gets operand #1’s opkind
sourcepub fn op2_kind(&self) -> OpCodeOperandKind
pub fn op2_kind(&self) -> OpCodeOperandKind
Gets operand #2’s opkind
sourcepub fn op3_kind(&self) -> OpCodeOperandKind
pub fn op3_kind(&self) -> OpCodeOperandKind
Gets operand #3’s opkind
sourcepub fn op4_kind(&self) -> OpCodeOperandKind
pub fn op4_kind(&self) -> OpCodeOperandKind
Gets operand #4’s opkind
sourcepub fn op_kind(&self, operand: u32) -> OpCodeOperandKind
pub fn op_kind(&self, operand: u32) -> OpCodeOperandKind
sourcepub fn op_kinds(&self) -> &[OpCodeOperandKind]
pub fn op_kinds(&self) -> &[OpCodeOperandKind]
Gets all operand kinds
sourcepub fn is_available_in_mode(&self, bitness: u32) -> bool
pub 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
sourcepub fn op_code_string(&self) -> &str
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");
sourcepub fn instruction_string(&self) -> &str
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
sourceimpl Clone for OpCodeInfo
impl Clone for OpCodeInfo
sourcefn clone(&self) -> OpCodeInfo
fn clone(&self) -> OpCodeInfo
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more