Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly locate ProDG .bss sections (partial addressing of #62) #63

Merged
merged 2 commits into from
Jul 17, 2024
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: 11 additions & 3 deletions src/analysis/cfa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,19 +597,27 @@ pub fn locate_bss_memsets(obj: &mut ObjInfo) -> Result<Vec<(u32, u32)>> {
StepResult::Branch(branches) => {
for branch in branches {
if branch.link {
// ProDG bug? Registers are supposed to start at r3
// Some ProDG crt0.s versions use the wrong registers, some don't
if let (
GprValue::Constant(addr),
GprValue::Constant(value),
GprValue::Constant(size),
) = (vm.gpr_value(4), vm.gpr_value(5), vm.gpr_value(6))
{
) = {
if vm.gpr_value(4) == GprValue::Constant(0) {
(vm.gpr_value(3), vm.gpr_value(4), vm.gpr_value(5))
} else {
(vm.gpr_value(4), vm.gpr_value(5), vm.gpr_value(6))
}
} {
if value == 0 && size > 0 {
bss_sections.push((addr, size));
}
}
}
}
if bss_sections.len() >= 2 {
return Ok(ExecCbResult::End(()));
}
Ok(ExecCbResult::Continue)
}
}
Expand Down