Skip to content

Commit 811bca2

Browse files
committed
implement idb_import cpu architecture aarch64
1 parent f3bd7e0 commit 811bca2

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

plugins/idb_import/src/lib.rs

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,10 @@ fn architecture_from_ida<K: IDAKind>(
476476
}
477477
Processor::Arm(arm) => {
478478
use idb_rs::processors::Arm::*;
479-
if bits == B64 {
480-
// TODO aarch64
481-
return Ok(None);
479+
match bits {
480+
B64 => return Ok(CoreArchitecture::by_name("aarch64")),
481+
B16 => return Err(anyhow!("ARM 16bits is unknown")),
482+
B32 => {}
482483
}
483484
let is_thumb = read_true_false_segreg(
484485
id0,
@@ -487,30 +488,27 @@ fn architecture_from_ida<K: IDAKind>(
487488
segment_idx,
488489
usize::from(ArmReg::T) - ArmReg::SEGMENT_REGISTERS_START,
489490
)?;
490-
match (arm, endian, bits, is_thumb) {
491-
// see above
492-
(_, _, B64, _) => unreachable!(),
493-
(_, _, B16, _) => Err(anyhow!("ARM 16bits is unknown")),
494-
(Arm | ProcAltXScaleL, Be, _, _) | (Armb | ProcAltXScaleB, Le, _, _) => {
491+
match (arm, endian, is_thumb) {
492+
(Arm | ProcAltXScaleL, Be, _) | (Armb | ProcAltXScaleB, Le, _) => {
495493
Err(anyhow!("ARM with conflicting endian: {arm:?} {endian:?}"))
496494
}
497495

498-
(Arm, Le, B32, false) => Ok(CoreArchitecture::by_name("armv7")),
499-
(Armb, Be, B32, false) => Ok(CoreArchitecture::by_name("armv7eb")),
500-
(Arm, Le, B32, true) => Ok(CoreArchitecture::by_name("thumb2")),
501-
(Armb, Be, B32, true) => Ok(CoreArchitecture::by_name("thumb2eb")),
496+
(Arm, Le, false) => Ok(CoreArchitecture::by_name("armv7")),
497+
(Armb, Be, false) => Ok(CoreArchitecture::by_name("armv7eb")),
498+
(Arm, Le, true) => Ok(CoreArchitecture::by_name("thumb2")),
499+
(Armb, Be, true) => Ok(CoreArchitecture::by_name("thumb2eb")),
502500

503501
// TODO default into armv7/thumb2?
504-
(ProcAltArm710A | ProcAltXScaleL, Le, B32, true) => {
502+
(ProcAltArm710A | ProcAltXScaleL, Le, true) => {
505503
Ok(CoreArchitecture::by_name("thumb2"))
506504
}
507-
(ProcAltArm710A | ProcAltXScaleB, Be, B32, true) => {
505+
(ProcAltArm710A | ProcAltXScaleB, Be, true) => {
508506
Ok(CoreArchitecture::by_name("thumb2eb"))
509507
}
510-
(ProcAltArm710A | ProcAltXScaleL, Le, B32, false) => {
508+
(ProcAltArm710A | ProcAltXScaleL, Le, false) => {
511509
Ok(CoreArchitecture::by_name("armv7"))
512510
}
513-
(ProcAltArm710A | ProcAltXScaleB, Be, B32, false) => {
511+
(ProcAltArm710A | ProcAltXScaleB, Be, false) => {
514512
Ok(CoreArchitecture::by_name("armv7eb"))
515513
}
516514
}

0 commit comments

Comments
 (0)