virt

Trait Processor

Source
pub trait Processor: InspectMut {
    type Error: Error + Send + Sync + 'static;
    type RunVpError: Error + Send + Sync + 'static;
    type StateAccess<'a>: AccessVpState
       where Self: 'a;

    // Required methods
    fn set_debug_state(
        &mut self,
        vtl: Vtl,
        state: Option<&DebugState>,
    ) -> Result<(), Self::Error>;
    async fn run_vp(
        &mut self,
        stop: StopVp<'_>,
        dev: &impl CpuIo,
    ) -> Result<Infallible, VpHaltReason<Self::RunVpError>>;
    fn flush_async_requests(&mut self) -> Result<(), Self::RunVpError>;
    fn access_state(&mut self, vtl: Vtl) -> Self::StateAccess<'_>;

    // Provided method
    fn vtl_inspectable(&self, vtl: Vtl) -> bool { ... }
}

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

Source

type RunVpError: Error + Send + Sync + 'static

Source

type StateAccess<'a>: AccessVpState where Self: 'a

Required Methods§

Source

fn set_debug_state( &mut self, vtl: Vtl, state: Option<&DebugState>, ) -> Result<(), Self::Error>

Sets the debug state: conditions under which the VP should exit for debugging the guest. This including single stepping and hardware breakpoints.

TODO: generalize for non-x86 architectures.

Source

async fn run_vp( &mut self, stop: StopVp<'_>, dev: &impl CpuIo, ) -> Result<Infallible, VpHaltReason<Self::RunVpError>>

Runs the VP.

Although this is an async function, it may block synchronously until Partition::request_yield is called for this VP. Then its future must return Poll::Pending at least once.

Returns when an error occurs, the VP halts, or the VP is requested to stop via stop.

Source

fn flush_async_requests(&mut self) -> Result<(), Self::RunVpError>

Without running the VP, flushes any asynchronous requests from other processors or objects that might affect this state, so that the object can be saved/restored correctly.

Source

fn access_state(&mut self, vtl: Vtl) -> Self::StateAccess<'_>

Provided Methods§

Source

fn vtl_inspectable(&self, vtl: Vtl) -> bool

Returns whether the specified VTL can be inspected on this processor.

VTL0 is always inspectable.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§