use std::fmt::{Display, Formatter, Result};
#[derive(Debug, Default)]
pub struct KernelBundle {
pub host_addr: u64,
pub guest_addr: u64,
pub entry_addr: u64,
pub size: usize,
}
#[derive(Debug)]
pub enum KernelBundleError {
InvalidGuestAddress,
InvalidHostAddress,
InvalidSize,
}
impl Display for KernelBundleError {
fn fmt(&self, f: &mut Formatter) -> Result {
use self::KernelBundleError::*;
match *self {
InvalidGuestAddress => write!(f, "Guest address is not page-aligned"),
InvalidHostAddress => write!(f, "Host address is zero or not page-aligned"),
InvalidSize => write!(f, "Kernel size is zero or not a multiple of the page size"),
}
}
}
#[derive(Debug, Default)]
pub struct QbootBundle {
pub host_addr: u64,
pub size: usize,
}
#[derive(Debug)]
pub enum QbootBundleError {
InvalidSize,
}
impl Display for QbootBundleError {
fn fmt(&self, f: &mut Formatter) -> Result {
use self::QbootBundleError::*;
match *self {
InvalidSize => write!(f, "qboot binary is not 64K long."),
}
}
}
#[derive(Debug, Default)]
pub struct InitrdBundle {
pub host_addr: u64,
pub size: usize,
}