split out elfloader and adjust mutability

This commit is contained in:
Alex Zenla
2024-01-10 08:57:44 -08:00
parent 19b797f1a2
commit 5ff0ea8a1b
9 changed files with 255 additions and 230 deletions

View File

@ -1,10 +1,18 @@
use std::alloc::Layout;
use xenclient::boot::ElfLoader;
use xencall::domctl::DomainControl;
use xencall::sys::CreateDomain;
use xencall::XenCall;
use xenclient::boot::BootImageLoader;
use xenclient::elfloader::ElfImageLoader;
use xenclient::XenClientError;
fn main() -> Result<(), XenClientError> {
let boot = ElfLoader::load_file_kernel("/boot/vmlinuz-6.1.0-17-amd64")?;
let call = XenCall::open()?;
let domctl = DomainControl::new(&call);
let _domain = domctl.create_domain(CreateDomain::default())?;
let boot = ElfImageLoader::load_file_kernel("/boot/vmlinuz-6.1.0-17-amd64")?;
let ptr = unsafe { std::alloc::alloc(Layout::from_size_align(128 * 1024 * 1024, 16).unwrap()) };
boot.load(ptr)?;
let info = boot.load(ptr)?;
println!("{:?}", info);
Ok(())
}