pub trait EmulatorSupport {
type Error: 'static + Error + Send + Sync;
Show 26 methods
// Required methods
fn vp_index(&self) -> VpIndex;
fn vendor(&self) -> Vendor;
fn gp(&mut self, index: Gp) -> u64;
fn set_gp(&mut self, reg: Gp, v: u64);
fn rip(&mut self) -> u64;
fn set_rip(&mut self, v: u64);
fn segment(&mut self, index: Segment) -> SegmentRegister;
fn efer(&mut self) -> u64;
fn cr0(&mut self) -> u64;
fn rflags(&mut self) -> RFlags;
fn set_rflags(&mut self, v: RFlags);
fn xmm(&mut self, reg: usize) -> u128;
fn set_xmm(&mut self, reg: usize, value: u128) -> Result<(), Self::Error>;
fn flush(&mut self) -> Result<(), Self::Error>;
fn instruction_bytes(&self) -> &[u8] ⓘ;
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: HvX64PendingEvent);
fn is_gpa_mapped(&self, gpa: u64, write: bool) -> bool;
fn lapic_base_address(&self) -> Option<u64>;
fn lapic_read(&mut self, address: u64, data: &mut [u8]);
fn lapic_write(&mut self, address: u64, data: &[u8]);
// 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 segment(&mut self, index: Segment) -> SegmentRegister
fn segment(&mut self, index: Segment) -> SegmentRegister
Read a segment register
Sourcefn set_rflags(&mut self, v: RFlags)
fn set_rflags(&mut self, v: RFlags)
Set rflags
Sourcefn set_xmm(&mut self, reg: usize, value: u128) -> Result<(), Self::Error>
fn set_xmm(&mut self, reg: usize, value: u128) -> Result<(), Self::Error>
Sets the value of an XMM* register.
Sourcefn flush(&mut self) -> Result<(), Self::Error>
fn flush(&mut self) -> Result<(), Self::Error>
Flush registers in the emulation cache to the backing
Sourcefn instruction_bytes(&self) -> &[u8] ⓘ
fn instruction_bytes(&self) -> &[u8] ⓘ
The instruction bytes, if available.
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: HvX64PendingEvent)
fn inject_pending_event(&mut self, event_info: HvX64PendingEvent)
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.
Sourcefn lapic_base_address(&self) -> Option<u64>
fn lapic_base_address(&self) -> Option<u64>
Returns the page-aligned base address of the enabled local APIC in xapic mode.
Sourcefn lapic_read(&mut self, address: u64, data: &mut [u8])
fn lapic_read(&mut self, address: u64, data: &mut [u8])
Read from the current processor’s local APIC memory mapped interface.
This will only be called on an address in the page returned by
lapic_base_address
.
Sourcefn lapic_write(&mut self, address: u64, data: &[u8])
fn lapic_write(&mut self, address: u64, data: &[u8])
Write to the current processor’s local APIC memory mapped interface.
This will only be called on an address in the page returned by
lapic_base_address
.
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.