mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: memory: Use fine grained mmap wrapper
In order to anticipate the need for special mmap flags when memory mapping the guest RAM, we need to switch from from_file() wrapper to build() wrapper. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
@@ -436,9 +436,15 @@ impl MemoryManager {
|
|||||||
|
|
||||||
f.set_len(size as u64).map_err(Error::SharedFileSetLen)?;
|
f.set_len(size as u64).map_err(Error::SharedFileSetLen)?;
|
||||||
|
|
||||||
|
let mmap_flags = libc::MAP_NORESERVE | libc::MAP_SHARED;
|
||||||
GuestRegionMmap::new(
|
GuestRegionMmap::new(
|
||||||
MmapRegion::from_file(FileOffset::new(f, 0), size)
|
MmapRegion::build(
|
||||||
.map_err(Error::GuestMemoryRegion)?,
|
Some(FileOffset::new(f, 0)),
|
||||||
|
size,
|
||||||
|
libc::PROT_READ | libc::PROT_WRITE,
|
||||||
|
mmap_flags,
|
||||||
|
)
|
||||||
|
.map_err(Error::GuestMemoryRegion)?,
|
||||||
start_addr,
|
start_addr,
|
||||||
)
|
)
|
||||||
.map_err(Error::GuestMemory)?
|
.map_err(Error::GuestMemory)?
|
||||||
|
|||||||
Reference in New Issue
Block a user