aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2022-01-02 15:47:24 -0800
committeriximeow <me@iximeow.net>2022-01-02 15:47:24 -0800
commit6a018dc137ee149a65c1773c0bc6ab4e9732f7c4 (patch)
tree03978152b6b67f4d0b19d0a27c0d954bc763e35d
parentd2ec91d2fa0b20fa7cb935ea279a90367f6dcc1e (diff)
add thumb-mode decoder, update disassemblers
-rw-r--r--Cargo.lock34
-rw-r--r--Cargo.toml4
-rw-r--r--src/main.rs13
3 files changed, 30 insertions, 21 deletions
diff --git a/Cargo.lock b/Cargo.lock
index c61f09e..01258a3 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -304,7 +304,7 @@ dependencies = [
[[package]]
name = "yaxpeax-arch"
-version = "0.2.6"
+version = "0.2.7"
dependencies = [
"num-traits",
"serde",
@@ -313,12 +313,12 @@ 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",
- "yaxpeax-arch 0.2.6",
+ "yaxpeax-arch 0.2.7",
]
[[package]]
@@ -327,7 +327,7 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94153e4e363dd4b0bea761ce9615647f2a29a9c3d46d3467c776969eb2b4e91c"
dependencies = [
- "yaxpeax-arch 0.2.6",
+ "yaxpeax-arch 0.2.7",
]
[[package]]
@@ -340,7 +340,7 @@ dependencies = [
"num-traits",
"yaxpeax-6502",
"yaxpeax-arch 0.0.5",
- "yaxpeax-arch 0.2.6",
+ "yaxpeax-arch 0.2.7",
"yaxpeax-arm",
"yaxpeax-avr",
"yaxpeax-ia64",
@@ -359,7 +359,7 @@ name = "yaxpeax-ia64"
version = "0.2.1"
dependencies = [
"bitvec",
- "yaxpeax-arch 0.2.6",
+ "yaxpeax-arch 0.2.7",
]
[[package]]
@@ -368,7 +368,7 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cf556f365c2fa2104e4e9a36105d9a2f72085dfd7168c95abf4f0d7cdac0cff"
dependencies = [
- "yaxpeax-arch 0.2.6",
+ "yaxpeax-arch 0.2.7",
]
[[package]]
@@ -380,7 +380,7 @@ dependencies = [
"num-traits",
"serde",
"serde_derive",
- "yaxpeax-arch 0.2.6",
+ "yaxpeax-arch 0.2.7",
]
[[package]]
@@ -390,14 +390,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d83d243a75ff9312b78ef761596cf0bf3b625786176363d65e653a75042873a"
dependencies = [
"num_enum",
- "yaxpeax-arch 0.2.6",
+ "yaxpeax-arch 0.2.7",
]
[[package]]
name = "yaxpeax-msp430"
-version = "0.1.0"
+version = "0.1.1"
dependencies = [
- "yaxpeax-arch 0.2.6",
+ "yaxpeax-arch 0.2.7",
]
[[package]]
@@ -406,7 +406,7 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15ca63b323712143e563e146af6a3df21fa3c75976985ee7b157470616c15c1e"
dependencies = [
- "yaxpeax-arch 0.2.6",
+ "yaxpeax-arch 0.2.7",
]
[[package]]
@@ -415,7 +415,7 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f64bb0d36fc65721e5919e9febe316ae62cf0ba2510cddb01d1f182ddcc97f84"
dependencies = [
- "yaxpeax-arch 0.2.6",
+ "yaxpeax-arch 0.2.7",
]
[[package]]
@@ -429,8 +429,10 @@ dependencies = [
[[package]]
name = "yaxpeax-x86"
-version = "1.1.0"
+version = "1.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "725dc639f981b8e4c222e96d64f577e2ccb46e908c807418d29b66578f6b34ba"
dependencies = [
"num-traits",
- "yaxpeax-arch 0.2.6",
+ "yaxpeax-arch 0.2.7",
]
diff --git a/Cargo.toml b/Cargo.toml
index ab69d41..564ce9f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -26,7 +26,7 @@ itertools = "0.10.1"
yaxpeax-arch-02 = { package = "yaxpeax-arch", version = "0.2.4" , default-features = false, features = ["std"] }
yaxpeax-arch-01 = { package = "yaxpeax-arch", version = "0.0.5" , default-features = false }
-yaxpeax-arm = { version = "0.1.1", default-features = false, features = ["std"] }
+yaxpeax-arm = { version = "0.2.3", default-features = false, features = ["std"] }
yaxpeax-avr = { version = "0.1.0" }
yaxpeax-m16c = { version = "0.1.0" }
yaxpeax-mips = { version = "0.1.0" }
@@ -34,7 +34,7 @@ yaxpeax-msp430 = { version = "0.1.0", path = "/toy/yaxpeax/arch/msp430" }
yaxpeax-lc87 = { version = "1.0.0" }
yaxpeax-pic17 = { version = "0.1.0" }
yaxpeax-pic18 = { version = "0.1.0" }
-yaxpeax-x86 = { version = "1.1.0", default-features = false, features = ["fmt", "std"] }
+yaxpeax-x86 = { version = "1.1.3", default-features = false, features = ["fmt", "std"] }
yaxpeax-ia64 = { version = "0.2.1", path = "/toy/yaxpeax/arch/ia64" }
yaxpeax-superh = { version = "0.1.0" }
yaxpeax-6502 = { version = "0.0.1" }
diff --git a/src/main.rs b/src/main.rs
index 9184601..6a3d3ac 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())
}
@@ -92,6 +92,7 @@ fn main() {
"ia64" => crate::current_arch::decode_input::<yaxpeax_ia64::IA64>(&buf, verbose),
"avr" => crate::current_arch::decode_input::<yaxpeax_avr::AVR>(&buf, verbose),
"armv7" => crate::current_arch::decode_input::<yaxpeax_arm::armv7::ARMv7>(&buf, verbose),
+ "armv7-t" => crate::current_arch::decode_armv7_thumb(&buf, verbose),
"armv8" => crate::current_arch::decode_input::<yaxpeax_arm::armv8::a64::ARMv8>(&buf, verbose),
"mips" => crate::current_arch::decode_input::<yaxpeax_mips::MIPS>(&buf, verbose),
// "msp430" => crate::current_arch::decode_input_with_annotation::<yaxpeax_msp430::MSP430>(&buf, verbose),
@@ -387,13 +388,19 @@ mod current_arch {
}
}
use std::fmt::Write;
- let _ = write!(res, "{}", fields[field_index].elements[0].description);
+ let _ = write!(res, "{:?}", fields[field_index].elements[0]);
res.push_str("\n");
}
println!("{}", res);
}
+ pub(crate) fn decode_armv7_thumb(buf: &[u8], verbose: bool) {
+ let mut decoder = <yaxpeax_arm::armv7::ARMv7 as Arch>::Decoder::default();
+ decoder.set_thumb_mode(true);
+ decode_input_with_decoder::<yaxpeax_arm::armv7::ARMv7>(decoder, buf, verbose);
+ }
+
pub(crate) fn decode_input<A: Arch>(buf: &[u8], verbose: bool)
where
A::Instruction: fmt::Display, for<'data> U8Reader<'data>: Reader<A::Address, A::Word>,