Skip to content

Commit f312c71

Browse files
committed
WIP: kani proofs
Signed-off-by: Babis Chalios <[email protected]>
1 parent 44a74fe commit f312c71

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/vmm/src/arch/x86_64/mod.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -486,13 +486,6 @@ mod verification {
486486
kani::assume(offset.checked_add(len).is_some());
487487

488488
let regions = arch_memory_regions(offset as usize, len as usize);
489-
for region in &regions {
490-
println!(
491-
"region: [{:x},{:x})",
492-
region.0.0,
493-
region.0.0 + region.1 as u64
494-
);
495-
}
496489

497490
// There are two MMIO gaps, so we can get either 1, 2 or 3 regions
498491
assert!(regions.len() <= 3);
@@ -520,12 +513,16 @@ mod verification {
520513
// All regions have non-zero length
521514
assert!(regions.iter().all(|&(_, len)| len > 0));
522515

523-
// If there's at least two regions, they perfectly snuggle up to the 32bit MMIO gap
516+
// If there's at least two regions, they perfectly snuggle up to one of the two MMIO gaps
524517
if regions.len() >= 2 {
525518
kani::cover!();
526519

527-
assert_eq!(regions[0].0.0 + regions[0].1 as u64, MMIO32_MEM_START);
528-
assert_eq!(regions[1].0.0, FIRST_ADDR_PAST_32BITS);
520+
if offset < MMIO32_MEM_START {
521+
assert_eq!(regions[0].0.0 + regions[0].1 as u64, MMIO32_MEM_START);
522+
assert_eq!(regions[1].0.0, FIRST_ADDR_PAST_32BITS);
523+
} else {
524+
assert_eq!(regions[0].0.0 + regions[0].1 as u64, MMIO64_MEM_START);
525+
}
529526
}
530527

531528
// If there are three regions, the last two perfectly snuggle up to the 64bit

0 commit comments

Comments
 (0)