Struct linux_loader::configurator::pvh::PvhBootConfigurator
source · pub struct PvhBootConfigurator {}Available on (x86 or x86-64) and (crate features
elf or pe or bzimage) only.Expand description
Boot configurator for the PVH boot protocol.
Trait Implementations§
source§impl BootConfigurator for PvhBootConfigurator
Available on crate features elf or bzimage only.
impl BootConfigurator for PvhBootConfigurator
Available on crate features
elf or bzimage only.source§fn write_bootparams<M>(params: &BootParams, guest_memory: &M) -> Result<()>where
M: GuestMemory,
fn write_bootparams<M>(params: &BootParams, guest_memory: &M) -> Result<()>where
M: GuestMemory,
Writes the boot parameters (configured elsewhere) into guest memory.
§Arguments
params- boot parameters. The header contains ahvm_start_infostruct. The sections contain the memory map in a vector ofhvm_memmap_table_entrystructs. The modules, if specified, containhvm_modlist_entrystructs.guest_memory- guest’s physical memory.
§Examples
fn create_guest_memory() -> GuestMemoryMmap {
GuestMemoryMmap::from_ranges(&[(GuestAddress(0x0), (MEM_SIZE as usize))]).unwrap()
}
fn build_boot_params() -> (hvm_start_info, Vec<hvm_memmap_table_entry>) {
let mut start_info = hvm_start_info::default();
let memmap_entry = hvm_memmap_table_entry {
addr: 0x7000,
size: 0,
type_: E820_RAM,
reserved: 0,
};
start_info.magic = XEN_HVM_START_MAGIC_VALUE;
start_info.version = 1;
start_info.nr_modules = 0;
start_info.memmap_entries = 0;
(start_info, vec![memmap_entry])
}
fn main() {
let guest_mem = create_guest_memory();
let (mut start_info, memmap_entries) = build_boot_params();
let start_info_addr = GuestAddress(0x6000);
let memmap_addr = GuestAddress(0x7000);
start_info.memmap_paddr = memmap_addr.raw_value();
let mut boot_params = BootParams::new::<hvm_start_info>(&start_info, start_info_addr);
boot_params.set_sections::<hvm_memmap_table_entry>(&memmap_entries, memmap_addr);
PvhBootConfigurator::write_bootparams::<GuestMemoryMmap>(&boot_params, &guest_mem).unwrap();
}Auto Trait Implementations§
impl RefUnwindSafe for PvhBootConfigurator
impl Send for PvhBootConfigurator
impl Sync for PvhBootConfigurator
impl Unpin for PvhBootConfigurator
impl UnwindSafe for PvhBootConfigurator
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more