Trait EmulatorSupport

Source
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§

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 vendor(&self) -> Vendor

The processor vendor.

Source

fn gp(&mut self, index: Gp) -> u64

Read a GP

Source

fn set_gp(&mut self, reg: Gp, v: u64)

Set a GP

Source

fn rip(&mut self) -> u64

Read the instruction pointer

Source

fn set_rip(&mut self, v: u64)

Set the instruction pointer

Source

fn segment(&mut self, index: Segment) -> SegmentRegister

Read a segment register

Source

fn efer(&mut self) -> u64

Read the efer

Source

fn cr0(&mut self) -> u64

Read cr0

Source

fn rflags(&mut self) -> RFlags

Read rflags

Source

fn set_rflags(&mut self, v: RFlags)

Set rflags

Source

fn xmm(&mut self, reg: usize) -> u128

Gets the value of an XMM* register.

Source

fn set_xmm(&mut self, reg: usize, value: u128) -> Result<(), Self::Error>

Sets the value of an XMM* register.

Source

fn flush(&mut self) -> Result<(), Self::Error>

Flush registers in the emulation cache to the backing

Source

fn instruction_bytes(&self) -> &[u8]

The instruction bytes, if available.

Source

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

The physical address that caused the fault.

Source

fn initial_gva_translation(&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: HvX64PendingEvent)

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.

Source

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

Returns the page-aligned base address of the enabled local APIC in xapic mode.

Source

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.

Source

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§

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§