Skip to content

Commit

Permalink
Re-add warning for unused MRs
Browse files Browse the repository at this point in the history
This was in the tool before it was rewritten to Rust, the omission
of the warning was an oversight when I did the rewrite.

Signed-off-by: Ivan Velickovic <[email protected]>
  • Loading branch information
Ivan-Velickovic committed Sep 3, 2024
1 parent 83688f5 commit 12412c6
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tool/microkit/src/sdf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,28 @@ pub fn parse(filename: &str, xml: &str, config: &Config) -> Result<SystemDescrip
}
}

// Check that all MRs are used
let mut all_maps = vec![];
for pd in &pds {
all_maps.extend(&pd.maps);
if let Some(vm) = &pd.virtual_machine {
all_maps.extend(&vm.maps);
}
}
for mr in &mrs {
let mut found = false;
for map in &all_maps {
if map.mr == mr.name {
found = true;
break;
}
}

if !found {
println!("WARNING: unused memory region '{}'", mr.name);
}
}

Ok(SystemDescription {
protection_domains: pds,
memory_regions: mrs,
Expand Down

0 comments on commit 12412c6

Please sign in to comment.