Skip to main content

NativeBackend

Struct NativeBackend 

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

Native x86 interpreter backend backed by the Rust port of v86’s CPU core.

The current adapter is deliberately single-machine: the v86 CPU core uses process-global pointers, so two NativeBackend instances must not execute at the same time in one process.

Implementations§

Source§

impl NativeBackend

Source

pub fn new() -> Self

Source

pub fn with_instructions_per_step(self, value: u32) -> Self

Source

pub fn cpu(&self) -> Option<&NativeCpu>

Source

pub fn cpu_mut(&mut self) -> Option<&mut NativeCpu>

Source

pub fn with_9p_root(self, path: impl AsRef<Path>) -> Self

Source

pub fn set_9p_root(&mut self, path: impl AsRef<Path>) -> Result<()>

Trait Implementations§

Source§

impl Default for NativeBackend

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl ExecutionBackend for NativeBackend

Source§

fn reset(&mut self, config: &MachineConfig) -> Result<()>

Source§

fn restore_state(&mut self, state: &SavedState) -> Result<()>

Restore an attached v86 saved state after reset. Backends that do not support saved states may keep the default no-op implementation.
Source§

fn step(&mut self) -> Result<bool>

Source§

fn read_memory(&self, address: u64, buffer: &mut [u8]) -> Result<()>

Source§

fn write_memory(&mut self, address: u64, data: &[u8]) -> Result<()>

Source§

fn vga_framebuffer_rgb(&self) -> Option<(u32, u32, Vec<u8>)>

Return the current guest framebuffer as packed RGB bytes when the backend exposes a graphical VGA mode.
Source§

fn inject_text(&mut self, text: &str) -> Result<usize>

Queue host text as guest keyboard input when supported by the backend.

Auto Trait Implementations§

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> Same for T

Source§

type Output = T

Should always be Self
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.