mirror of
https://github.com/edera-dev/krata.git
synced 2025-08-03 13:11:31 +00:00
unpause domain so domain can run during boot
This commit is contained in:
@ -19,6 +19,9 @@ path = "../xencall"
|
||||
[dependencies.xenstore]
|
||||
path = "../xenstore"
|
||||
|
||||
[dependencies.xenevtchn]
|
||||
path = "../xenevtchn"
|
||||
|
||||
[dependencies.uuid]
|
||||
version = "1.6.1"
|
||||
features = ["v4"]
|
||||
|
@ -7,6 +7,7 @@ use xencall::XenCall;
|
||||
use xenclient::boot::BootSetup;
|
||||
use xenclient::elfloader::ElfImageLoader;
|
||||
use xenclient::XenClientError;
|
||||
use xenevtchn::EventChannel;
|
||||
|
||||
fn main() -> Result<(), XenClientError> {
|
||||
env_logger::init();
|
||||
@ -48,6 +49,10 @@ fn boot(
|
||||
let mut boot = BootSetup::new(call, domctl, &memctl, domid);
|
||||
let initrd = read(initrd_path)?;
|
||||
let mut state = boot.initialize(&image_loader, initrd.as_slice(), 1, 512)?;
|
||||
boot.boot(&mut state, "debug")?;
|
||||
boot.boot(&mut state, "debug elevator=noop")?;
|
||||
domctl.unpause_domain(domid)?;
|
||||
|
||||
let _evtchn = EventChannel::open()?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -82,6 +82,8 @@ pub struct BootState {
|
||||
pub image_info: BootImageInfo,
|
||||
pub shared_info_frame: u64,
|
||||
pub initrd_segment: DomainSegment,
|
||||
pub store_evtchn: u32,
|
||||
pub console_evtchn: u32,
|
||||
}
|
||||
|
||||
impl BootSetup<'_> {
|
||||
@ -282,7 +284,8 @@ impl BootSetup<'_> {
|
||||
}
|
||||
|
||||
let initrd_segment = initrd_segment.unwrap();
|
||||
|
||||
let store_evtchn = self.domctl.call.evtchn_alloc_unbound(self.domid, 0)?;
|
||||
let console_evtchn = self.domctl.call.evtchn_alloc_unbound(self.domid, 0)?;
|
||||
let state = BootState {
|
||||
kernel_segment,
|
||||
start_info_segment,
|
||||
@ -294,6 +297,8 @@ impl BootSetup<'_> {
|
||||
page_table,
|
||||
image_info,
|
||||
initrd_segment,
|
||||
store_evtchn,
|
||||
console_evtchn,
|
||||
shared_info_frame: 0,
|
||||
};
|
||||
debug!("BootSetup initialize state={:?}", state);
|
||||
@ -491,10 +496,10 @@ impl BootSetup<'_> {
|
||||
(*info).first_p2m_pfn = state.p2m_segment.pfn;
|
||||
(*info).nr_p2m_frames = state.p2m_segment.pages;
|
||||
(*info).flags = 0;
|
||||
(*info).store_evtchn = 0;
|
||||
(*info).store_evtchn = state.store_evtchn;
|
||||
(*info).store_mfn = self.phys.p2m[state.xenstore_segment.pfn as usize];
|
||||
(*info).console.mfn = self.phys.p2m[state.console_segment.pfn as usize];
|
||||
(*info).console.evtchn = 0;
|
||||
(*info).console.evtchn = state.console_evtchn;
|
||||
(*info).mod_start = state.initrd_segment.vstart;
|
||||
(*info).mod_len = state.initrd_segment.size;
|
||||
for (i, c) in cmdline.chars().enumerate() {
|
||||
|
@ -12,6 +12,7 @@ use std::string::FromUtf8Error;
|
||||
use xencall::domctl::DomainControl;
|
||||
use xencall::sys::CreateDomain;
|
||||
use xencall::{XenCall, XenCallError};
|
||||
use xenevtchn::EventChannelError;
|
||||
use xenstore::bus::XsdBusError;
|
||||
use xenstore::client::{XsdClient, XsdInterface};
|
||||
|
||||
@ -69,6 +70,12 @@ impl From<FromUtf8Error> for XenClientError {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<EventChannelError> for XenClientError {
|
||||
fn from(value: EventChannelError) -> Self {
|
||||
XenClientError::new(value.to_string().as_str())
|
||||
}
|
||||
}
|
||||
|
||||
impl XenClient {
|
||||
pub fn open() -> Result<XenClient, XenClientError> {
|
||||
let store = XsdClient::open()?;
|
||||
|
Reference in New Issue
Block a user