Trait EmulatorSupport

Source
pub trait EmulatorSupport: AccessCpuState {
    type Error: 'static + Error + Send + Sync;

    // Required methods
    fn vp_index(&self) -> VpIndex;
    fn physical_address(&self) -> Option<u64>;
    fn initial_gva_translation(&mut self) -> Option<InitialTranslation>;
    fn interruption_pending(&self) -> bool;
    fn check_vtl_access(
        &mut self,
        gpa: u64,
        mode: TranslateMode,
    ) -> Result<(), EmuCheckVtlAccessError<Self::Error>>;
    fn translate_gva(
        &mut self,
        gva: u64,
        mode: TranslateMode,
    ) -> Result<Result<EmuTranslateResult, EmuTranslateError>, Self::Error>;
    fn inject_pending_event(&mut self, event_info: HvAarch64PendingEvent);
    fn is_gpa_mapped(&self, gpa: u64, write: bool) -> bool;

    // Provided method
    fn check_monitor_write(&self, gpa: u64, bytes: &[u8]) -> bool { ... }
}
Expand description

Support routines for the emulator.

Required Associated Types§

Source

type Error: 'static + Error + Send + Sync

The hypervisor error type.

Required Methods§

Source

fn vp_index(&self) -> VpIndex

The current VP index.

Source

fn physical_address(&self) -> Option<u64>

The physical address that caused the fault.

Source

fn initial_gva_translation(&mut self) -> Option<InitialTranslation>

The gva translation included in the intercept message header, if valid.

Source

fn interruption_pending(&self) -> bool

If interrupt pending is marked in the intercept message

Source

fn check_vtl_access( &mut self, gpa: u64, mode: TranslateMode, ) -> Result<(), EmuCheckVtlAccessError<Self::Error>>

Check that the current GPA is valid to access by the current VTL with the following access mode. Returns true if valid to access.

Source

fn translate_gva( &mut self, gva: u64, mode: TranslateMode, ) -> Result<Result<EmuTranslateResult, EmuTranslateError>, Self::Error>

Translates a GVA to a GPA.

Source

fn inject_pending_event(&mut self, event_info: HvAarch64PendingEvent)

Generates an event (exception, guest nested page fault, etc.) in the guest.

Source

fn is_gpa_mapped(&self, gpa: u64, write: bool) -> bool

Returns true if gpa is mapped for the specified permissions.

If true, then the emulator will use [GuestMemory] to access the GPA, and any failures will be fatal to the VM.

If false, then the emulator will use [CpuIo] to access the GPA as MMIO.

Provided Methods§

Source

fn check_monitor_write(&self, gpa: u64, bytes: &[u8]) -> bool

Check if the specified write is wholly inside the monitor page, and signal the associated connected ID if it is.

Implementors§