pub trait Cpu {
type Error;
Show 17 methods
// Required methods
fn read_memory(
&mut self,
gva: u64,
bytes: &mut [u8],
is_user_mode: bool,
) -> impl Future<Output = Result<(), Self::Error>>;
fn write_memory(
&mut self,
gva: u64,
bytes: &[u8],
is_user_mode: bool,
) -> impl Future<Output = Result<(), Self::Error>>;
fn compare_and_write_memory(
&mut self,
gva: u64,
current: &[u8],
new: &[u8],
is_user_mode: bool,
) -> impl Future<Output = Result<bool, Self::Error>>;
fn read_io(
&mut self,
io_port: u16,
bytes: &mut [u8],
) -> impl Future<Output = Result<(), Self::Error>>;
fn write_io(
&mut self,
io_port: u16,
bytes: &[u8],
) -> impl Future<Output = Result<(), Self::Error>>;
fn gp(&mut self, reg: RegisterIndex) -> u64;
fn gp_sign_extend(&mut self, reg: RegisterIndex) -> i64;
fn set_gp(&mut self, reg: RegisterIndex, v: u64);
fn xmm(&mut self, index: usize) -> u128;
fn set_xmm(&mut self, index: usize, v: u128) -> Result<(), Self::Error>;
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);
}
Expand description
Trait for asynchronous callouts from the emulator to the VM.
Required Associated Types§
Required Methods§
Sourcefn read_memory(
&mut self,
gva: u64,
bytes: &mut [u8],
is_user_mode: bool,
) -> impl Future<Output = Result<(), Self::Error>>
fn read_memory( &mut self, gva: u64, bytes: &mut [u8], is_user_mode: bool, ) -> impl Future<Output = Result<(), Self::Error>>
Performs a memory read of 1, 2, 4, or 8 bytes.
Sourcefn write_memory(
&mut self,
gva: u64,
bytes: &[u8],
is_user_mode: bool,
) -> impl Future<Output = Result<(), Self::Error>>
fn write_memory( &mut self, gva: u64, bytes: &[u8], is_user_mode: bool, ) -> impl Future<Output = Result<(), Self::Error>>
Performs a memory write of 1, 2, 4, or 8 bytes.
Sourcefn compare_and_write_memory(
&mut self,
gva: u64,
current: &[u8],
new: &[u8],
is_user_mode: bool,
) -> impl Future<Output = Result<bool, Self::Error>>
fn compare_and_write_memory( &mut self, gva: u64, current: &[u8], new: &[u8], is_user_mode: bool, ) -> impl Future<Output = Result<bool, Self::Error>>
Performs an atomic, sequentially-consistent compare exchange on a memory location.
The caller has already fetched current
via read_memory
, so the
implementor only needs to perform an atomic compare+write if the memory
could have mutated concurrently and supports atomic operation. This
includes ordinary RAM, but does not include device registers.
Returns true
if the exchange succeeded, false
otherwise.
Sourcefn read_io(
&mut self,
io_port: u16,
bytes: &mut [u8],
) -> impl Future<Output = Result<(), Self::Error>>
fn read_io( &mut self, io_port: u16, bytes: &mut [u8], ) -> impl Future<Output = Result<(), Self::Error>>
Performs an io read of 1, 2, or 4 bytes.
Sourcefn write_io(
&mut self,
io_port: u16,
bytes: &[u8],
) -> impl Future<Output = Result<(), Self::Error>>
fn write_io( &mut self, io_port: u16, bytes: &[u8], ) -> impl Future<Output = Result<(), Self::Error>>
Performs an io write of 1, 2, or 4 bytes.
fn gp(&mut self, reg: RegisterIndex) -> u64
fn gp_sign_extend(&mut self, reg: RegisterIndex) -> i64
fn set_gp(&mut self, reg: RegisterIndex, v: u64)
fn xmm(&mut self, index: usize) -> u128
fn set_xmm(&mut self, index: usize, v: u128) -> Result<(), Self::Error>
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)
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.