Struct csx64::exec::Emulator[][src]

pub struct Emulator {
    pub memory: Memory,
    pub cpu: CPU,
    pub vpu: VPU,
    pub fpu: FPU,
    pub flags: Flags,
    pub files: Files,
    // some fields omitted
}

Processor emulator which runs a compiled program.

Fields

memory: Memorycpu: CPUvpu: VPUfpu: FPUflags: Flagsfiles: Files

Implementations

impl Emulator[src]

pub fn new() -> Emulator[src]

Creates a new emulator in the uninitialized state.

pub fn init(&mut self, exe: &Executable, args: &EmulatorArgs)[src]

Initializes the emulator to run the provided executable. stack_size, if provided, specifies the amount of stack memory to provide; if this is None then DEFAULT_STACK_SIZE is used. args denotes the command line arguments to provide to the program. These will be copied into the emulator’s memory as null-terminated binary arrays (presumably C-style strings) for it to access.

Note: as a safety precaution, this function also clears all privileged flags from the flags register. This includes disabling filesystem syscalls, among other things. If these features are needed, they must be set enabled again after initialization is completed. To avoid errors in the emulated program, this should be done prior to running the program and ideally not be revoked mid-execution.

pub fn get_state(&self) -> State[src]

Gets the current state of the emulator.

pub fn execute_cycles(&mut self, cycles: u64) -> (u64, StopReason)[src]

Resumes execution of the emulator for up to the given number of cycles. Returns the number of cycles executed and the reason for stopping.

pub fn push_mem(&mut self, value: &[u8]) -> Result<(), ExecError>[src]

Pushes a binary value onto the stack. Similar to using set_mem except that it also checks for stack overflow. On failur, the internal state is unmodified.

pub fn pop_mem(&mut self, len: u64) -> Result<&[u8], ExecError>[src]

Pops a binary value from the stack. Returns a reference to the (logically) removed block of memory.

pub fn push_mem_u8(&mut self, val: u8) -> Result<(), ExecError>[src]

pub fn pop_mem_u8(&mut self) -> Result<u8, ExecError>[src]

pub fn push_mem_u16(&mut self, val: u16) -> Result<(), ExecError>[src]

pub fn pop_mem_u16(&mut self) -> Result<u16, ExecError>[src]

pub fn push_mem_u32(&mut self, val: u32) -> Result<(), ExecError>[src]

pub fn pop_mem_u32(&mut self) -> Result<u32, ExecError>[src]

pub fn push_mem_u64(&mut self, val: u64) -> Result<(), ExecError>[src]

pub fn pop_mem_u64(&mut self) -> Result<u64, ExecError>[src]

pub fn push_mem_i8(&mut self, val: i8) -> Result<(), ExecError>[src]

pub fn pop_mem_i8(&mut self) -> Result<i8, ExecError>[src]

pub fn push_mem_i16(&mut self, val: i16) -> Result<(), ExecError>[src]

pub fn pop_mem_i16(&mut self) -> Result<i16, ExecError>[src]

pub fn push_mem_i32(&mut self, val: i32) -> Result<(), ExecError>[src]

pub fn pop_mem_i32(&mut self) -> Result<i32, ExecError>[src]

pub fn push_mem_i64(&mut self, val: i64) -> Result<(), ExecError>[src]

pub fn pop_mem_i64(&mut self) -> Result<i64, ExecError>[src]

pub fn push_mem_f32(&mut self, val: f32) -> Result<(), ExecError>[src]

pub fn pop_mem_f32(&mut self) -> Result<f32, ExecError>[src]

pub fn push_mem_f64(&mut self, val: f64) -> Result<(), ExecError>[src]

pub fn pop_mem_f64(&mut self) -> Result<f64, ExecError>[src]

pub fn push_mem_f80(&mut self, val: F80) -> Result<(), ExecError>[src]

pub fn pop_mem_f80(&mut self) -> Result<F80, ExecError>[src]

Trait Implementations

impl Default for Emulator[src]

Auto Trait Implementations

impl RefUnwindSafe for Emulator

impl !Send for Emulator

impl !Sync for Emulator

impl Unpin for Emulator

impl UnwindSafe for Emulator

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Az for T[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CheckedAs for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> OverflowingAs for T[src]

impl<T> SaturatingAs for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> UnwrappedAs for T[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WrappingAs for T[src]