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(&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§
Required Methods§
Sourcefn physical_address(&self) -> Option<u64>
fn physical_address(&self) -> Option<u64>
The physical address that caused the fault.
Sourcefn initial_gva_translation(&self) -> Option<InitialTranslation>
fn initial_gva_translation(&self) -> Option<InitialTranslation>
The gva translation included in the intercept message header, if valid.
Sourcefn interruption_pending(&self) -> bool
fn interruption_pending(&self) -> bool
If interrupt pending is marked in the intercept message
Sourcefn check_vtl_access(
&mut self,
gpa: u64,
mode: TranslateMode,
) -> Result<(), EmuCheckVtlAccessError<Self::Error>>
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.
Sourcefn translate_gva(
&mut self,
gva: u64,
mode: TranslateMode,
) -> Result<Result<EmuTranslateResult, EmuTranslateError>, Self::Error>
fn translate_gva( &mut self, gva: u64, mode: TranslateMode, ) -> Result<Result<EmuTranslateResult, EmuTranslateError>, Self::Error>
Translates a GVA to a GPA.
Sourcefn inject_pending_event(&mut self, event_info: HvAarch64PendingEvent)
fn inject_pending_event(&mut self, event_info: HvAarch64PendingEvent)
Generates an event (exception, guest nested page fault, etc.) in the guest.
Sourcefn is_gpa_mapped(&self, gpa: u64, write: bool) -> bool
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§
Sourcefn check_monitor_write(&self, gpa: u64, bytes: &[u8]) -> bool
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.