aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2022-01-02 19:41:18 -0800
committeriximeow <me@iximeow.net>2022-01-02 19:41:18 -0800
commit32ee819325120425e75e801ae555b5be5591eb5e (patch)
tree668265c0efd41c64294559289aa9189d71b7d430
parent60957e6b7c059c26b42ee8f56180e417040dd3e4 (diff)
add mode to disassemble armv7-thumb instructions
-rw-r--r--Cargo.lock8
-rw-r--r--Cargo.toml4
-rw-r--r--src/main.rs10
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::<yaxpeax_ia64::IA64>(&buf, &printer),
"avr" => arch_02::decode_input::<yaxpeax_avr::AVR>(&buf, &printer),
"armv7" => arch_02::decode_input::<yaxpeax_arm::armv7::ARMv7>(&buf, &printer),
+ "armv7-t" => arch_02::decode_armv7_thumb(&buf, &printer),
"armv8" => arch_02::decode_input::<yaxpeax_arm::armv8::a64::ARMv8>(&buf, &printer),
"mips" => arch_02::decode_input::<yaxpeax_mips::MIPS>(&buf, &printer),
"msp430" => arch_02::decode_input::<yaxpeax_msp430::MSP430>(&buf, &printer),
@@ -207,6 +208,11 @@ mod arch_02 {
decode_input_with_decoder::<A>(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::<yaxpeax_arm::armv7::ARMv7>(decoder, buf, printer);
+ }
+
pub(crate) fn decode_input_with_decoder<A: Arch>(
decoder: A::Decoder,
buf: &[u8],