diff options
author | iximeow <me@iximeow.net> | 2021-05-06 21:28:07 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2021-05-06 21:28:07 -0700 |
commit | 9efb3703630662bb0fee9f5224ac4c91c32741d1 (patch) | |
tree | 2d5bedbf185b1141300f7bb4001f0a0010f81155 /ffi/multiarch/src/long_mode.rs | |
parent | 0757dfde76bbfe85bd3f54bb4fc8de7f511c137a (diff) |
forward display style choices to ffi interface
Diffstat (limited to 'ffi/multiarch/src/long_mode.rs')
-rw-r--r-- | ffi/multiarch/src/long_mode.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/ffi/multiarch/src/long_mode.rs b/ffi/multiarch/src/long_mode.rs index c0d422b..7d4367b 100644 --- a/ffi/multiarch/src/long_mode.rs +++ b/ffi/multiarch/src/long_mode.rs @@ -34,10 +34,18 @@ mod fmt { use core::fmt::Write; #[no_mangle] - pub unsafe extern "C" fn yaxpeax_instr_fmt(inst: *mut amd64::Instruction, text: *mut u8, len: usize) { + pub unsafe extern "C" fn yaxpeax_x86_64_instr_fmt_intel(inst: *mut amd64::Instruction, text: *mut u8, len: usize) { let inst: &mut amd64::Instruction = core::mem::transmute(inst); let res = core::slice::from_raw_parts_mut(text, len); - write!(InstructionSink { buf: res, offs: 0 }, "{}", inst).unwrap(); + write!(InstructionSink { buf: res, offs: 0 }, "{}", inst.display_with(DisplayStyle::Intel)).unwrap(); + } + + #[no_mangle] + pub unsafe extern "C" fn yaxpeax_x86_64_instr_fmt_c(inst: *mut amd64::Instruction, text: *mut u8, len: usize) { + let inst: &mut amd64::Instruction = core::mem::transmute(inst); + let res = core::slice::from_raw_parts_mut(text, len); + + write!(InstructionSink { buf: res, offs: 0 }, "{}", inst.display_with(DisplayStyle::C)).unwrap(); } } |