From a07098315bea8b880688831f931bc5213ebb6a5f Mon Sep 17 00:00:00 2001 From: iximeow Date: Fri, 13 Aug 2021 23:44:28 -0700 Subject: extend annotation reporting to 32- and 16-bit modes, kinda --- src/long_mode/mod.rs | 9 ++++++--- src/long_mode/vex.rs | 12 ++++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'src/long_mode') diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs index 25a1735..54d83e8 100644 --- a/src/long_mode/mod.rs +++ b/src/long_mode/mod.rs @@ -7462,6 +7462,9 @@ impl yaxpeax_arch::FieldDescription for FieldDescription { fn id(&self) -> u32 { self.id } + fn is_separator(&self) -> bool { + false + } } impl fmt::Display for FieldDescription { @@ -7547,7 +7550,7 @@ fn read_with_annotations< return Err(DecodeError::InvalidPrefixes); } else { instruction.prefixes = prefixes; - vex::two_byte_vex(words, instruction)?; + vex::two_byte_vex(words, instruction, sink)?; return Ok(()); } } else if b == 0xc4 { @@ -7556,7 +7559,7 @@ fn read_with_annotations< return Err(DecodeError::InvalidPrefixes); } else { instruction.prefixes = prefixes; - vex::three_byte_vex(words, instruction)?; + vex::three_byte_vex(words, instruction, sink)?; return Ok(()); } } else if b == 0x62 { @@ -7565,7 +7568,7 @@ fn read_with_annotations< return Err(DecodeError::InvalidPrefixes); } else { instruction.prefixes = prefixes; - evex::read_evex(words, instruction, None)?; + evex::read_evex(words, instruction, None, sink)?; return Ok(()); } } diff --git a/src/long_mode/vex.rs b/src/long_mode/vex.rs index 9649e72..893d624 100644 --- a/src/long_mode/vex.rs +++ b/src/long_mode/vex.rs @@ -1,8 +1,10 @@ use yaxpeax_arch::Reader; +use yaxpeax_arch::DescriptionSink; use crate::long_mode::Arch; use crate::long_mode::OperandSpec; use crate::long_mode::DecodeError; +use crate::long_mode::FieldDescription; use crate::long_mode::RegSpec; use crate::long_mode::RegisterBank; use crate::long_mode::Instruction; @@ -100,7 +102,10 @@ enum VEXOperandCode { } #[inline(never)] -pub(crate) fn three_byte_vex::Address, ::Word>>(words: &mut T, instruction: &mut Instruction) -> Result<(), DecodeError> { +pub(crate) fn three_byte_vex< + T: Reader<::Address, ::Word>, + S: DescriptionSink, +>(words: &mut T, instruction: &mut Instruction, sink: &mut S) -> Result<(), DecodeError> { let vex_byte_one = words.next().ok().ok_or(DecodeError::ExhaustedInput)?; let vex_byte_two = words.next().ok().ok_or(DecodeError::ExhaustedInput)?; let p = vex_byte_two & 0x03; @@ -130,7 +135,10 @@ pub(crate) fn three_byte_vex::Address, ::Address, ::Word>>(words: &mut T, instruction: &mut Instruction) -> Result<(), DecodeError> { +pub(crate) fn two_byte_vex< + T: Reader<::Address, ::Word>, + S: DescriptionSink, +>(words: &mut T, instruction: &mut Instruction, sink: &mut S) -> Result<(), DecodeError> { let vex_byte = words.next().ok().ok_or(DecodeError::ExhaustedInput)?; let p = vex_byte & 0x03; let p = match p { -- cgit v1.1