we've done it, it boots!

This commit is contained in:
Alex Zenla
2024-01-16 23:07:34 -08:00
parent 0d68db8523
commit 5c1bb3d8fc
7 changed files with 161 additions and 40 deletions

View File

@ -3,7 +3,7 @@ pub mod memory;
pub mod sys;
use crate::sys::{
Hypercall, MmapBatch, MultiCallEntry, XenCapabilitiesInfo, HYPERVISOR_MULTICALL,
Hypercall, MmapBatch, MmapResource, MultiCallEntry, XenCapabilitiesInfo, HYPERVISOR_MULTICALL,
HYPERVISOR_XEN_VERSION, XENVER_CAPABILITIES,
};
use libc::{mmap, MAP_FAILED, MAP_SHARED, PROT_READ, PROT_WRITE};
@ -168,6 +168,29 @@ impl XenCall {
Ok(())
}
pub fn map_resource(
&self,
domid: u32,
typ: u32,
id: u32,
idx: u32,
num: u64,
addr: u64,
) -> Result<(), XenCallError> {
let mut resource = MmapResource {
dom: domid as u16,
typ,
id,
idx,
num,
addr,
};
unsafe {
sys::mmap_resource(self.handle.as_raw_fd(), &mut resource)?;
}
Ok(())
}
pub fn mmap_batch(
&self,
domid: u32,