Struct HvCall

Source
pub struct HvCall {
    initialized: bool,
    vtl: Vtl,
}
Expand description

Provides mechanisms to invoke hypercalls within the boot shim. Internally uses static buffers for the hypercall page, the input page, and the output page, so this should not be used in any multi-threaded capacity (which the boot shim currently is not).

Fields§

§initialized: bool§vtl: Vtl

Implementations§

Source§

impl HvCall

Source

fn input_page() -> &'static mut HvcallPage

Source

fn output_page() -> &'static mut HvcallPage

Source

pub fn hypercall_page(&mut self) -> u64

Returns the address of the hypercall page, mapping it first if necessary.

Source

fn init_if_needed(&mut self)

Source

pub fn initialize(&mut self)

Source

pub fn uninitialize(&mut self)

Call before jumping to kernel.

Source

pub fn vtl(&self) -> Vtl

Returns the environment’s VTL.

Source

fn dispatch_hvcall( &mut self, code: HypercallCode, rep_count: Option<usize>, ) -> HypercallOutput

Makes a hypercall. rep_count is Some for rep hypercalls

Source

pub fn set_register( &mut self, name: HvRegisterName, value: HvRegisterValue, ) -> Result<(), HvError>

Hypercall for setting a register to a value.

Source

pub fn get_register( &mut self, name: HvRegisterName, ) -> Result<HvRegisterValue, HvError>

Hypercall for setting a register to a value.

Source

pub fn apply_vtl2_protections( &mut self, range: MemoryRange, ) -> Result<(), HvError>

Hypercall to apply vtl protections to the pages from address start to end

Source

pub fn accept_vtl2_pages( &mut self, range: MemoryRange, memory_type: AcceptMemoryType, ) -> Result<(), HvError>

Hypercall to accept vtl2 pages from address start to end with VTL 2 protections and no host visibility

Source

pub fn get_vp_index_from_hw_id<const N: usize>( &mut self, hw_ids: &[u32], output: &mut ArrayVec<u32, N>, ) -> Result<(), HvError>

Get the corresponding VP indices from a list of VP hardware IDs (APIC IDs on x64, MPIDR on ARM64).

This always queries VTL0, since the hardware IDs are the same across the VTLs in practice, and the hypercall only succeeds for VTL2 once VTL2 has been enabled (which it might not be at this point).

Auto Trait Implementations§

§

impl Freeze for HvCall

§

impl RefUnwindSafe for HvCall

§

impl Send for HvCall

§

impl Sync for HvCall

§

impl Unpin for HvCall

§

impl UnwindSafe for HvCall

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more