Skip to content

Commit 22458cb

Browse files
committed
Use self.get_mapped_regions() where possible
Signed-off-by: Ludvig Liljenberg <[email protected]>
1 parent 31301c3 commit 22458cb

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/hyperlight_host/src/hypervisor/hyperlight_vm.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -436,10 +436,7 @@ impl HyperlightVm {
436436
self.handle_io(mem_mgr, host_funcs, port, data)?
437437
}
438438
Ok(HyperlightExit::MmioRead(addr)) => {
439-
let all_regions = self
440-
.sandbox_regions
441-
.iter()
442-
.chain(self.mmap_regions.iter().map(|(_, r)| r));
439+
let all_regions = self.sandbox_regions.iter().chain(self.get_mapped_regions());
443440
match get_memory_access_violation(
444441
addr as usize,
445442
MemoryRegionFlags::WRITE,
@@ -465,10 +462,7 @@ impl HyperlightVm {
465462
}
466463
}
467464
Ok(HyperlightExit::MmioWrite(addr)) => {
468-
let all_regions = self
469-
.sandbox_regions
470-
.iter()
471-
.chain(self.mmap_regions.iter().map(|(_, r)| r));
465+
let all_regions = self.sandbox_regions.iter().chain(self.get_mapped_regions());
472466
match get_memory_access_violation(
473467
addr as usize,
474468
MemoryRegionFlags::WRITE,
@@ -602,7 +596,7 @@ impl HyperlightVm {
602596

603597
let mem_access = DebugMemoryAccess {
604598
dbg_mem_access_fn,
605-
guest_mmap_regions: self.mmap_regions.iter().map(|(_, r)| r.clone()).collect(),
599+
guest_mmap_regions: self.get_mapped_regions().cloned().collect(),
606600
};
607601

608602
match stop_reason {
@@ -776,7 +770,7 @@ impl HyperlightVm {
776770

777771
// Include both initial sandbox regions and dynamically mapped regions
778772
let mut regions: Vec<MemoryRegion> = self.sandbox_regions.clone();
779-
regions.extend(self.mmap_regions.iter().map(|(_, r)| r).cloned());
773+
regions.extend(self.get_mapped_regions().cloned());
780774
Ok(Some(crashdump::CrashDumpContext::new(
781775
regions,
782776
regs,

0 commit comments

Comments
 (0)