mirror of
https://github.com/edera-dev/krata.git
synced 2025-08-03 13:11:31 +00:00
fix loading of kernel into memory
This commit is contained in:
@ -3,7 +3,7 @@ use xencall::domctl::DomainControl;
|
||||
use xencall::memory::MemoryControl;
|
||||
use xencall::sys::CreateDomain;
|
||||
use xencall::XenCall;
|
||||
use xenclient::boot::{BootImageLoader, BootSetup};
|
||||
use xenclient::boot::BootSetup;
|
||||
use xenclient::elfloader::ElfImageLoader;
|
||||
use xenclient::XenClientError;
|
||||
|
||||
@ -17,14 +17,11 @@ fn main() -> Result<(), XenClientError> {
|
||||
let call = XenCall::open()?;
|
||||
let domctl = DomainControl::new(&call);
|
||||
let domid = domctl.create_domain(CreateDomain::default())?;
|
||||
let domain = domctl.get_domain_info(domid)?;
|
||||
println!("domain created: {:?}", domain);
|
||||
println!("domain created: {:?}", domid);
|
||||
let image_loader = ElfImageLoader::load_file_kernel(kernel_image_path.as_str())?;
|
||||
let image_info = image_loader.parse()?;
|
||||
println!("loaded kernel image into memory: {:?}", image_info);
|
||||
let memctl = MemoryControl::new(&call);
|
||||
let mut boot = BootSetup::new(&call, &domctl, &memctl, domid);
|
||||
boot.initialize(image_info, 512 * 1024)?;
|
||||
boot.initialize(&image_loader, 512 * 1024)?;
|
||||
domctl.destroy_domain(domid)?;
|
||||
println!("domain destroyed: {}", domid);
|
||||
Ok(())
|
||||
|
Reference in New Issue
Block a user