Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions objdiff-core/src/arch/arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,14 @@ impl Arch for ArchArm {
}

// Check how many bytes we can/should read
let num_code_bytes = if mode == unarm::ParseMode::Data {
// 32-bit .word value should be aligned on a 4-byte boundary, otherwise use .hword
if address & 3 == 0 { 4 } else { 2 }
} else if data.len() >= 4 {
// Read 4 bytes even for Thumb, as the parser will determine if it's a 2 or 4 byte instruction
4
let num_code_bytes = if data.len() >= 4 {
if mode == unarm::ParseMode::Data && address & 3 != 0 {
// 32-bit .word value should be aligned on a 4-byte boundary, otherwise use .hword
2
} else {
// Read 4 bytes even for Thumb, as the parser will determine if it's a 2 or 4 byte instruction
4
}
} else if mode != unarm::ParseMode::Arm {
2
} else {
Expand Down
Loading