diff options
author | iximeow <me@iximeow.net> | 2021-07-03 17:19:08 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2021-07-03 17:19:08 -0700 |
commit | e3a33439715133cdabe70b7932bb093dc1e63b23 (patch) | |
tree | 789eeaebf3fb110162a83b91638b6f723202394a /ffi/src/long_mode.rs | |
parent | c54167a26ab3fd7e582eb93896b7c4c8d3a4792e (diff) |
fix yaxpeax_arch use in ffi packaging
Diffstat (limited to 'ffi/src/long_mode.rs')
-rw-r--r-- | ffi/src/long_mode.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ffi/src/long_mode.rs b/ffi/src/long_mode.rs index a3fd784..d0d3f22 100644 --- a/ffi/src/long_mode.rs +++ b/ffi/src/long_mode.rs @@ -1,10 +1,11 @@ -use yaxpeax_arch::{Arch, Decoder, LengthedInstruction, AddressBase}; +use yaxpeax_arch::{Arch, Decoder, LengthedInstruction, U8Reader, AddressBase}; use yaxpeax_x86::long_mode; #[no_mangle] -pub unsafe extern "C" fn yaxpeax_x86_64_decode_optimistic(data: *const u8, length: u64, inst: *mut long_mode::Instruction) -> bool { +pub unsafe extern "C" fn yaxpeax_x86_64_decode(data: *const u8, length: u64, inst: *mut long_mode::Instruction) -> bool { let inst: &mut long_mode::Instruction = core::mem::transmute(inst); - <long_mode::Arch as Arch>::Decoder::default().decode_into(inst, core::slice::from_raw_parts(data as *const u8, length as usize).iter().cloned()).is_err() + let mut reader = U8Reader::new(core::slice::from_raw_parts(data as *const u8, length as usize)); + <long_mode::Arch as Arch>::Decoder::default().decode_into(inst, &mut reader).is_err() } #[no_mangle] |