Processor

Trait Processor 

Source
pub trait Processor: InspectMut {
    type StateAccess<'a>: AccessVpState
       where Self: 'a;

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

    // Provided methods
    fn vtl_inspectable(&self, vtl: Vtl) -> bool { ... }
    fn reset(&mut self) -> Result<(), impl Error + Send + Sync + 'static> { ... }
    fn scrub(
        &mut self,
        _vtl: Vtl,
    ) -> Result<(), impl Error + Send + Sync + 'static> { ... }
}

Required Associated Types§

Source

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

Required Methods§

Source

fn set_debug_state( &mut self, vtl: Vtl, state: Option<&DebugState>, ) -> Result<(), <Self::StateAccess<'_> as AccessVpState>::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>

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)

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.

Source

fn reset(&mut self) -> Result<(), impl Error + Send + Sync + 'static>

Resets per-VP state after a partition-level reset.

Called on each VP’s thread while VPs are stopped, after ResetPartition::reset has completed.

The default implementation panics. Backends that support ResetPartition must override this.

Source

fn scrub(&mut self, _vtl: Vtl) -> Result<(), impl Error + Send + Sync + 'static>

Scrubs per-VP state for a specific VTL.

Called on each VP’s thread while VPs are stopped, after ScrubVtl::scrub has completed.

The default implementation panics. Backends that support ScrubVtl must override this.

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§