diff --git a/Cargo.toml b/Cargo.toml index c3cad52..b29f02d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,11 +26,11 @@ pe = ["elf"] elf = [] [dependencies] -vm-memory = ">=0.16.0, <=0.17.1" +vm-memory = { version = ">=0.16.0, <=0.18.0", default-features = false } [dev-dependencies] -criterion = { version = "0.7.0", features = ["html_reports"] } -vm-memory = { version = ">=0.16.0, <=0.17.1", features = ["backend-mmap"] } +criterion = { version = "0.8.1", features = ["html_reports"] } +vm-memory = { version = ">=0.16.0, <=0.18.0", default-features = false, features = ["backend-mmap"] } [[bench]] name = "main" diff --git a/src/configurator/mod.rs b/src/configurator/mod.rs index c854a6f..2df6c9a 100644 --- a/src/configurator/mod.rs +++ b/src/configurator/mod.rs @@ -18,7 +18,7 @@ #![cfg(any(feature = "elf", feature = "pe", feature = "bzimage"))] -use vm_memory::{Address, ByteValued, GuestAddress, GuestMemory}; +use vm_memory::{Address, ByteValued, GuestAddress, GuestMemory, GuestMemoryBackend}; use std::fmt; @@ -123,7 +123,7 @@ pub trait BootConfigurator { /// * `guest_memory` - guest's physical memory. fn write_bootparams(params: &BootParams, guest_memory: &M) -> Result<()> where - M: GuestMemory; + M: GuestMemory + GuestMemoryBackend; } /// Boot parameters to be written in guest memory. diff --git a/src/configurator/x86_64/linux.rs b/src/configurator/x86_64/linux.rs index 0a63136..b6365d5 100644 --- a/src/configurator/x86_64/linux.rs +++ b/src/configurator/x86_64/linux.rs @@ -12,7 +12,7 @@ //! Traits and structs for configuring and loading boot parameters on `x86_64` using the Linux //! boot protocol. -use vm_memory::{Bytes, GuestMemory}; +use vm_memory::{Bytes, GuestMemory, GuestMemoryBackend}; use crate::configurator::{BootConfigurator, BootParams, Error as BootConfiguratorError, Result}; @@ -97,7 +97,7 @@ impl BootConfigurator for LinuxBootConfigurator { /// [`boot_params`]: ../loader/bootparam/struct.boot_params.html fn write_bootparams(params: &BootParams, guest_memory: &M) -> Result<()> where - M: GuestMemory, + M: GuestMemory + GuestMemoryBackend, { // The VMM has filled a `boot_params` struct and its e820 map. // This will be written in guest memory at the zero page. diff --git a/src/configurator/x86_64/pvh.rs b/src/configurator/x86_64/pvh.rs index c89d84a..4002ec6 100644 --- a/src/configurator/x86_64/pvh.rs +++ b/src/configurator/x86_64/pvh.rs @@ -14,7 +14,7 @@ #![cfg(any(feature = "elf", feature = "bzimage"))] -use vm_memory::{ByteValued, Bytes, GuestMemory}; +use vm_memory::{ByteValued, Bytes, GuestMemory, GuestMemoryBackend}; use crate::configurator::{BootConfigurator, BootParams, Error as BootConfiguratorError, Result}; use crate::loader_gen::start_info::{hvm_memmap_table_entry, hvm_modlist_entry, hvm_start_info}; @@ -145,7 +145,7 @@ impl BootConfigurator for PvhBootConfigurator { /// ``` fn write_bootparams(params: &BootParams, guest_memory: &M) -> Result<()> where - M: GuestMemory, + M: GuestMemory + GuestMemoryBackend, { // The VMM has filled an `hvm_start_info` struct and a `Vec` // and has passed them on to this function. diff --git a/src/loader/mod.rs b/src/loader/mod.rs index 702d175..a49a0e6 100644 --- a/src/loader/mod.rs +++ b/src/loader/mod.rs @@ -24,7 +24,9 @@ use std::io::{Read, Seek}; #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] use vm_memory::ByteValued; -use vm_memory::{Address, Bytes, GuestAddress, GuestMemory, GuestUsize, ReadVolatile}; +use vm_memory::{ + Address, Bytes, GuestAddress, GuestMemory, GuestMemoryBackend, GuestUsize, ReadVolatile, +}; #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub use crate::loader_gen::bootparam; @@ -219,7 +221,7 @@ unsafe impl ByteValued for bootparam::boot_params {} /// let result = load_cmdline(&gm, GuestAddress(0x1000), &cl).unwrap(); /// gm.read_slice(buf.as_mut_slice(), GuestAddress(0x1000)).unwrap(); /// assert_eq!(buf.as_slice(), "foo=bar\0".as_bytes()); -pub fn load_cmdline( +pub fn load_cmdline( guest_mem: &M, guest_addr: GuestAddress, cmdline: &Cmdline,