From 32ee819325120425e75e801ae555b5be5591eb5e Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 2 Jan 2022 19:41:18 -0800 Subject: add mode to disassemble armv7-thumb instructions --- Cargo.lock | 8 ++++---- Cargo.toml | 4 ++-- src/main.rs | 10 ++++++++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8b7f6c0..3522baf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -446,9 +446,9 @@ dependencies = [ [[package]] name = "yaxpeax-arm" -version = "0.1.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfde0eac22b9044b4d1f07b9fba1e81114ddb529912035a56b64c5524d411966" +checksum = "2dd4915314c4ff9cb079acd1ad25245f54b2e651238da929fb79971443ea7834" dependencies = [ "bitvec", "serde", @@ -566,9 +566,9 @@ dependencies = [ [[package]] name = "yaxpeax-x86" -version = "1.0.4" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf1fb167a86a30c9592ade2140efe3b396a42a4a429d4b98521b2e2b0ad6fcd" +checksum = "725dc639f981b8e4c222e96d64f577e2ccb46e908c807418d29b66578f6b34ba" dependencies = [ "num-traits", "serde", diff --git a/Cargo.toml b/Cargo.toml index eea9e76..ee63e0f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ num-traits = "0.2.10" # common interfaces for all yaxpeax decoders yaxpeax-arch-02 = { package = "yaxpeax-arch", version = "0.2.4" } -yaxpeax-arm = { version = "0.1.1" } +yaxpeax-arm = { version = "0.2.3" } yaxpeax-avr = { version = "0.1.0" } yaxpeax-m16c = { version = "0.1.0" } yaxpeax-mips = { version = "0.1.0" } @@ -29,7 +29,7 @@ yaxpeax-msp430 = { version = "0.1.0" } yaxpeax-lc87 = { version = "1.0.0" } yaxpeax-pic17 = { version = "0.1.0" } yaxpeax-pic18 = { version = "0.1.0" } -yaxpeax-x86 = { version = "1.0.4" } +yaxpeax-x86 = { version = "1.1.3" } yaxpeax-ia64 = { version = "0.2.1" } yaxpeax-superh = { version = "0.3.0" } yaxpeax-6502 = { version = "0.0.2", features = ["std"] } diff --git a/src/main.rs b/src/main.rs index 02e0974..8597aca 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,7 +15,7 @@ fn main() { .validator(|a| { if ["x86_64", "x86_32", "x86_16", "x86:64", "x86:32", "x86:16", - "ia64", "armv7", "armv8", "avr", "mips", "msp430", + "ia64", "armv7", "armv7-t","armv8", "avr", "mips", "msp430", "pic17", "pic18", "m16c", "6502", "lc87"].contains(&&a[..]) || (["sh", "sh2", "sh3", "sh4", "j2"].contains( &&a[0..a.find(|c| c == '+' || c == '-').unwrap_or(a.len())]) && @@ -24,7 +24,7 @@ fn main() { Ok(()) } else { Err("possible values: x86_64, x86_32, x86_16, x86:64, x86:32, x86:16, \ - ia64, armv7, armv8, avr, mips, msp430, pic17, pic18, \ + ia64, armv7, armv7-t, armv8, avr, mips, msp430, pic17, pic18, \ m16c, 6502, lc87, {sh{,2,3,4},j2}[[+-]{be,mmu,fpu,f64,j2}]*" .to_string()) } @@ -93,6 +93,7 @@ fn main() { "ia64" => arch_02::decode_input::(&buf, &printer), "avr" => arch_02::decode_input::(&buf, &printer), "armv7" => arch_02::decode_input::(&buf, &printer), + "armv7-t" => arch_02::decode_armv7_thumb(&buf, &printer), "armv8" => arch_02::decode_input::(&buf, &printer), "mips" => arch_02::decode_input::(&buf, &printer), "msp430" => arch_02::decode_input::(&buf, &printer), @@ -207,6 +208,11 @@ mod arch_02 { decode_input_with_decoder::(A::Decoder::default(), buf, printer); } + pub(crate) fn decode_armv7_thumb(buf: &[u8], printer: &Printer) { + let decoder = yaxpeax_arm::armv7::InstDecoder::default_thumb(); + decode_input_with_decoder::(decoder, buf, printer); + } + pub(crate) fn decode_input_with_decoder( decoder: A::Decoder, buf: &[u8], -- cgit v1.1