pub struct X86InstructionWriter { /* private fields */ }
Expand description

The x86/x86_64 instruction writer.

Implementations§

source§

impl X86InstructionWriter

source

pub fn put_leave(&self) -> bool

source

pub fn put_ret(&self) -> bool

source

pub fn put_ret_imm(&self, imm: u16) -> bool

source

pub fn put_jmp_address(&self, address: u64) -> bool

source

pub fn put_jmp_short_label(&self, id: u64) -> bool

source

pub fn put_jmp_near_label(&self, id: u64) -> bool

Insert a jmp near to a label. The label is specified by id.

source

pub fn put_jmp_reg(&self, reg: X86Register) -> bool

source

pub fn put_jmp_reg_ptr(&self, reg: X86Register) -> bool

source

pub fn put_jmp_reg_offset_ptr(&self, reg: X86Register, offset: isize) -> bool

source

pub fn put_jmp_near_ptr(&self, address: u64) -> bool

source

pub fn put_jcc_short_label( &self, condition: X86BranchCondition, label_id: u64, hint: GumBranchHint )

source

pub fn put_jcc_near_label( &self, condition: X86BranchCondition, label_id: u64, hint: GumBranchHint )

source

pub fn put_mov_reg_gs_u32_ptr(&self, reg: X86Register, imm: u32) -> bool

source

pub fn put_add_reg_imm(&self, reg: X86Register, imm: isize) -> bool

source

pub fn put_add_reg_reg( &self, dst_reg: X86Register, src_reg: X86Register ) -> bool

source

pub fn put_add_reg_near_ptr(&self, dst_reg: X86Register, address: u64) -> bool

source

pub fn put_sub_reg_imm(&self, dst_reg: X86Register, imm: isize) -> bool

source

pub fn put_sub_reg_reg( &self, dst_reg: X86Register, src_reg: X86Register ) -> bool

source

pub fn put_sub_reg_near_ptr(&self, dst_reg: X86Register, address: u64) -> bool

source

pub fn put_inc_reg(&self, reg: X86Register) -> bool

source

pub fn put_dec_reg(&self, reg: X86Register) -> bool

source

pub fn put_and_reg_reg( &self, dst_reg: X86Register, src_reg: X86Register ) -> bool

source

pub fn put_and_reg_u32(&self, reg: X86Register, imm: u32) -> bool

source

pub fn put_shl_reg_u8(&self, dst_reg: X86Register, imm: u8) -> bool

source

pub fn put_shr_reg_u8(&self, dst_reg: X86Register, imm: u8) -> bool

source

pub fn put_xor_reg_reg( &self, dst_reg: X86Register, src_reg: X86Register ) -> bool

source

pub fn put_mov_reg_reg( &self, dst_reg: X86Register, src_reg: X86Register ) -> bool

source

pub fn put_mov_reg_u32(&self, dst_reg: X86Register, imm: u32) -> bool

source

pub fn put_mov_reg_u64(&self, dst_reg: X86Register, imm: u64) -> bool

source

pub fn put_mov_reg_address(&self, dst_reg: X86Register, address: u64) -> bool

source

pub fn put_mov_reg_ptr_u32(&self, dst_reg: X86Register, imm: u32) -> bool

source

pub fn put_mov_reg_offset_ptr_u32( &self, dst_reg: X86Register, offset: isize, imm: u32 ) -> bool

source

pub fn put_mov_reg_ptr_reg( &self, dst_reg: X86Register, src_reg: X86Register ) -> bool

source

pub fn put_mov_reg_offset_ptr_reg( &self, dst_reg: X86Register, offset: isize, src_reg: X86Register ) -> bool

source

pub fn put_mov_reg_reg_ptr( &self, dst_reg: X86Register, src_reg: X86Register ) -> bool

source

pub fn put_mov_reg_reg_offset_ptr( &self, dst_reg: X86Register, src_reg: X86Register, offset: isize ) -> bool

source

pub fn put_mov_reg_base_index_scale_offset_ptr( &self, dst_reg: X86Register, base_reg: X86Register, index_reg: X86Register, scale: u8, offset: isize ) -> bool

source

pub fn put_lea_reg_reg_offset( &self, dst_reg: X86Register, src_reg: X86Register, src_offset: isize ) -> bool

Insert a lea d, [s + o] instruction.

source

pub fn put_push_u32(&self, imm: u32) -> bool

source

pub fn put_push_near_ptr(&self, address: u64) -> bool

source

pub fn put_push_reg(&self, reg: X86Register) -> bool

Insert a push R instruction.

source

pub fn put_pop_reg(&self, reg: X86Register) -> bool

Insert a pop R instruction.

source

pub fn put_call_address(&self, address: u64) -> bool

Insert a call address instruction.

source

pub fn put_call_address_with_arguments( &self, address: u64, arguments: &[Argument] ) -> bool

source

pub fn put_call_address_with_aligned_arguments( &self, address: u64, arguments: &[Argument] ) -> bool

source

pub fn put_test_reg_reg(&self, reg_a: X86Register, reg_b: X86Register) -> bool

source

pub fn put_nop(&self) -> bool

source

pub fn put_pushfx(&self) -> bool

source

pub fn put_popfx(&self) -> bool

source

pub fn put_pushax(&self) -> bool

source

pub fn put_popax(&self) -> bool

Trait Implementations§

source§

impl Drop for X86InstructionWriter

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl InstructionWriter for X86InstructionWriter

source§

fn new(code_address: u64) -> Self

Create a new InstructionWriter to write code to the given address
source§

fn code_offset(&self) -> u64

Retrieve the writer’s current code offset.
source§

fn pc(&self) -> u64

Retrieve the writer’s current program counter.
source§

fn can_branch_directly_between(&self, source: u64, target: u64) -> bool

Check if we can branch directly between the given source and target addresses.
source§

fn put_bytes(&self, bytes: &[u8]) -> bool

Add the bytes specified to the instruction stream.
source§

fn put_label(&self, id: u64) -> bool

Add a label at the curent point in the instruction stream.
source§

fn reset(&self, code_address: u64)

Reset the writer to the given code address
source§

fn put_branch_address(&self, address: u64) -> bool

Add a branch to an immediate address
source§

fn flush(&self) -> bool

Flush the writer, outputing any pending ldr-immediates
source§

fn can_branch_directly_to(&self, target: u64) -> bool

Check if we can branch directly to the target address from the current program counter.

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