Instruction¶
- class iced_x86.Instruction¶
A 16/32/64-bit x86 instruction. Created by
Decoderor byInstruction.create*()methods.Examples:
A decoder is usually used to create instructions:
from iced_x86 import * # xchg ah,[rdx+rsi+16h] data = b"\x86\x64\x32\x16" decoder = Decoder(64, data, ip=0x1234_5678) instr = decoder.decode() # Instruction supports __bool__() and returns True if it's # a valid instruction: if not instr: print("Invalid instruction (garbage, data, etc)") # The above code is the same as: if instr.code == Code.INVALID: print("Not an instruction")
But there are also static Instruction.create*() methods that can be used to create instructions:
nop = Instruction.create(Code.NOPD) xor = Instruction.create_reg_i32(Code.XOR_RM64_IMM8, Register.R14, -1) rep_stosd = Instruction.create_rep_stosd(64) add = Instruction.create_mem_i32(Code.ADD_RM64_IMM8, MemoryOperand(Register.RCX, Register.RDX, 8, 0x1234_5678), 2) print(f"{nop}") print(f"{xor}") print(f"{rep_stosd}") print(f"{add}")
Output:
nop xor r14,0FFFFFFFFFFFFFFFFh rep stosd add qword ptr [rcx+rdx*8+12345678h],2
Once you have an instruction you can format it either by using a
Formatteror by calling the instruction’s__repr__(),__str__()or__format__()methods.# Continued from the above example formatter = Formatter(FormatterSyntax.INTEL) # Change some options formatter.uppercase_mnemonics = True formatter.space_after_operand_separator = True formatter.first_operand_char_index = 8 print(f"disasm : {formatter.format(instr)}") # `instr.mnemonic` also returns a `Mnemonic` enum print(f"mnemonic: {formatter.format_mnemonic(instr, FormatMnemonicOptions.NO_PREFIXES)}") print(f"operands: {formatter.format_all_operands(instr)}") # `instr.op0_kind`/etc return operand kind, see also `instr.op0_register`, etc to get reg/mem info print(f"op #0 : {formatter.format_operand(instr, 0)}") print(f"op #1 : {formatter.format_operand(instr, 1)}") print(f"reg RCX : {formatter.format_register(Register.RCX)}")
Output:
disasm : XCHG [rdx+rsi+16h], ah mnemonic: XCHG operands: [rdx+rsi+16h], ah op #0 : [rdx+rsi+16h] op #1 : ah reg RCX : rcx
# A formatter isn't needed if you like most of the default options. # repr() == str() == format() all return the same thing. print(f"disasm : {repr(instr)}") print(f"disasm : {str(instr)}") print(f"disasm : {instr}")
Output:
disasm : xchg ah,[rdx+rsi+16h] disasm : xchg ah,[rdx+rsi+16h] disasm : xchg ah,[rdx+rsi+16h]
# __format__() supports a format spec argument, see the table below print(f"disasm : {instr:f}") print(f"disasm : {instr:g}") print(f"disasm : {instr:i}") print(f"disasm : {instr:m}") print(f"disasm : {instr:n}") print(f"disasm : {instr:gxsSG}")
Output:
disasm : xchg [rdx+rsi+16h],ah disasm : xchg %ah,0x16(%rdx,%rsi) disasm : xchg [rdx+rsi+16h],ah disasm : xchg ah,[rdx+rsi+16h] disasm : xchg ah,[rdx+rsi+16h] disasm : xchgb %ah, %ds:0x16(%rdx,%rsi)
The following format specifiers are supported in any order. If you omit the formatter kind, the default formatter is used (eg. masm):
F-Spec
Description
f
Fast formatter (masm-like syntax)
g
GNU Assembler formatter
i
Intel (XED) formatter
m
masm formatter
n
nasm formatter
X
Uppercase hex numbers with
0xprefixx
Lowercase hex numbers with
0xprefixH
Uppercase hex numbers with
hsuffixh
Lowercase hex numbers with
hsuffixr
RIP-relative memory operands use RIP register instead of abs addr (
[rip+123h]vs[123456789ABCDEF0h])U
Uppercase everything except numbers and hex prefixes/suffixes (ignored by fast fmt)
s
Add a space after the operand separator
S
Always show the segment register (memory operands)
B
Don’t show the branch size (
SHORTorNEAR PTR) (ignored by fast fmt)G
(GNU Assembler): Add mnemonic size suffix (eg.
movlvsmov)M
Always show the memory size (eg.
BYTE PTR) even when not needed_
Use digit separators (eg.
0x12345678vs0x1234_5678) (ignored by fast fmt)- as_near_branch()¶
Converts
Jcc/JMP SHORTtoJcc/JMP NEARand does nothing if it’s not aJcc/JMP SHORTinstructionExamples:
from iced_x86 import * # jbe short label data = b"\x76\x5A" decoder = Decoder(64, data) instr = decoder.decode() assert instr.code == Code.JBE_REL8_64 instr.as_near_branch() assert instr.code == Code.JBE_REL32_64 instr.as_near_branch() assert instr.code == Code.JBE_REL32_64
- as_short_branch()¶
Converts
Jcc/JMP NEARtoJcc/JMP SHORTand does nothing if it’s not aJcc/JMP NEARinstructionExamples:
from iced_x86 import * # jbe near ptr label data = b"\x0F\x86\x5A\xA5\x12\x34" decoder = Decoder(64, data) instr = decoder.decode() assert instr.code == Code.JBE_REL32_64 instr.as_short_branch() assert instr.code == Code.JBE_REL8_64 instr.as_short_branch() assert instr.code == Code.JBE_REL8_64
- code¶
Gets the instruction code (a
Codeenum value), see alsoInstruction.mnemonic- Type:
- code_size¶
Gets the code size (a
CodeSizeenum value) when the instruction was decoded.Note
This value is informational and can be used by a formatter.
- Type:
- condition_code¶
Gets the condition code (a
ConditionCodeenum value) if it’sJcc,SETcc,CMOVcc,CMPccXADD,LOOPccelseConditionCode.NONEis returnedExamples:
from iced_x86 import * # setbe al # jl short label # cmovne ecx,esi # nop data = b"\x0F\x96\xC0\x7C\x5A\x0F\x45\xCE\x90" decoder = Decoder(64, data) # setbe al instr = decoder.decode() assert instr.condition_code == ConditionCode.BE # jl short label instr = decoder.decode() assert instr.condition_code == ConditionCode.L # cmovne ecx,esi instr = decoder.decode() assert instr.condition_code == ConditionCode.NE # nop instr = decoder.decode() assert instr.condition_code == ConditionCode.NONE
- Type:
- copy()¶
Returns a copy of this instance.
- Returns:
A copy of this instance
- Return type:
- cpuid_features()¶
Gets the CPU or CPUID feature flags (a list of
CpuidFeatureenum values)- Returns:
CPU or CPUID feature flags
- Return type:
List[
CpuidFeature]
Examples:
from iced_x86 import * # vmovaps xmm1,xmm5 # vmovaps xmm10{k3}{z},xmm19 data = b"\xC5\xF8\x28\xCD\x62\x31\x7C\x8B\x28\xD3" decoder = Decoder(64, data) # vmovaps xmm1,xmm5 instr = decoder.decode() cpuid = instr.cpuid_features() assert len(cpuid) == 1 assert cpuid[0] == CpuidFeature.AVX # vmovaps xmm10{k3}{z},xmm19 instr = decoder.decode() cpuid = instr.cpuid_features() assert len(cpuid) == 2 assert cpuid[0] == CpuidFeature.AVX512VL assert cpuid[1] == CpuidFeature.AVX512F
- static create(code)¶
Creates an instruction with no operands
- Parameters:
code (
Code) – Code value- Returns:
Created instruction
- Return type:
- static create_branch(code, target)¶
Creates a new near/short branch instruction
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If the created instruction doesn’t have a near branch operand
- static create_cmpsb(address_size, segment_prefix=0, rep_prefix=0)¶
Creates a
CMPSBinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64segment_prefix (
Register) – Segment override orRegister.NONErep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_cmpsd(address_size, segment_prefix=0, rep_prefix=0)¶
Creates a
CMPSDinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64segment_prefix (
Register) – Segment override orRegister.NONErep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_cmpsq(address_size, segment_prefix=0, rep_prefix=0)¶
Creates a
CMPSQinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64segment_prefix (
Register) – Segment override orRegister.NONErep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_cmpsw(address_size, segment_prefix=0, rep_prefix=0)¶
Creates a
CMPSWinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64segment_prefix (
Register) – Segment override orRegister.NONErep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_declare_byte(data)¶
Creates a
db/.byteasm directive- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If len(data) is not 1-16
TypeError – If data is not a supported type
- static create_declare_byte_1(b0)¶
Creates a
db/.byteasm directive- Parameters:
b0 (int) – (
u8) Byte 0- Returns:
Created instruction
- Return type:
- static create_declare_byte_10(b0, b1, b2, b3, b4, b5, b6, b7, b8, b9)¶
Creates a
db/.byteasm directive
- static create_declare_byte_11(b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10)¶
Creates a
db/.byteasm directive- Parameters:
- Returns:
Created instruction
- Return type:
- static create_declare_byte_12(b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11)¶
Creates a
db/.byteasm directive- Parameters:
- Returns:
Created instruction
- Return type:
- static create_declare_byte_13(b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12)¶
Creates a
db/.byteasm directive- Parameters:
b0 (int) – (
u8) Byte 0b1 (int) – (
u8) Byte 1b2 (int) – (
u8) Byte 2b3 (int) – (
u8) Byte 3b4 (int) – (
u8) Byte 4b5 (int) – (
u8) Byte 5b6 (int) – (
u8) Byte 6b7 (int) – (
u8) Byte 7b8 (int) – (
u8) Byte 8b9 (int) – (
u8) Byte 9b10 (int) – (
u8) Byte 10b11 (int) – (
u8) Byte 11b12 (int) – (
u8) Byte 12
- Returns:
Created instruction
- Return type:
- static create_declare_byte_14(b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13)¶
Creates a
db/.byteasm directive- Parameters:
b0 (int) – (
u8) Byte 0b1 (int) – (
u8) Byte 1b2 (int) – (
u8) Byte 2b3 (int) – (
u8) Byte 3b4 (int) – (
u8) Byte 4b5 (int) – (
u8) Byte 5b6 (int) – (
u8) Byte 6b7 (int) – (
u8) Byte 7b8 (int) – (
u8) Byte 8b9 (int) – (
u8) Byte 9b10 (int) – (
u8) Byte 10b11 (int) – (
u8) Byte 11b12 (int) – (
u8) Byte 12b13 (int) – (
u8) Byte 13
- Returns:
Created instruction
- Return type:
- static create_declare_byte_15(b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14)¶
Creates a
db/.byteasm directive- Parameters:
b0 (int) – (
u8) Byte 0b1 (int) – (
u8) Byte 1b2 (int) – (
u8) Byte 2b3 (int) – (
u8) Byte 3b4 (int) – (
u8) Byte 4b5 (int) – (
u8) Byte 5b6 (int) – (
u8) Byte 6b7 (int) – (
u8) Byte 7b8 (int) – (
u8) Byte 8b9 (int) – (
u8) Byte 9b10 (int) – (
u8) Byte 10b11 (int) – (
u8) Byte 11b12 (int) – (
u8) Byte 12b13 (int) – (
u8) Byte 13b14 (int) – (
u8) Byte 14
- Returns:
Created instruction
- Return type:
- static create_declare_byte_16(b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15)¶
Creates a
db/.byteasm directive- Parameters:
b0 (int) – (
u8) Byte 0b1 (int) – (
u8) Byte 1b2 (int) – (
u8) Byte 2b3 (int) – (
u8) Byte 3b4 (int) – (
u8) Byte 4b5 (int) – (
u8) Byte 5b6 (int) – (
u8) Byte 6b7 (int) – (
u8) Byte 7b8 (int) – (
u8) Byte 8b9 (int) – (
u8) Byte 9b10 (int) – (
u8) Byte 10b11 (int) – (
u8) Byte 11b12 (int) – (
u8) Byte 12b13 (int) – (
u8) Byte 13b14 (int) – (
u8) Byte 14b15 (int) – (
u8) Byte 15
- Returns:
Created instruction
- Return type:
- static create_declare_byte_2(b0, b1)¶
Creates a
db/.byteasm directive- Parameters:
- Returns:
Created instruction
- Return type:
- static create_declare_byte_3(b0, b1, b2)¶
Creates a
db/.byteasm directive- Parameters:
- Returns:
Created instruction
- Return type:
- static create_declare_byte_4(b0, b1, b2, b3)¶
Creates a
db/.byteasm directive- Parameters:
- Returns:
Created instruction
- Return type:
- static create_declare_byte_5(b0, b1, b2, b3, b4)¶
Creates a
db/.byteasm directive
- static create_declare_byte_6(b0, b1, b2, b3, b4, b5)¶
Creates a
db/.byteasm directive
- static create_declare_byte_7(b0, b1, b2, b3, b4, b5, b6)¶
Creates a
db/.byteasm directive
- static create_declare_byte_8(b0, b1, b2, b3, b4, b5, b6, b7)¶
Creates a
db/.byteasm directive
- static create_declare_byte_9(b0, b1, b2, b3, b4, b5, b6, b7, b8)¶
Creates a
db/.byteasm directive
- static create_declare_dword_1(d0)¶
Creates a
dd/.intasm directive- Parameters:
d0 (int) – (
u32) Dword 0- Returns:
Created instruction
- Return type:
- static create_declare_dword_2(d0, d1)¶
Creates a
dd/.intasm directive- Parameters:
- Returns:
Created instruction
- Return type:
- static create_declare_dword_3(d0, d1, d2)¶
Creates a
dd/.intasm directive- Parameters:
- Returns:
Created instruction
- Return type:
- static create_declare_dword_4(d0, d1, d2, d3)¶
Creates a
dd/.intasm directive- Parameters:
- Returns:
Created instruction
- Return type:
- static create_declare_qword_1(q0)¶
Creates a
dq/.quadasm directive- Parameters:
q0 (int) – (
u64) Qword 0- Returns:
Created instruction
- Return type:
- static create_declare_qword_2(q0, q1)¶
Creates a
dq/.quadasm directive- Parameters:
- Returns:
Created instruction
- Return type:
- static create_declare_word_1(w0)¶
Creates a
dw/.wordasm directive- Parameters:
w0 (int) – (
u16) Word 0- Returns:
Created instruction
- Return type:
- static create_declare_word_2(w0, w1)¶
Creates a
dw/.wordasm directive- Parameters:
- Returns:
Created instruction
- Return type:
- static create_declare_word_3(w0, w1, w2)¶
Creates a
dw/.wordasm directive- Parameters:
- Returns:
Created instruction
- Return type:
- static create_declare_word_4(w0, w1, w2, w3)¶
Creates a
dw/.wordasm directive- Parameters:
- Returns:
Created instruction
- Return type:
- static create_declare_word_5(w0, w1, w2, w3, w4)¶
Creates a
dw/.wordasm directive
- static create_declare_word_6(w0, w1, w2, w3, w4, w5)¶
Creates a
dw/.wordasm directive
- static create_declare_word_7(w0, w1, w2, w3, w4, w5, w6)¶
Creates a
dw/.wordasm directive
- static create_declare_word_8(w0, w1, w2, w3, w4, w5, w6, w7)¶
Creates a
dw/.wordasm directive
- static create_far_branch(code, selector, offset)¶
Creates a new far branch instruction
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If the created instruction doesn’t have a far branch operand
- static create_i32(code, immediate)¶
Creates an instruction with 1 operand
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_i32_i32(code, immediate1, immediate2)¶
Creates an instruction with 2 operands
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_i32_reg(code, immediate, register)¶
Creates an instruction with 2 operands
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_insb(address_size, rep_prefix=0)¶
Creates a
INSBinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64rep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_insd(address_size, rep_prefix=0)¶
Creates a
INSDinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64rep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_insw(address_size, rep_prefix=0)¶
Creates a
INSWinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64rep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_lodsb(address_size, segment_prefix=0, rep_prefix=0)¶
Creates a
LODSBinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64segment_prefix (
Register) – Segment override orRegister.NONErep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_lodsd(address_size, segment_prefix=0, rep_prefix=0)¶
Creates a
LODSDinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64segment_prefix (
Register) – Segment override orRegister.NONErep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_lodsq(address_size, segment_prefix=0, rep_prefix=0)¶
Creates a
LODSQinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64segment_prefix (
Register) – Segment override orRegister.NONErep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_lodsw(address_size, segment_prefix=0, rep_prefix=0)¶
Creates a
LODSWinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64segment_prefix (
Register) – Segment override orRegister.NONErep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_maskmovdqu(address_size, register1, register2, segment_prefix=0)¶
Creates a
MASKMOVDQUinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64register1 (
Register) – Registerregister2 (
Register) – Registersegment_prefix (
Register) – Segment override orRegister.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_maskmovq(address_size, register1, register2, segment_prefix=0)¶
Creates a
MASKMOVQinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64register1 (
Register) – Registerregister2 (
Register) – Registersegment_prefix (
Register) – Segment override orRegister.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_mem(code, memory)¶
Creates an instruction with 1 operand
- Parameters:
code (
Code) – Code valuememory (
MemoryOperand) – op0: Memory operand
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_mem_i32(code, memory, immediate)¶
Creates an instruction with 2 operands
- Parameters:
code (
Code) – Code valuememory (
MemoryOperand) – op0: Memory operandimmediate (int) – (
i32) op1: Immediate value
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_mem_reg(code, memory, register)¶
Creates an instruction with 2 operands
- Parameters:
code (
Code) – Code valuememory (
MemoryOperand) – op0: Memory operandregister (
Register) – op1: Register
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_mem_reg_i32(code, memory, register, immediate)¶
Creates an instruction with 3 operands
- Parameters:
code (
Code) – Code valuememory (
MemoryOperand) – op0: Memory operandregister (
Register) – op1: Registerimmediate (int) – (
i32) op2: Immediate value
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_mem_reg_reg(code, memory, register1, register2)¶
Creates an instruction with 3 operands
- Parameters:
code (
Code) – Code valuememory (
MemoryOperand) – op0: Memory operandregister1 (
Register) – op1: Registerregister2 (
Register) – op2: Register
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_mem_reg_u32(code, memory, register, immediate)¶
Creates an instruction with 3 operands
- Parameters:
code (
Code) – Code valuememory (
MemoryOperand) – op0: Memory operandregister (
Register) – op1: Registerimmediate (int) – (
u32) op2: Immediate value
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_mem_u32(code, memory, immediate)¶
Creates an instruction with 2 operands
- Parameters:
code (
Code) – Code valuememory (
MemoryOperand) – op0: Memory operandimmediate (int) – (
u32) op1: Immediate value
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_movsb(address_size, segment_prefix=0, rep_prefix=0)¶
Creates a
MOVSBinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64segment_prefix (
Register) – Segment override orRegister.NONErep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_movsd(address_size, segment_prefix=0, rep_prefix=0)¶
Creates a
MOVSDinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64segment_prefix (
Register) – Segment override orRegister.NONErep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_movsq(address_size, segment_prefix=0, rep_prefix=0)¶
Creates a
MOVSQinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64segment_prefix (
Register) – Segment override orRegister.NONErep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_movsw(address_size, segment_prefix=0, rep_prefix=0)¶
Creates a
MOVSWinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64segment_prefix (
Register) – Segment override orRegister.NONErep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_outsb(address_size, segment_prefix=0, rep_prefix=0)¶
Creates a
OUTSBinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64segment_prefix (
Register) – Segment override orRegister.NONErep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_outsd(address_size, segment_prefix=0, rep_prefix=0)¶
Creates a
OUTSDinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64segment_prefix (
Register) – Segment override orRegister.NONErep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_outsw(address_size, segment_prefix=0, rep_prefix=0)¶
Creates a
OUTSWinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64segment_prefix (
Register) – Segment override orRegister.NONErep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_reg(code, register)¶
Creates an instruction with 1 operand
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_i32(code, register, immediate)¶
Creates an instruction with 2 operands
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_i32_i32(code, register, immediate1, immediate2)¶
Creates an instruction with 3 operands
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_i64(code, register, immediate)¶
Creates an instruction with 2 operands
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_mem(code, register, memory)¶
Creates an instruction with 2 operands
- Parameters:
code (
Code) – Code valueregister (
Register) – op0: Registermemory (
MemoryOperand) – op1: Memory operand
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_mem_i32(code, register, memory, immediate)¶
Creates an instruction with 3 operands
- Parameters:
code (
Code) – Code valueregister (
Register) – op0: Registermemory (
MemoryOperand) – op1: Memory operandimmediate (int) – (
i32) op2: Immediate value
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_mem_reg(code, register1, memory, register2)¶
Creates an instruction with 3 operands
- Parameters:
code (
Code) – Code valueregister1 (
Register) – op0: Registermemory (
MemoryOperand) – op1: Memory operandregister2 (
Register) – op2: Register
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_mem_u32(code, register, memory, immediate)¶
Creates an instruction with 3 operands
- Parameters:
code (
Code) – Code valueregister (
Register) – op0: Registermemory (
MemoryOperand) – op1: Memory operandimmediate (int) – (
u32) op2: Immediate value
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_reg(code, register1, register2)¶
Creates an instruction with 2 operands
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_reg_i32(code, register1, register2, immediate)¶
Creates an instruction with 3 operands
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_reg_i32_i32(code, register1, register2, immediate1, immediate2)¶
Creates an instruction with 4 operands
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_reg_mem(code, register1, register2, memory)¶
Creates an instruction with 3 operands
- Parameters:
code (
Code) – Code valueregister1 (
Register) – op0: Registerregister2 (
Register) – op1: Registermemory (
MemoryOperand) – op2: Memory operand
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_reg_mem_i32(code, register1, register2, memory, immediate)¶
Creates an instruction with 4 operands
- Parameters:
code (
Code) – Code valueregister1 (
Register) – op0: Registerregister2 (
Register) – op1: Registermemory (
MemoryOperand) – op2: Memory operandimmediate (int) – (
i32) op3: Immediate value
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_reg_mem_reg(code, register1, register2, memory, register3)¶
Creates an instruction with 4 operands
- Parameters:
code (
Code) – Code valueregister1 (
Register) – op0: Registerregister2 (
Register) – op1: Registermemory (
MemoryOperand) – op2: Memory operandregister3 (
Register) – op3: Register
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_reg_mem_reg_i32(code, register1, register2, memory, register3, immediate)¶
Creates an instruction with 5 operands
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_reg_mem_reg_u32(code, register1, register2, memory, register3, immediate)¶
Creates an instruction with 5 operands
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_reg_mem_u32(code, register1, register2, memory, immediate)¶
Creates an instruction with 4 operands
- Parameters:
code (
Code) – Code valueregister1 (
Register) – op0: Registerregister2 (
Register) – op1: Registermemory (
MemoryOperand) – op2: Memory operandimmediate (int) – (
u32) op3: Immediate value
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_reg_reg(code, register1, register2, register3)¶
Creates an instruction with 3 operands
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_reg_reg_i32(code, register1, register2, register3, immediate)¶
Creates an instruction with 4 operands
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_reg_reg_mem(code, register1, register2, register3, memory)¶
Creates an instruction with 4 operands
- Parameters:
code (
Code) – Code valueregister1 (
Register) – op0: Registerregister2 (
Register) – op1: Registerregister3 (
Register) – op2: Registermemory (
MemoryOperand) – op3: Memory operand
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_reg_reg_mem_i32(code, register1, register2, register3, memory, immediate)¶
Creates an instruction with 5 operands
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_reg_reg_mem_u32(code, register1, register2, register3, memory, immediate)¶
Creates an instruction with 5 operands
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_reg_reg_reg(code, register1, register2, register3, register4)¶
Creates an instruction with 4 operands
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_reg_reg_reg_i32(code, register1, register2, register3, register4, immediate)¶
Creates an instruction with 5 operands
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_reg_reg_reg_u32(code, register1, register2, register3, register4, immediate)¶
Creates an instruction with 5 operands
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_reg_reg_u32(code, register1, register2, register3, immediate)¶
Creates an instruction with 4 operands
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_reg_u32(code, register1, register2, immediate)¶
Creates an instruction with 3 operands
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_reg_u32_u32(code, register1, register2, immediate1, immediate2)¶
Creates an instruction with 4 operands
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_u32(code, register, immediate)¶
Creates an instruction with 2 operands
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_u32_u32(code, register, immediate1, immediate2)¶
Creates an instruction with 3 operands
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_reg_u64(code, register, immediate)¶
Creates an instruction with 2 operands
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_rep_insb(address_size)¶
Creates a
REP INSBinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_rep_insd(address_size)¶
Creates a
REP INSDinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_rep_insw(address_size)¶
Creates a
REP INSWinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_rep_lodsb(address_size)¶
Creates a
REP LODSBinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_rep_lodsd(address_size)¶
Creates a
REP LODSDinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_rep_lodsq(address_size)¶
Creates a
REP LODSQinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_rep_lodsw(address_size)¶
Creates a
REP LODSWinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_rep_movsb(address_size)¶
Creates a
REP MOVSBinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_rep_movsd(address_size)¶
Creates a
REP MOVSDinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_rep_movsq(address_size)¶
Creates a
REP MOVSQinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_rep_movsw(address_size)¶
Creates a
REP MOVSWinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_rep_outsb(address_size)¶
Creates a
REP OUTSBinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_rep_outsd(address_size)¶
Creates a
REP OUTSDinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_rep_outsw(address_size)¶
Creates a
REP OUTSWinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_rep_stosb(address_size)¶
Creates a
REP STOSBinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_rep_stosd(address_size)¶
Creates a
REP STOSDinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_rep_stosq(address_size)¶
Creates a
REP STOSQinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_rep_stosw(address_size)¶
Creates a
REP STOSWinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_repe_cmpsb(address_size)¶
Creates a
REPE CMPSBinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_repe_cmpsd(address_size)¶
Creates a
REPE CMPSDinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_repe_cmpsq(address_size)¶
Creates a
REPE CMPSQinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_repe_cmpsw(address_size)¶
Creates a
REPE CMPSWinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_repe_scasb(address_size)¶
Creates a
REPE SCASBinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_repe_scasd(address_size)¶
Creates a
REPE SCASDinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_repe_scasq(address_size)¶
Creates a
REPE SCASQinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_repe_scasw(address_size)¶
Creates a
REPE SCASWinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_repne_cmpsb(address_size)¶
Creates a
REPNE CMPSBinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_repne_cmpsd(address_size)¶
Creates a
REPNE CMPSDinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_repne_cmpsq(address_size)¶
Creates a
REPNE CMPSQinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_repne_cmpsw(address_size)¶
Creates a
REPNE CMPSWinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_repne_scasb(address_size)¶
Creates a
REPNE SCASBinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_repne_scasd(address_size)¶
Creates a
REPNE SCASDinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_repne_scasq(address_size)¶
Creates a
REPNE SCASQinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_repne_scasw(address_size)¶
Creates a
REPNE SCASWinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_scasb(address_size, rep_prefix=0)¶
Creates a
SCASBinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64rep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_scasd(address_size, rep_prefix=0)¶
Creates a
SCASDinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64rep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_scasq(address_size, rep_prefix=0)¶
Creates a
SCASQinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64rep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_scasw(address_size, rep_prefix=0)¶
Creates a
SCASWinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64rep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_stosb(address_size, rep_prefix=0)¶
Creates a
STOSBinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64rep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_stosd(address_size, rep_prefix=0)¶
Creates a
STOSDinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64rep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_stosq(address_size, rep_prefix=0)¶
Creates a
STOSQinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64rep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_stosw(address_size, rep_prefix=0)¶
Creates a
STOSWinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64rep_prefix (
RepPrefixKind) – Rep prefix orRepPrefixKind.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_u32(code, immediate)¶
Creates an instruction with 1 operand
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_u32_reg(code, immediate, register)¶
Creates an instruction with 2 operands
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_u32_u32(code, immediate1, immediate2)¶
Creates an instruction with 2 operands
- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If one of the operands is invalid (basic checks)
- static create_vmaskmovdqu(address_size, register1, register2, segment_prefix=0)¶
Creates a
VMASKMOVDQUinstruction- Parameters:
address_size (int) – (
u32) 16, 32, or 64register1 (
Register) – Registerregister2 (
Register) – Registersegment_prefix (
Register) – Segment override orRegister.NONE
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If address_size is not one of 16, 32, 64.
- static create_xbegin(bitness, target)¶
Creates a new
XBEGINinstruction- Parameters:
- Returns:
Created instruction
- Return type:
- Raises:
ValueError – If bitness is not one of 16, 32, 64.
- declare_data_len¶
(
u8) Gets the number of elements in adb/dw/dd/dqdirective.Can only be called if
Instruction.codeisCode.DECLAREBYTE,Code.DECLAREWORD,Code.DECLAREDWORD,Code.DECLAREQWORD- Type:
- encoding¶
Instruction encoding, eg. Legacy, 3DNow!, VEX, EVEX, XOP (an
EncodingKindenum value)Examples:
from iced_x86 import * # vmovaps xmm1,xmm5 data = b"\xC5\xF8\x28\xCD" decoder = Decoder(64, data) instr = decoder.decode() assert instr.encoding == EncodingKind.VEX
- Type:
- eq_all_bits(other)¶
Checks if two instructions are equal, comparing all bits, not ignoring anything.
==ignores some fields.- Parameters:
other (
Instruction) – Other instruction- Returns:
Trueif other is exactly identical to this instance- Return type:
- far_branch16¶
(
u16) Gets the operand’s branch target.Use this method if the operand has kind
OpKind.FAR_BRANCH16- Type:
- far_branch32¶
(
u32) Gets the operand’s branch target.Use this method if the operand has kind
OpKind.FAR_BRANCH32- Type:
- far_branch_selector¶
(16`) Gets the operand’s branch target selector.
Use this method if the operand has kind
OpKind.FAR_BRANCH16orOpKind.FAR_BRANCH32- Type:
- flow_control¶
Control flow info (a
FlowControlenum value)Examples:
from iced_x86 import * # or ecx,esi # ud0 rcx,rsi # call rcx data = b"\x0B\xCE\x48\x0F\xFF\xCE\xFF\xD1" decoder = Decoder(64, data) # or ecx,esi instr = decoder.decode() assert instr.flow_control == FlowControl.NEXT # ud0 rcx,rsi instr = decoder.decode() assert instr.flow_control == FlowControl.EXCEPTION # call rcx instr = decoder.decode() assert instr.flow_control == FlowControl.INDIRECT_CALL
- Type:
- fpu_stack_increment_info()¶
Gets the FPU status word’s
TOPincrement value and whether it’s a conditional or unconditional push/pop and whetherTOPis written.- Returns:
FPU stack info
- Return type:
Examples:
from iced_x86 import * # ficomp dword ptr [rax] data = b"\xDA\x18" decoder = Decoder(64, data) instr = decoder.decode() info = instr.fpu_stack_increment_info() # It pops the stack once assert info.increment == 1 assert not info.conditional assert info.writes_top
- get_declare_byte_value(index)¶
Gets a
dbvalue, see alsoInstruction.declare_data_len.Can only be called if
Instruction.codeisCode.DECLAREBYTE- Parameters:
index (int) – Index (0-15)
- Returns:
(
u8) The value- Return type:
- Raises:
ValueError – If index is invalid
- get_declare_byte_value_i8(index)¶
Gets a
dbvalue, see alsoInstruction.declare_data_len.Can only be called if
Instruction.codeisCode.DECLAREBYTE- Parameters:
index (int) – Index (0-15)
- Returns:
(
i8) The value- Return type:
- Raises:
ValueError – If index is invalid
- get_declare_dword_value(index)¶
Gets a
ddvalue, see alsoInstruction.declare_data_len.Can only be called if
Instruction.codeisCode.DECLAREDWORD- Parameters:
index (int) – Index (0-3)
- Returns:
(
u32) The value- Return type:
- Raises:
ValueError – If index is invalid
- get_declare_dword_value_i32(index)¶
Gets a
ddvalue, see alsoInstruction.declare_data_len.Can only be called if
Instruction.codeisCode.DECLAREDWORD- Parameters:
index (int) – Index (0-3)
- Returns:
(
i32) The value- Return type:
- Raises:
ValueError – If index is invalid
- get_declare_qword_value(index)¶
Gets a
dqvalue, see alsoInstruction.declare_data_len.Can only be called if
Instruction.codeisCode.DECLAREQWORD- Parameters:
index (int) – Index (0-1)
- Returns:
(
u64) The value- Return type:
- Raises:
ValueError – If index is invalid
- get_declare_qword_value_i64(index)¶
Gets a
dqvalue, see alsoInstruction.declare_data_len.Can only be called if
Instruction.codeisCode.DECLAREQWORD- Parameters:
index (int) – Index (0-1)
- Returns:
(
i64) The value- Return type:
- Raises:
ValueError – If index is invalid
- get_declare_word_value(index)¶
Gets a
dwvalue, see alsoInstruction.declare_data_len.Can only be called if
Instruction.codeisCode.DECLAREWORD- Parameters:
index (int) – Index (0-7)
- Returns:
(
u16) The value- Return type:
- Raises:
ValueError – If index is invalid
- get_declare_word_value_i16(index)¶
Gets a
dwvalue, see alsoInstruction.declare_data_len.Can only be called if
Instruction.codeisCode.DECLAREWORD- Parameters:
index (int) – Index (0-7)
- Returns:
(
i16) The value- Return type:
- Raises:
ValueError – If index is invalid
- has_op_mask¶
Checks if there’s an opmask register (
Instruction.op_mask)- Type:
- has_segment_prefix¶
Checks if the instruction has a segment override prefix, see
Instruction.segment_prefix- Type:
- immediate(operand)¶
Gets an operand’s immediate value
- Parameters:
operand (int) – Operand number, 0-4
- Returns:
(
u64) The immediate- Return type:
- Raises:
ValueError – If operand is invalid or not immediate.
- immediate16¶
(
u16) Gets the operand’s immediate value.Use this method if the operand has kind
OpKind.IMMEDIATE16- Type:
- immediate32¶
(
u32) Gets the operand’s immediate value.Use this method if the operand has kind
OpKind.IMMEDIATE32- Type:
- immediate32to64¶
(
i64) Gets the operand’s immediate value.Use this method if the operand has kind
OpKind.IMMEDIATE32TO64- Type:
- immediate64¶
(
u64) Gets the operand’s immediate value.Use this method if the operand has kind
OpKind.IMMEDIATE64- Type:
- immediate8¶
(
u8) Gets the operand’s immediate value.Use this method if the operand has kind
OpKind.IMMEDIATE8- Type:
- immediate8_2nd¶
(
u8) Gets the operand’s immediate value.Use this method if the operand has kind
OpKind.IMMEDIATE8_2ND- Type:
- immediate8to16¶
(
i16) Gets the operand’s immediate value.Use this method if the operand has kind
OpKind.IMMEDIATE8TO16- Type:
- immediate8to32¶
(
i32) Gets the operand’s immediate value.Use this method if the operand has kind
OpKind.IMMEDIATE8TO32- Type:
- immediate8to64¶
(
i64) Gets the operand’s immediate value.Use this method if the operand has kind
OpKind.IMMEDIATE8TO64- Type:
- ip_rel_memory_address¶
(
u64) Gets theRIP/EIPreleative address (Instruction.memory_displacement).This method is only valid if there’s a memory operand with
RIP/EIPrelative addressing, seeInstruction.is_ip_rel_memory_operand- Type:
- is_invalid¶
Checks if it’s an invalid instruction (
Instruction.code==Code.INVALID)- Type:
- is_privileged¶
Trueif it’s a privileged instruction (all CPL=0 instructions (exceptVMCALL) and IOPL instructionsIN,INS,OUT,OUTS,CLI,STI)- Type:
- is_save_restore_instruction¶
Trueif it’s an instruction that saves or restores too many registers (eg.FXRSTOR,XSAVE, etc).- Type:
- is_stack_instruction¶
Trueif this is an instruction that implicitly uses the stack pointer (SP/ESP/RSP), eg.CALL,PUSH,POP,RET, etc.See also
Instruction.stack_pointer_incrementExamples:
from iced_x86 import * # or ecx,esi # push rax data = b"\x0B\xCE\x50" decoder = Decoder(64, data) # or ecx,esi instr = decoder.decode() assert not instr.is_stack_instruction # push rax instr = decoder.decode() assert instr.is_stack_instruction assert instr.stack_pointer_increment == -8
- Type:
- is_string_instruction¶
Trueif it’s a “string” instruction, such asMOVS,LODS,SCAS, etc.- Type:
- is_vsib¶
Checks if this is a VSIB instruction, see also
Instruction.is_vsib32,Instruction.is_vsib64- Type:
- is_vsib32¶
VSIB instructions only (
Instruction.is_vsib):Trueif it’s using 32-bit indexes,Falseif it’s using 64-bit indexes- Type:
- is_vsib64¶
VSIB instructions only (
Instruction.is_vsib):Trueif it’s using 64-bit indexes,Falseif it’s using 32-bit indexes- Type:
- len¶
(
u8) Gets the length of the instruction, 0-15 bytes.You can also call len(instr) to get this value.
Note
This is just informational. If you modify the instruction or create a new one, this method could return the wrong value.
- Type:
- memory_base¶
Gets the memory operand’s base register (a
Registerenum value) orRegister.NONEif none.Use this method if the operand has kind
OpKind.MEMORY- Type:
- memory_displ_size¶
(
u8) Gets the size of the memory displacement in bytes.Valid values are
0,1(16/32/64-bit),2(16-bit),4(32-bit),8(64-bit).Note that the return value can be 1 and
Instruction.memory_displacementmay still not fit in a signed byte if it’s an EVEX/MVEX encoded instruction.Use this method if the operand has kind
OpKind.MEMORY- Type:
- memory_displacement¶
(
u64) Gets the memory operand’s displacement or the 64-bit absolute address if it’s anEIPorRIPrelative memory operand.Use this method if the operand has kind
OpKind.MEMORY- Type:
- memory_index¶
Gets the memory operand’s index register (a
Registerenum value) orRegister.NONEif none.Use this method if the operand has kind
OpKind.MEMORY- Type:
- memory_index_scale¶
(
u8) Gets the index register scale value, valid values are*1,*2,*4,*8.Use this method if the operand has kind
OpKind.MEMORY- Type:
- memory_segment¶
Gets the effective segment register used to reference the memory location (a
Registerenum value).Use this method if the operand has kind
OpKind.MEMORY,OpKind.MEMORY_SEG_SI,OpKind.MEMORY_SEG_ESI,OpKind.MEMORY_SEG_RSI- Type:
- memory_size¶
Gets the size of the memory location (a
MemorySizeenum value) that is referenced by the operand.See also
Instruction.is_broadcast.Use this method if the operand has kind
OpKind.MEMORY,OpKind.MEMORY_SEG_SI,OpKind.MEMORY_SEG_ESI,OpKind.MEMORY_SEG_RSI,OpKind.MEMORY_ESDI,OpKind.MEMORY_ESEDI,OpKind.MEMORY_ESRDI- Type:
- merging_masking¶
Trueif merging-masking,Falseif zeroing-masking.Only used by most EVEX encoded instructions that use opmask registers.
- Type:
- mnemonic¶
Gets the mnemonic (a
Mnemonicenum value), see alsoInstruction.code- Type:
- mvex_reg_mem_conv¶
(MVEX) Register/memory operand conversion function (an
MvexRegMemConvenum value)- Type:
- near_branch16¶
(
u16) Gets the operand’s branch target.Use this method if the operand has kind
OpKind.NEAR_BRANCH16- Type:
- near_branch32¶
(
u32) Gets the operand’s branch target.Use this method if the operand has kind
OpKind.NEAR_BRANCH32- Type:
- near_branch64¶
(
u64) Gets the operand’s branch target.Use this method if the operand has kind
OpKind.NEAR_BRANCH64- Type:
- near_branch_target¶
(
u64) Gets the near branch target if it’s aCALL/JMP/Jccnear branch instruction(i.e., if
Instruction.op0_kindisOpKind.NEAR_BRANCH16,OpKind.NEAR_BRANCH32orOpKind.NEAR_BRANCH64)- Type:
- negate_condition_code()¶
Negates the condition code, eg.
JE->JNE.Can be used if it’s
Jcc,SETcc,CMOVcc,CMPccXADD,LOOPccand does nothing if the instruction doesn’t have a condition code.Examples:
from iced_x86 import * # setbe al data = b"\x0F\x96\xC0" decoder = Decoder(64, data) instr = decoder.decode() assert instr.code == Code.SETBE_RM8 assert instr.condition_code == ConditionCode.BE instr.negate_condition_code() assert instr.code == Code.SETA_RM8 assert instr.condition_code == ConditionCode.A
- op0_kind¶
Gets operand #0’s kind (an
OpKindenum value) if the operand exists (seeInstruction.op_countandInstruction.op_kind)- Type:
- op0_register¶
Gets operand #0’s register value (a
Registerenum value).Use this method if operand #0 (
Instruction.op0_kind) has kindOpKind.REGISTER, seeInstruction.op_countandInstruction.op_register- Type:
- op1_kind¶
Gets operand #1’s kind (an
OpKindenum value) if the operand exists (seeInstruction.op_countandInstruction.op_kind)- Type:
- op1_register¶
Gets operand #1’s register value (a
Registerenum value).Use this method if operand #1 (
Instruction.op0_kind) has kindOpKind.REGISTER, seeInstruction.op_countandInstruction.op_register- Type:
- op2_kind¶
Gets operand #2’s kind (an
OpKindenum value) if the operand exists (seeInstruction.op_countandInstruction.op_kind)- Type:
- op2_register¶
Gets operand #2’s register value (a
Registerenum value).Use this method if operand #2 (
Instruction.op0_kind) has kindOpKind.REGISTER, seeInstruction.op_countandInstruction.op_register- Type:
- op3_kind¶
Gets operand #3’s kind (an
OpKindenum value) if the operand exists (seeInstruction.op_countandInstruction.op_kind)- Type:
- op3_register¶
Gets operand #3’s register value (a
Registerenum value).Use this method if operand #3 (
Instruction.op0_kind) has kindOpKind.REGISTER, seeInstruction.op_countandInstruction.op_register- Type:
- op4_kind¶
Gets operand #4’s kind (an
OpKindenum value) if the operand exists (seeInstruction.op_countandInstruction.op_kind)- Type:
- op4_register¶
Gets operand #4’s register value (a
Registerenum value).Use this method if operand #4 (
Instruction.op0_kind) has kindOpKind.REGISTER, seeInstruction.op_countandInstruction.op_register- Type:
- op_code()¶
Gets the
OpCodeInfo- Returns:
Op code info
- Return type:
- op_count¶
Gets the operand count. An instruction can have 0-5 operands.
Examples:
from iced_x86 import * # add [rax],ebx data = b"\x01\x18" decoder = Decoder(64, data) instr = decoder.decode() assert instr.op_count == 2
- Type:
- op_kind(operand)¶
Gets an operand’s kind (an
OpKindenum value) if it exists (seeInstruction.op_count)- Parameters:
operand (int) – Operand number, 0-4
- Returns:
The operand’s operand kind
- Return type:
- Raises:
ValueError – If operand is invalid
Examples:
from iced_x86 import * # add [rax],ebx data = b"\x01\x18" decoder = Decoder(64, data) instr = decoder.decode() assert instr.op_count == 2 assert instr.op_kind(0) == OpKind.MEMORY assert instr.memory_base == Register.RAX assert instr.memory_index == Register.NONE assert instr.op_kind(1) == OpKind.REGISTER assert instr.op_register(1) == Register.EBX
- op_mask¶
Gets the opmask register (
Register.K1-Register.K7) orRegister.NONEif none (aRegisterenum value)- Type:
- op_register(operand)¶
Gets the operand’s register value (a
Registerenum value).Use this method if the operand has kind
OpKind.REGISTER- Parameters:
operand (int) – Operand number, 0-4
- Returns:
The operand’s register value
- Return type:
- Raises:
ValueError – If operand is invalid
Examples:
from iced_x86 import * # add [rax],ebx data = b"\x01\x18" decoder = Decoder(64, data) instr = decoder.decode() assert instr.op_count == 2 assert instr.op_kind(0) == OpKind.MEMORY assert instr.op_kind(1) == OpKind.REGISTER assert instr.op_register(1) == Register.EBX
- rflags_cleared¶
All flags that are always cleared by the CPU.
This method returns an
RflagsBitsvalue. See alsoInstruction.rflags_modified.Examples:
from iced_x86 import * # adc rsi,rcx # xor rdi,5Ah data = b"\x48\x11\xCE\x48\x83\xF7\x5A" decoder = Decoder(64, data) # adc rsi,rcx instr = decoder.decode() assert instr.rflags_read == RflagsBits.CF assert instr.rflags_written == RflagsBits.OF | RflagsBits.SF | RflagsBits.ZF | RflagsBits.AF | RflagsBits.CF | RflagsBits.PF assert instr.rflags_cleared == RflagsBits.NONE assert instr.rflags_set == RflagsBits.NONE assert instr.rflags_undefined == RflagsBits.NONE assert instr.rflags_modified == RflagsBits.OF | RflagsBits.SF | RflagsBits.ZF | RflagsBits.AF | RflagsBits.CF | RflagsBits.PF # xor rdi,5Ah instr = decoder.decode() assert instr.rflags_read == RflagsBits.NONE assert instr.rflags_written == RflagsBits.SF | RflagsBits.ZF | RflagsBits.PF assert instr.rflags_cleared == RflagsBits.OF | RflagsBits.CF assert instr.rflags_set == RflagsBits.NONE assert instr.rflags_undefined == RflagsBits.AF assert instr.rflags_modified == RflagsBits.OF | RflagsBits.SF | RflagsBits.ZF | RflagsBits.AF | RflagsBits.CF | RflagsBits.PF
- Type:
- rflags_modified¶
All flags that are modified by the CPU. This is
rflags_written + rflags_cleared + rflags_set + rflags_undefined.This method returns an
RflagsBitsvalue.Examples:
from iced_x86 import * # adc rsi,rcx # xor rdi,5Ah data = b"\x48\x11\xCE\x48\x83\xF7\x5A" decoder = Decoder(64, data) # adc rsi,rcx instr = decoder.decode() assert instr.rflags_read == RflagsBits.CF assert instr.rflags_written == RflagsBits.OF | RflagsBits.SF | RflagsBits.ZF | RflagsBits.AF | RflagsBits.CF | RflagsBits.PF assert instr.rflags_cleared == RflagsBits.NONE assert instr.rflags_set == RflagsBits.NONE assert instr.rflags_undefined == RflagsBits.NONE assert instr.rflags_modified == RflagsBits.OF | RflagsBits.SF | RflagsBits.ZF | RflagsBits.AF | RflagsBits.CF | RflagsBits.PF # xor rdi,5Ah instr = decoder.decode() assert instr.rflags_read == RflagsBits.NONE assert instr.rflags_written == RflagsBits.SF | RflagsBits.ZF | RflagsBits.PF assert instr.rflags_cleared == RflagsBits.OF | RflagsBits.CF assert instr.rflags_set == RflagsBits.NONE assert instr.rflags_undefined == RflagsBits.AF assert instr.rflags_modified == RflagsBits.OF | RflagsBits.SF | RflagsBits.ZF | RflagsBits.AF | RflagsBits.CF | RflagsBits.PF
- Type:
- rflags_read¶
All flags that are read by the CPU when executing the instruction.
This method returns an
RflagsBitsvalue. See alsoInstruction.rflags_modified.Examples:
from iced_x86 import * # adc rsi,rcx # xor rdi,5Ah data = b"\x48\x11\xCE\x48\x83\xF7\x5A" decoder = Decoder(64, data) # adc rsi,rcx instr = decoder.decode() assert instr.rflags_read == RflagsBits.CF assert instr.rflags_written == RflagsBits.OF | RflagsBits.SF | RflagsBits.ZF | RflagsBits.AF | RflagsBits.CF | RflagsBits.PF assert instr.rflags_cleared == RflagsBits.NONE assert instr.rflags_set == RflagsBits.NONE assert instr.rflags_undefined == RflagsBits.NONE assert instr.rflags_modified == RflagsBits.OF | RflagsBits.SF | RflagsBits.ZF | RflagsBits.AF | RflagsBits.CF | RflagsBits.PF # xor rdi,5Ah instr = decoder.decode() assert instr.rflags_read == RflagsBits.NONE assert instr.rflags_written == RflagsBits.SF | RflagsBits.ZF | RflagsBits.PF assert instr.rflags_cleared == RflagsBits.OF | RflagsBits.CF assert instr.rflags_set == RflagsBits.NONE assert instr.rflags_undefined == RflagsBits.AF assert instr.rflags_modified == RflagsBits.OF | RflagsBits.SF | RflagsBits.ZF | RflagsBits.AF | RflagsBits.CF | RflagsBits.PF
- Type:
- rflags_set¶
All flags that are always set by the CPU.
This method returns an
RflagsBitsvalue. See alsoInstruction.rflags_modified.Examples:
from iced_x86 import * # adc rsi,rcx # xor rdi,5Ah data = b"\x48\x11\xCE\x48\x83\xF7\x5A" decoder = Decoder(64, data) # adc rsi,rcx instr = decoder.decode() assert instr.rflags_read == RflagsBits.CF assert instr.rflags_written == RflagsBits.OF | RflagsBits.SF | RflagsBits.ZF | RflagsBits.AF | RflagsBits.CF | RflagsBits.PF assert instr.rflags_cleared == RflagsBits.NONE assert instr.rflags_set == RflagsBits.NONE assert instr.rflags_undefined == RflagsBits.NONE assert instr.rflags_modified == RflagsBits.OF | RflagsBits.SF | RflagsBits.ZF | RflagsBits.AF | RflagsBits.CF | RflagsBits.PF # xor rdi,5Ah instr = decoder.decode() assert instr.rflags_read == RflagsBits.NONE assert instr.rflags_written == RflagsBits.SF | RflagsBits.ZF | RflagsBits.PF assert instr.rflags_cleared == RflagsBits.OF | RflagsBits.CF assert instr.rflags_set == RflagsBits.NONE assert instr.rflags_undefined == RflagsBits.AF assert instr.rflags_modified == RflagsBits.OF | RflagsBits.SF | RflagsBits.ZF | RflagsBits.AF | RflagsBits.CF | RflagsBits.PF
- Type:
- rflags_undefined¶
All flags that are undefined after executing the instruction.
This method returns an
RflagsBitsvalue. See alsoInstruction.rflags_modified.Examples:
from iced_x86 import * # adc rsi,rcx # xor rdi,5Ah data = b"\x48\x11\xCE\x48\x83\xF7\x5A" decoder = Decoder(64, data) # adc rsi,rcx instr = decoder.decode() assert instr.rflags_read == RflagsBits.CF assert instr.rflags_written == RflagsBits.OF | RflagsBits.SF | RflagsBits.ZF | RflagsBits.AF | RflagsBits.CF | RflagsBits.PF assert instr.rflags_cleared == RflagsBits.NONE assert instr.rflags_set == RflagsBits.NONE assert instr.rflags_undefined == RflagsBits.NONE assert instr.rflags_modified == RflagsBits.OF | RflagsBits.SF | RflagsBits.ZF | RflagsBits.AF | RflagsBits.CF | RflagsBits.PF # xor rdi,5Ah instr = decoder.decode() assert instr.rflags_read == RflagsBits.NONE assert instr.rflags_written == RflagsBits.SF | RflagsBits.ZF | RflagsBits.PF assert instr.rflags_cleared == RflagsBits.OF | RflagsBits.CF assert instr.rflags_set == RflagsBits.NONE assert instr.rflags_undefined == RflagsBits.AF assert instr.rflags_modified == RflagsBits.OF | RflagsBits.SF | RflagsBits.ZF | RflagsBits.AF | RflagsBits.CF | RflagsBits.PF
- Type:
- rflags_written¶
All flags that are written by the CPU, except those flags that are known to be undefined, always set or always cleared.
This method returns an
RflagsBitsvalue. See alsoInstruction.rflags_modified.Examples:
from iced_x86 import * # adc rsi,rcx # xor rdi,5Ah data = b"\x48\x11\xCE\x48\x83\xF7\x5A" decoder = Decoder(64, data) # adc rsi,rcx instr = decoder.decode() assert instr.rflags_read == RflagsBits.CF assert instr.rflags_written == RflagsBits.OF | RflagsBits.SF | RflagsBits.ZF | RflagsBits.AF | RflagsBits.CF | RflagsBits.PF assert instr.rflags_cleared == RflagsBits.NONE assert instr.rflags_set == RflagsBits.NONE assert instr.rflags_undefined == RflagsBits.NONE assert instr.rflags_modified == RflagsBits.OF | RflagsBits.SF | RflagsBits.ZF | RflagsBits.AF | RflagsBits.CF | RflagsBits.PF # xor rdi,5Ah instr = decoder.decode() assert instr.rflags_read == RflagsBits.NONE assert instr.rflags_written == RflagsBits.SF | RflagsBits.ZF | RflagsBits.PF assert instr.rflags_cleared == RflagsBits.OF | RflagsBits.CF assert instr.rflags_set == RflagsBits.NONE assert instr.rflags_undefined == RflagsBits.AF assert instr.rflags_modified == RflagsBits.OF | RflagsBits.SF | RflagsBits.ZF | RflagsBits.AF | RflagsBits.CF | RflagsBits.PF
- Type:
- rounding_control¶
Gets the rounding control (a
RoundingControlenum value) orRoundingControl.NONEif the instruction doesn’t use it.Note
SAE is implied but
Instruction.suppress_all_exceptionsstill returnsFalse.- Type:
- segment_prefix¶
Gets the segment override prefix (a
Registerenum value) orRegister.NONEif none.See also
Instruction.memory_segment.Use this method if the operand has kind
OpKind.MEMORY,OpKind.MEMORY_SEG_SI,OpKind.MEMORY_SEG_ESI,OpKind.MEMORY_SEG_RSI- Type:
- set_declare_byte_value(index, new_value)¶
Sets a new
dbvalue, see alsoInstruction.declare_data_len.Can only be called if
Instruction.codeisCode.DECLAREBYTE- Parameters:
- Raises:
ValueError – If index is invalid
- set_declare_byte_value_i8(index, new_value)¶
Sets a new
dbvalue, see alsoInstruction.declare_data_len.Can only be called if
Instruction.codeisCode.DECLAREBYTE- Parameters:
- Raises:
ValueError – If index is invalid
- set_declare_dword_value(index, new_value)¶
Sets a new
ddvalue, see alsoInstruction.declare_data_len.Can only be called if
Instruction.codeisCode.DECLAREDWORD- Parameters:
- Raises:
ValueError – If index is invalid
- set_declare_dword_value_i32(index, new_value)¶
Sets a new
ddvalue, see alsoInstruction.declare_data_len.Can only be called if
Instruction.codeisCode.DECLAREDWORD- Parameters:
- Raises:
ValueError – If index is invalid
- set_declare_qword_value(index, new_value)¶
Sets a new
dqvalue, see alsoInstruction.declare_data_len.Can only be called if
Instruction.codeisCode.DECLAREQWORD- Parameters:
- Raises:
ValueError – If index is invalid
- set_declare_qword_value_i64(index, new_value)¶
Sets a new
dqvalue, see alsoInstruction.declare_data_len.Can only be called if
Instruction.codeisCode.DECLAREQWORD- Parameters:
- Raises:
ValueError – If index is invalid
- set_declare_word_value(index, new_value)¶
Sets a new
dwvalue, see alsoInstruction.declare_data_len.Can only be called if
Instruction.codeisCode.DECLAREWORD- Parameters:
- Raises:
ValueError – If index is invalid
- set_declare_word_value_i16(index, new_value)¶
Sets a new
dwvalue, see alsoInstruction.declare_data_len.Can only be called if
Instruction.codeisCode.DECLAREWORD- Parameters:
- Raises:
ValueError – If index is invalid
- set_immediate_i32(operand, new_value)¶
Sets an operand’s immediate value
- Parameters:
- Raises:
ValueError – If operand is invalid or if it’s not an immediate operand
- set_immediate_i64(operand, new_value)¶
Sets an operand’s immediate value
- Parameters:
- Raises:
ValueError – If operand is invalid or if it’s not an immediate operand
- set_immediate_u32(operand, new_value)¶
Sets an operand’s immediate value
- Parameters:
- Raises:
ValueError – If operand is invalid or if it’s not an immediate operand
- set_immediate_u64(operand, new_value)¶
Sets an operand’s immediate value
- Parameters:
- Raises:
ValueError – If operand is invalid or if it’s not an immediate operand
- set_op_kind(operand, op_kind)¶
Sets an operand’s kind
- Parameters:
- Raises:
ValueError – If operand is invalid
- set_op_register(operand, new_value)¶
Sets the operand’s register value.
Use this method if the operand has kind
OpKind.REGISTER- Parameters:
- Raises:
ValueError – If operand is invalid
- stack_pointer_increment¶
(
i32) Gets the number of bytes added toSP/ESP/RSPor 0 if it’s not an instruction that pushes or pops data.This method assumes the instruction doesn’t change the privilege level (eg.
IRET/D/Q). If it’s theLEAVEinstruction, this method returns 0.Examples:
from iced_x86 import * # pushfq data = b"\x9C" decoder = Decoder(64, data) instr = decoder.decode() assert instr.is_stack_instruction assert instr.stack_pointer_increment == -8
- Type:
- suppress_all_exceptions¶
Gets the suppress all exceptions flag (EVEX/MVEX encoded instructions). Note that if
Instruction.rounding_controlis notRoundingControl.NONE, SAE is implied but this method will still returnFalse.- Type: