mirror of
https://github.com/edera-dev/krata.git
synced 2025-08-03 21:21:32 +00:00
implement initrd loading for pvh
This commit is contained in:
@ -208,14 +208,15 @@ impl<I: BootImageLoader, P: BootSetupPlatform> BootSetup<I, P> {
|
|||||||
kernel_segment = Some(self.load_kernel_segment(&mut domain).await?);
|
kernel_segment = Some(self.load_kernel_segment(&mut domain).await?);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.platform.alloc_magic_pages(&mut domain).await?;
|
|
||||||
|
|
||||||
if domain.image_info.unmapped_initrd {
|
if domain.image_info.unmapped_initrd {
|
||||||
initrd_segment = Some(domain.alloc_module(initrd).await?);
|
initrd_segment = Some(domain.alloc_module(initrd).await?);
|
||||||
}
|
}
|
||||||
|
|
||||||
domain.initrd_segment =
|
domain.initrd_segment =
|
||||||
initrd_segment.ok_or(Error::MemorySetupFailed("initrd_segment missing"))?;
|
initrd_segment.ok_or(Error::MemorySetupFailed("initrd_segment missing"))?;
|
||||||
|
|
||||||
|
self.platform.alloc_magic_pages(&mut domain).await?;
|
||||||
|
|
||||||
domain.store_evtchn = self.call.evtchn_alloc_unbound(self.domid, 0).await?;
|
domain.store_evtchn = self.call.evtchn_alloc_unbound(self.domid, 0).await?;
|
||||||
|
|
||||||
let _kernel_segment =
|
let _kernel_segment =
|
||||||
|
@ -631,6 +631,10 @@ impl BootSetupPlatform for X86PvhPlatform {
|
|||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
if domain.cmdline.chars().count() > HVM_START_MAX_CMDLINE_SIZE - 1 {
|
||||||
|
return Err(Error::GenericError("kernel cmdline too large".to_string()));
|
||||||
|
}
|
||||||
|
|
||||||
let mut start_info_size = size_of::<HvmStartInfo>();
|
let mut start_info_size = size_of::<HvmStartInfo>();
|
||||||
start_info_size += HVM_START_MAX_CMDLINE_SIZE;
|
start_info_size += HVM_START_MAX_CMDLINE_SIZE;
|
||||||
start_info_size += size_of::<HvmMemmapTableEntry>() * HVM_START_MAX_MEMMAP_ENTRIES;
|
start_info_size += size_of::<HvmMemmapTableEntry>() * HVM_START_MAX_MEMMAP_ENTRIES;
|
||||||
@ -705,8 +709,10 @@ impl BootSetupPlatform for X86PvhPlatform {
|
|||||||
(*info).rsdp_paddr = self.acpi_modules[0].guest_addr;
|
(*info).rsdp_paddr = self.acpi_modules[0].guest_addr;
|
||||||
(*info).nr_modules = 1;
|
(*info).nr_modules = 1;
|
||||||
(*info).modlist_paddr = (start_info_segment.pfn << self.page_shift())
|
(*info).modlist_paddr = (start_info_segment.pfn << self.page_shift())
|
||||||
+ size_of::<HvmStartInfo>() as u64
|
+ (size_of::<HvmStartInfo>()
|
||||||
+ (size_of::<HvmMemmapTableEntry>() * HVM_START_MAX_MEMMAP_ENTRIES) as u64;
|
+ HVM_START_MAX_CMDLINE_SIZE
|
||||||
|
+ (size_of::<HvmMemmapTableEntry>() * HVM_START_MAX_MEMMAP_ENTRIES))
|
||||||
|
as u64;
|
||||||
};
|
};
|
||||||
let cmdline_ptr = (ptr + size_of::<HvmStartInfo>() as u64) as *mut u8;
|
let cmdline_ptr = (ptr + size_of::<HvmStartInfo>() as u64) as *mut u8;
|
||||||
for (i, c) in domain.cmdline.chars().enumerate() {
|
for (i, c) in domain.cmdline.chars().enumerate() {
|
||||||
|
Reference in New Issue
Block a user