Struct CpuMIPS

Source
pub struct CpuMIPS { /* private fields */ }
Expand description

A MIPS emulator instance.

Implementations§

Source§

impl CpuMIPS

Source

pub fn new(mode: Mode) -> Result<Self, Error>

Create an MIPS emulator instance for the specified hardware mode.

Trait Implementations§

Source§

impl Cpu for CpuMIPS

Source§

type Reg = RegisterMIPS

Source§

fn emu(&self) -> &Unicorn

Source§

fn mut_emu(&mut self) -> &mut Unicorn

Source§

fn reg_read(&self, reg: Self::Reg) -> Result<u64, Error>

Read an unsigned value from a register.
Source§

fn reg_read_i32(&self, reg: Self::Reg) -> Result<i32, Error>

Read a signed 32-bit value from a register.
Source§

unsafe fn reg_write_generic<T: Sized>( &self, reg: Self::Reg, value: T, ) -> Result<(), Error>

Write a generic type to a register.
Source§

fn reg_write(&self, reg: Self::Reg, value: u64) -> Result<(), Error>

Write an unsigned value register.
Source§

fn reg_write_i32(&self, reg: Self::Reg, value: i32) -> Result<(), Error>

Write a signed 32-bit value to a register.
Source§

fn mem_map( &self, address: u64, size: size_t, perms: Protection, ) -> Result<(), Error>

Map a memory region in the emulator at the specified address. Read more
Source§

unsafe fn mem_map_ptr<T>( &self, address: u64, size: size_t, perms: Protection, ptr: *mut T, ) -> Result<(), Error>

Map an existing memory region in the emulator at the specified address. Read more
Source§

fn mem_unmap(&self, address: u64, size: size_t) -> Result<(), Error>

Unmap a memory region. Read more
Source§

fn mem_write(&self, address: u64, bytes: &[u8]) -> Result<(), Error>

Write a range of bytes to memory at the specified address.
Source§

fn mem_read(&self, address: u64, bytes: &mut [u8]) -> Result<(), Error>

Read a range of bytes from memory at the specified address.
Source§

fn mem_read_as_vec(&self, address: u64, size: usize) -> Result<Vec<u8>, Error>

Read a range of bytes from memory at the specified address; return the bytes read as a Vec.
Source§

fn mem_protect( &self, address: u64, size: usize, perms: Protection, ) -> Result<(), Error>

Set the memory permissions for an existing memory region. Read more
Source§

fn mem_regions(&self) -> Result<Vec<MemRegion>, Error>

Returns a vector with the memory regions that are mapped in the emulator.
Source§

fn emu_start( &self, begin: u64, until: u64, timeout: u64, count: usize, ) -> Result<(), Error>

Emulate machine code for a specified duration. Read more
Source§

fn emu_stop(&self) -> Result<(), Error>

Stop the emulation. Read more
Source§

fn add_code_hook<F>( &mut self, hook_type: CodeHookType, begin: u64, end: u64, callback: F, ) -> Result<uc_hook, Error>
where F: Fn(&Unicorn, u64, u32) + 'static,

Add a code hook.
Source§

fn add_intr_hook<F>(&mut self, callback: F) -> Result<uc_hook, Error>
where F: Fn(&Unicorn, u32) + 'static,

Add an interrupt hook.
Source§

fn add_mem_hook<F>( &mut self, hook_type: MemHookType, begin: u64, end: u64, callback: F, ) -> Result<uc_hook, Error>
where F: Fn(&Unicorn, MemType, u64, usize, i64) -> bool + 'static,

Add a memory hook.
Source§

fn add_insn_in_hook<F>(&mut self, callback: F) -> Result<uc_hook, Error>
where F: Fn(&Unicorn, u32, usize) -> u32 + 'static,

Add an “in” instruction hook.
Source§

fn add_insn_out_hook<F>(&mut self, callback: F) -> Result<uc_hook, Error>
where F: Fn(&Unicorn, u32, usize, u32) + 'static,

Add an “out” instruction hook.
Source§

fn add_insn_sys_hook<F>( &mut self, insn_type: InsnSysX86, begin: u64, end: u64, callback: F, ) -> Result<uc_hook, Error>
where F: Fn(&Unicorn) + 'static,

Add a “syscall” or “sysenter” instruction hook.
Source§

fn remove_hook(&mut self, hook: uc_hook) -> Result<(), Error>

Remove a hook. Read more
Source§

fn errno(&self) -> Error

Return the last error code when an API function failed. Read more
Source§

fn query(&self, query: Query) -> Result<usize, Error>

Query the internal status of the engine. Read more
Source§

fn context_save(&self) -> Result<Context, Error>

Save the CPU context into an opaque struct.
Source§

fn context_restore(&self, context: &Context) -> Result<(), Error>

Auto Trait Implementations§

§

impl Freeze for CpuMIPS

§

impl !RefUnwindSafe for CpuMIPS

§

impl !Send for CpuMIPS

§

impl !Sync for CpuMIPS

§

impl Unpin for CpuMIPS

§

impl !UnwindSafe for CpuMIPS

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.