From 739317f268b4ed1a8f3e06af6c6fdf977219d4f9 Mon Sep 17 00:00:00 2001 From: novafacing Date: Mon, 24 Jun 2024 13:00:04 -0700 Subject: Bump yaxpeax-arch and bitvec, allow use of deprecated yaxpeax-arch traits, fix bitvec syntax changes --- src/armv7.rs | 13 ++++++++++++- src/armv7/thumb.rs | 6 +++--- src/armv8/a64.rs | 5 ++++- 3 files changed, 19 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/armv7.rs b/src/armv7.rs index 99df077..e025267 100644 --- a/src/armv7.rs +++ b/src/armv7.rs @@ -7,7 +7,9 @@ use core::fmt::{self, Display, Formatter}; -use yaxpeax_arch::{Arch, AddressDiff, Colorize, Decoder, LengthedInstruction, Reader, ReadError, NoColors, ShowContextual, YaxColors}; +use yaxpeax_arch::{Arch, AddressDiff, Decoder, LengthedInstruction, Reader, ReadError}; +#[allow(deprecated)] +use yaxpeax_arch::{Colorize, NoColors, ShowContextual, YaxColors}; mod thumb; @@ -29,6 +31,7 @@ impl Display for ConditionedOpcode { /// displaying an instruction the same way its `Display` impl would. pub struct NoContext; +#[allow(deprecated)] fn reg_name_colorize(reg: Reg, colors: &Y) -> impl fmt::Display { match reg.number() { 0 => colors.register("r0"), @@ -52,6 +55,7 @@ fn reg_name_colorize(reg: Reg, colors: &Y) -> impl fmt::Display { } #[allow(non_snake_case)] +#[allow(deprecated)] impl ShowContextual for Instruction { fn contextualize(&self, colors: &Y, _address: u32, _context: Option<&NoContext>, out: &mut T) -> fmt::Result { match self.opcode { @@ -388,6 +392,7 @@ impl ShowContextual for Inst } } +#[allow(deprecated)] impl Colorize for ConditionedOpcode { fn colorize(&self, colors: &Y, out: &mut T) -> fmt::Result { match self.0 { @@ -1552,6 +1557,7 @@ impl Display for Bank { } } +#[allow(deprecated)] impl Colorize for Operand { fn colorize(&self, colors: &Y, f: &mut T) -> fmt::Result { match self { @@ -1768,6 +1774,7 @@ impl Instruction { pub fn thumb(&self) -> bool { self.thumb } } +#[allow(deprecated)] fn format_reg_list(f: &mut T, mut list: u16, colors: &Y) -> Result<(), fmt::Error> { write!(f, "{{")?; let mut i = 0; @@ -1789,6 +1796,7 @@ fn format_reg_list(f: &mut T, mut list: u16, colors } #[allow(non_snake_case)] +#[allow(deprecated)] fn format_shift(f: &mut T, shift: RegShift, colors: &Y) -> Result<(), fmt::Error> { match shift.into_shift() { RegShiftStyle::RegImm(imm_shift) => { @@ -1805,6 +1813,7 @@ fn format_shift(f: &mut T, shift: RegShift, colors: } #[allow(non_snake_case)] +#[allow(deprecated)] fn format_reg_shift_mem(f: &mut T, Rd: Reg, shift: RegShift, add: bool, pre: bool, wback: bool, colors: &Y) -> Result<(), fmt::Error> { let op = if add { "" } else { "-" }; @@ -1830,6 +1839,7 @@ fn format_reg_shift_mem(f: &mut T, Rd: Reg, shift: } #[allow(non_snake_case)] +#[allow(deprecated)] fn format_reg_imm_mem(f: &mut T, Rn: Reg, imm: u16, add: bool, pre: bool, wback: bool, colors: &Y) -> Result<(), fmt::Error> { if imm != 0 { let op = if add { "" } else { "-" }; @@ -1862,6 +1872,7 @@ fn format_reg_imm_mem(f: &mut T, Rn: Reg, imm: u16, impl Display for Instruction { fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> { + #[allow(deprecated)] self.contextualize(&NoColors, 0, Some(&NoContext), f) } } diff --git a/src/armv7/thumb.rs b/src/armv7/thumb.rs index 5f6abec..e18cb38 100644 --- a/src/armv7/thumb.rs +++ b/src/armv7/thumb.rs @@ -103,7 +103,7 @@ pub fn decode_into::Address, ::Word>>(d let word = u16::from_le_bytes(word_bytes); let instr = word; - let mut instr2 = bitarr![Lsb0, u16; 0u16; 16]; + let mut instr2 = bitarr![u16, Lsb0; 0u16; 16]; instr2[0..16].store(word); let opword = instr2[11..].load::(); @@ -120,7 +120,7 @@ pub fn decode_into::Address, ::Word>>(d words.next_n(&mut word_bytes)?; let lower = u16::from_le_bytes(word_bytes); - let mut lower2 = bitarr![Lsb0, u16; 0u16; 16]; + let mut lower2 = bitarr![u16, Lsb0; 0u16; 16]; lower2[0..16].store(lower); let op2 = &instr2[4..11]; @@ -4228,7 +4228,7 @@ pub fn decode_into::Address, ::Word>>(d Ok(()) } -fn decode_table_a6_30(decoder: &InstDecoder, inst: &mut Instruction, instr2: BitArray, lower2: BitArray) -> Result<(), DecodeError> { +fn decode_table_a6_30(decoder: &InstDecoder, inst: &mut Instruction, instr2: BitArray<[u16; 1], Lsb0>, lower2: BitArray<[u16; 1], Lsb0>) -> Result<(), DecodeError> { // implementation of table `A6-30 Coprocessor, Advanced SIMD, and Floating-point instructions` let op1 = instr2[4..10].load::(); if op1 & 0b11_1110 == 0b00_0000 { diff --git a/src/armv8/a64.rs b/src/armv8/a64.rs index 87ded05..f60b87a 100644 --- a/src/armv8/a64.rs +++ b/src/armv8/a64.rs @@ -7,7 +7,9 @@ use core::fmt::{self, Display, Formatter}; -use yaxpeax_arch::{Arch, AddressDiff, Decoder, LengthedInstruction, Reader, ReadError, ShowContextual, YaxColors}; +use yaxpeax_arch::{Arch, AddressDiff, Decoder, LengthedInstruction, Reader, ReadError}; +#[allow(deprecated)] +use yaxpeax_arch::{ShowContextual, YaxColors}; #[allow(non_snake_case)] mod docs { @@ -225,6 +227,7 @@ impl yaxpeax_arch::Instruction for Instruction { /// displaying an instruction the same way its `Display` impl would. pub struct NoContext; +#[allow(deprecated)] impl ShowContextual for Instruction { fn contextualize(&self, _colors: &Y, _address: u64, _context: Option<&NoContext>, out: &mut T) -> fmt::Result { write!(out, "{}", self) -- cgit v1.1