pub struct NativeCpu { /* private fields */ }Expand description
Native CPU state arena and guest memory owner.
v86’s scalar CPU state uses the first 4 KiB of the arena. The guest RAM is allocated by the core memory module and addressed with 32-bit guest physical addresses, matching the original emulator model.
Implementations§
Source§impl NativeCpu
impl NativeCpu
pub fn new(ram_bytes: u32, vga_bytes: u32) -> Self
pub fn ram_bytes(&self) -> u32
pub fn vga_bytes(&self) -> u32
pub fn step(&mut self, max_instructions: u32) -> u32
pub fn read_memory(&self, address: u32, output: &mut [u8]) -> bool
pub fn write_memory(&mut self, address: u32, input: &[u8]) -> bool
pub fn instruction_pointer(&self) -> u32
pub fn halted(&self) -> bool
pub fn state_arena(&self) -> &[u8; 4096]
Sourcepub fn vga_text_snapshot(&self) -> Option<(u32, u32, Vec<u8>)>
pub fn vga_text_snapshot(&self) -> Option<(u32, u32, Vec<u8>)>
Return the restored SVGA framebuffer as packed RGB bytes. The native runtime keeps the framebuffer in the same guest-visible backing store used by v86’s LFB mapping.
pub fn vga_framebuffer_rgb(&self) -> Option<(u32, u32, Vec<u8>)>
pub fn set_9p_root(&mut self, path: impl AsRef<Path>) -> Result<(), String>
Source§impl NativeCpu
impl NativeCpu
Sourcepub fn restore_v86_state(
&mut self,
state: &Value,
buffers: &[Vec<u8>],
) -> Result<(), String>
pub fn restore_v86_state( &mut self, state: &Value, buffers: &[Vec<u8>], ) -> Result<(), String>
Restore the CPU scalar state and packed RAM representation from the decoded v86 state object. Device arrays are intentionally left to the outer native device graph, but CPU execution can continue after this method completes.
Auto Trait Implementations§
impl Freeze for NativeCpu
impl RefUnwindSafe for NativeCpu
impl Send for NativeCpu
impl Sync for NativeCpu
impl Unpin for NativeCpu
impl UnsafeUnpin for NativeCpu
impl UnwindSafe for NativeCpu
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more