Struct lde::X64
[−]
[src]
pub struct X64;
Length disassembler for the x86_64
instruction set architecture.
Methods
impl X64
[src]
pub fn ld(self, bytes: &[u8]) -> u32
[src]
Returns the length of the first opcode in the given byte slice.
When length disassembling fails, eg. the byte slice does not contain a complete and valid instruction, the return value is 0
.
Examples
let code = b"\x40\x55\x48\x83\xEC*\x00\x80"; assert_eq!(lde::X64.ld(code), 2);
let invalid = b""; assert_eq!(lde::X64.ld(invalid), 0);
pub fn peek(self, bytes: &[u8]) -> Option<&OpCode>
[src]
Returns the first opcode in the byte slice if successful.
Examples
let code = b"\x40\x55\x48\x83\xEC*\x00\x80"; assert_eq!(lde::X64.peek(code), Some(b"\x40\x55".into()));
pub fn peek_mut(self, bytes: &mut [u8]) -> Option<&mut OpCode>
[src]
Returns the first opcode mutably in the byte slice if successful.
ⓘImportant traits for Iter<'a, X>pub fn iter<'a>(self, bytes: &'a [u8], va: u64) -> Iter<'a, X64>
[src]
Returns an iterator over the opcodes contained in the byte slice.
Given a virtual address to keep track of the instruction pointer.
Examples
let code = b"\x40\x55\x48\x83\xEC*\x00\x80"; for (opcode, va) in lde::X64.iter(code, 0x1000) { println!("{:x}: {}", va, opcode); }
Prints the following result
1000: 4055
1002: 4883EC2A
ⓘImportant traits for IterMut<'a, X>pub fn iter_mut<'a>(self, bytes: &'a mut [u8], va: u64) -> IterMut<'a, X64>
[src]
Returns an iterator over the opcodes contained in the byte slice.
Given a virtual address to keep track of the instruction pointer.
Examples
let mut code = *b"\x40\x55\x48\x83\xEC*\x00\x80"; for (opcode, va) in lde::X64.iter_mut(&mut code, 0x1000) { opcode.write(0, 0xff_u8); } assert_eq!(&code, b"\xff\x55\xff\x83\xEC*\x00\x80");
Trait Implementations
impl Isa for X64
[src]
type Va = u64
Virtual address type.
fn ld(bytes: &[u8]) -> u32
[src]
Returns the length of the first opcode in the given byte slice. Read more
fn peek(bytes: &[u8]) -> Option<&OpCode>
[src]
Returns the first opcode in the byte slice if successful.
fn peek_mut(bytes: &mut [u8]) -> Option<&mut OpCode>
[src]
Returns the first opcode mutably in the byte slice if successful.
ⓘImportant traits for Iter<'a, X>fn iter<'a>(bytes: &'a [u8], va: Self::Va) -> Iter<'a, Self>
[src]
Returns an iterator over the opcodes contained in the byte slice. Read more
ⓘImportant traits for IterMut<'a, X>fn iter_mut<'a>(bytes: &'a mut [u8], va: Self::Va) -> IterMut<'a, Self>
[src]
Returns an iterator over the opcodes contained in the byte slice. Read more