Struct csx64::exec::Emulator [−][src]
Processor emulator which runs a compiled program.
Fields
memory: Memory
cpu: CPU
vpu: VPU
fpu: FPU
flags: Flags
files: 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
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]
T: 'static + ?Sized,
impl<T> Az for T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CheckedAs for T
[src]
pub fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
[src]
T: CheckedCast<Dst>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> OverflowingAs for T
[src]
pub fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
[src]
T: OverflowingCast<Dst>,
impl<T> SaturatingAs for T
[src]
pub fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
[src]
T: SaturatingCast<Dst>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> UnwrappedAs for T
[src]
pub fn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
[src]
T: UnwrappedCast<Dst>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> WrappingAs for T
[src]
pub fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
[src]
T: WrappingCast<Dst>,