mirror of
https://github.com/edera-dev/krata.git
synced 2025-08-03 05:10:55 +00:00
implement initrd loading for pvh
This commit is contained in:
parent
8d1b970f65
commit
2ce3a01a6f
@ -208,14 +208,15 @@ impl<I: BootImageLoader, P: BootSetupPlatform> BootSetup<I, P> {
|
||||
kernel_segment = Some(self.load_kernel_segment(&mut domain).await?);
|
||||
}
|
||||
|
||||
self.platform.alloc_magic_pages(&mut domain).await?;
|
||||
|
||||
if domain.image_info.unmapped_initrd {
|
||||
initrd_segment = Some(domain.alloc_module(initrd).await?);
|
||||
}
|
||||
|
||||
domain.initrd_segment =
|
||||
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?;
|
||||
|
||||
let _kernel_segment =
|
||||
|
@ -631,6 +631,10 @@ impl BootSetupPlatform for X86PvhPlatform {
|
||||
)
|
||||
.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>();
|
||||
start_info_size += HVM_START_MAX_CMDLINE_SIZE;
|
||||
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).nr_modules = 1;
|
||||
(*info).modlist_paddr = (start_info_segment.pfn << self.page_shift())
|
||||
+ size_of::<HvmStartInfo>() as u64
|
||||
+ (size_of::<HvmMemmapTableEntry>() * HVM_START_MAX_MEMMAP_ENTRIES) as u64;
|
||||
+ (size_of::<HvmStartInfo>()
|
||||
+ 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;
|
||||
for (i, c) in domain.cmdline.chars().enumerate() {
|
||||
|
Loading…
Reference in New Issue
Block a user