aboutsummaryrefslogtreecommitdiff
path: root/ffi/multiarch/src
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2021-05-06 21:28:07 -0700
committeriximeow <me@iximeow.net>2021-05-06 21:28:07 -0700
commit9efb3703630662bb0fee9f5224ac4c91c32741d1 (patch)
tree2d5bedbf185b1141300f7bb4001f0a0010f81155 /ffi/multiarch/src
parent0757dfde76bbfe85bd3f54bb4fc8de7f511c137a (diff)
forward display style choices to ffi interface
Diffstat (limited to 'ffi/multiarch/src')
-rw-r--r--ffi/multiarch/src/long_mode.rs12
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();
}
}