From e4eff1a3edec523a5ac0c2716573f9ad1ca432ad Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 10 Mar 2019 17:25:12 -0700 Subject: update a bunch of arm stuff --- src/armv7.rs | 14 +++++++------- src/lib.rs | 45 +-------------------------------------------- 2 files changed, 8 insertions(+), 51 deletions(-) diff --git a/src/armv7.rs b/src/armv7.rs index d65c8ae..222c8a6 100644 --- a/src/armv7.rs +++ b/src/armv7.rs @@ -552,21 +552,21 @@ impl ConditionCode { } impl Decodable for Instruction { - fn decode<'a, T: IntoIterator>(bytes: T) -> Option { + fn decode>(bytes: T) -> Option { let mut blank = Instruction::blank(); match blank.decode_into(bytes) { Some(_) => Some(blank), None => None } } - fn decode_into<'a, T: IntoIterator>(&mut self, bytes: T) -> Option<()> { - fn read_word<'a, T: IntoIterator>(bytes: T) -> Option { + fn decode_into>(&mut self, bytes: T) -> Option<()> { + fn read_word>(bytes: T) -> Option { let mut iter = bytes.into_iter(); let instr: u32 = - ((*iter.next()? as u32) ) | - ((*iter.next()? as u32) << 8 ) | - ((*iter.next()? as u32) << 16) | - ((*iter.next()? as u32) << 24); + ((iter.next()? as u32) ) | + ((iter.next()? as u32) << 8 ) | + ((iter.next()? as u32) << 16) | + ((iter.next()? as u32) << 24); Some(instr) } diff --git a/src/lib.rs b/src/lib.rs index 1ef6f13..88c01b0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,46 +1,3 @@ extern crate yaxpeax_arch; -use yaxpeax_arch::{Arch, Decodable, LengthedInstruction}; - -#[derive(Debug)] -pub enum Opcode { - NOP -} - -#[derive(Debug)] -pub struct Instruction { - pub opcode: Opcode -} - -impl LengthedInstruction for Instruction { - type Unit = ::Address; - fn len(&self) -> Self::Unit { - 3 // ish - } -} - -impl Decodable for Instruction { - fn decode<'a, T: IntoIterator>(bytes: T) -> Option { - let mut blank = Instruction { opcode: Opcode::NOP }; - match blank.decode_into(bytes) { - Some(_) => Some(blank), - None => None - } - } - fn decode_into<'a, T: IntoIterator>(&mut self, bytes: T) -> Option<()> { - match bytes.into_iter().next() { - Some(0x00) => { - self.opcode = Opcode::NOP; - Some(()) - }, - _ => None - } - } -} - -pub struct PIC24; -impl Arch for PIC24 { - type Address = u32; - type Instruction = Instruction; - type Operand = (); -} +pub mod armv7; -- cgit v1.1