vmm, hypervisor: introduce and use make_user_memory_region

This removes the last KVM-ism from memory_manager. Also make use of that
method in other places.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Wei Liu
2020-07-04 11:38:17 +00:00
committed by Samuel Ortiz
parent 8d97d628c3
commit cfa758fbb1
5 changed files with 49 additions and 25 deletions

View File

@@ -1451,13 +1451,13 @@ pub fn test_vm() {
let vm = hv.create_vm().expect("new VM creation failed");
mem.with_regions(|index, region| {
let mem_region = hypervisor::MemoryRegion {
slot: index as u32,
guest_phys_addr: region.start_addr().raw_value(),
memory_size: region.len() as u64,
userspace_addr: region.as_ptr() as u64,
flags: 0,
};
let mem_region = vm.make_user_memory_region(
index as u32,
region.start_addr().raw_value(),
region.len() as u64,
region.as_ptr() as u64,
false,
);
vm.set_user_memory_region(mem_region)
})