Skip to main content

JitRuntime

Struct JitRuntime 

Source
pub struct JitRuntime<L>
where L: Fn(&GuestMemory, u64) -> Result<Nnil, Box<dyn Error>>,
{ /* private fields */ }
Expand description

Uses a lifting callback so this crate does not depend on a specific guest architecture crate.

Implementations§

Source§

impl<L> JitRuntime<L>
where L: Fn(&GuestMemory, u64) -> Result<Nnil, Box<dyn Error>>,

Source

pub fn new( program: ProgramImage, lift_region: L, ) -> Result<Self, Box<dyn Error>>

Creates a runtime with default guest-process settings and the local output directory.

Source

pub fn init_runtime( program: ProgramImage, process: RemuConfig, jit_output_dir: PathBuf, lift_region: L, ) -> Result<Self, Box<dyn Error>>

Maps the program and optional interpreter, then builds Linux process startup state.

Source

pub fn cache_len(&self) -> usize

Returns the number of guest entry PCs that have native code.

Source

pub fn program(&self) -> &ProgramImage

Borrows parsed program data without giving permission to change runtime mappings.

Source

pub fn state(&self) -> &GuestState

Borrows guest registers and stop data for inspection.

Source

pub fn state_mut(&mut self) -> &mut GuestState

Gives controlled callers direct access to guest registers and the PC.

Source

pub fn memory(&self) -> &GuestMemory

Borrows guest memory for reads and mapping inspection.

Source

pub fn memory_mut(&mut self) -> &mut GuestMemory

Borrows guest memory for changes and first refreshes its generated-code view.

Source

pub fn set_entry_pc(&mut self, pc: u64)

Changes both reset entry and current execution entry to keep them consistent.

Source

pub fn set_verbose(&mut self, verbose: bool)

Enables compiler, dispatch, and syscall diagnostics for manual investigation.

Source

pub fn process_config(&self) -> &RemuConfig

Exposes the normalized roots and JIT options that this runtime uses.

Source

pub fn pause_flag(&self) -> Arc<AtomicBool>

Clones the shared pause handle so another thread can stop generated code safely.

Source

pub fn add_breakpoint(&mut self, address: u64) -> Result<(), &'static str>

Adds one guest block-entry address to the generated-code breakpoint table.

Source

pub fn remove_breakpoint(&mut self, address: u64)

Removes all copies of an address and keeps the active prefix compact.

Source

pub fn clear_breakpoints(&mut self)

Hides all saved array values by setting the active count to zero.

Source

pub fn breakpoints(&self) -> &[u64]

Returns only the active sorted prefix, not unused fixed-array slots.

Source

pub fn trace(&self) -> Vec<u64>

Returns the retained block-entry trace in execution order for debugger output.

Source

pub fn last_syscall(&self) -> Option<[u64; 8]>

Returns the last syscall register record for debugger and fuzzer diagnostics.

Source

pub fn lift_at(&self, pc: u64) -> Result<Nnil, Box<dyn Error>>

Runs the architecture callback without compiling or changing the JIT cache.

Source

pub fn snapshot(&mut self) -> Result<RuntimeSnapshot, Box<dyn Error>>

Captures guest-visible mutable state so one runtime can replay from this point.

Source

pub fn restore( &mut self, snapshot: &RuntimeSnapshot, ) -> Result<(), Box<dyn Error>>

Restores process data but keeps compiled native blocks for fast replay.

Source

pub fn reset(&mut self) -> Result<(), Box<dyn Error>>

Restores the snapshot that was made after initial process setup.

Source

pub fn precompile(&mut self) -> Result<usize, Box<dyn Error>>

Compiles a linear walk from the entry to reduce lazy JIT stops during startup.

Source

pub fn run(&mut self) -> Result<ExitReason, Box<dyn Error>>

Runs until the guest exits, faults, makes an unsupported call, or requests a stop.

Source

pub fn run_for_blocks( &mut self, limit: u64, ) -> Result<ExitReason, Box<dyn Error>>

Runs at most limit translated blocks so a debugger can step or stay responsive.

Auto Trait Implementations§

§

impl<L> !Send for JitRuntime<L>

§

impl<L> !Sync for JitRuntime<L>

§

impl<L> Freeze for JitRuntime<L>
where L: Freeze,

§

impl<L> RefUnwindSafe for JitRuntime<L>
where L: RefUnwindSafe,

§

impl<L> Unpin for JitRuntime<L>
where L: Unpin,

§

impl<L> UnsafeUnpin for JitRuntime<L>
where L: UnsafeUnpin,

§

impl<L> UnwindSafe for JitRuntime<L>
where L: UnwindSafe,

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.