diff options
author | iximeow <me@iximeow.net> | 2021-07-21 00:14:09 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2021-07-21 00:14:09 -0700 |
commit | 3552a2d8df03f9214a351ad7901281c76ef503bf (patch) | |
tree | a765274d87e47fbbe146d921f97f0fd43862fb0c /src/armv8/a64.rs | |
parent | 61513023aff4d3312287bb0fb55ea931997dfddb (diff) |
fix DecodeError impl on builds using yaxpeax-arch+std0.1.1
Diffstat (limited to 'src/armv8/a64.rs')
-rw-r--r-- | src/armv8/a64.rs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/armv8/a64.rs b/src/armv8/a64.rs index 2ef75d8..16ed9c5 100644 --- a/src/armv8/a64.rs +++ b/src/armv8/a64.rs @@ -1,7 +1,7 @@ //#[cfg(feature="use-serde")] //use serde::{Serialize, Deserialize}; -use std::fmt::{self, Display, Formatter}; +use core::fmt::{self, Display, Formatter}; use yaxpeax_arch::{Arch, AddressDiff, Decoder, LengthedInstruction, Reader, ReadError, ShowContextual, YaxColors}; @@ -140,6 +140,15 @@ impl fmt::Display for DecodeError { } } +#[cfg(feature = "std")] +extern crate std; +#[cfg(feature = "std")] +impl std::error::Error for DecodeError { + fn description(&self) -> &str { + <Self as yaxpeax_arch::DecodeError>::description(self) + } +} + impl From<ReadError> for DecodeError { fn from(_e: ReadError) -> DecodeError { DecodeError::ExhaustedInput @@ -1075,7 +1084,7 @@ impl Decoder<ARMv8> for InstDecoder { Section::DataProcessingSimd2, // 1111 ][(section_bits & 0x0f) as usize]; - println!("word: {:#x}, bits: {:#b}", word, section_bits & 0xf); + // println!("word: {:#x}, bits: {:#b}", word, section_bits & 0xf); match section { Section::DataProcessingSimd | @@ -1741,7 +1750,7 @@ impl Decoder<ARMv8> for InstDecoder { let group_byte = word >> 23; let group_bits = (group_byte & 0x03) | ((group_byte >> 1) & 0x04) | ((group_byte >> 2) & 0x18); - println!("Group byte: {:#b}, bits: {:#b}", group_byte, group_bits); + // println!("Group byte: {:#b}, bits: {:#b}", group_byte, group_bits); match group_bits { 0b00000 => { let Rt = (word & 0x1f) as u16; @@ -2178,7 +2187,7 @@ impl Decoder<ARMv8> for InstDecoder { let Rn = ((word >> 5) & 0x1f) as u16; let size_opc = ((word >> 22) & 0x03) | ((word >> 28) & 0x0c); let category = (word >> 10) & 0x03; - println!("load/store: size_opc: {:#b}, category: {:#b}", size_opc, category); + // println!("load/store: size_opc: {:#b}, category: {:#b}", size_opc, category); if word & 0x200000 != 0 { if category != 0b10 { inst.opcode = Opcode::Invalid; |