From 9efb3703630662bb0fee9f5224ac4c91c32741d1 Mon Sep 17 00:00:00 2001 From: iximeow Date: Thu, 6 May 2021 21:28:07 -0700 Subject: forward display style choices to ffi interface --- ffi/multiarch/src/long_mode.rs | 12 ++++++++++-- 1 file 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(); } } -- cgit v1.1