Skip to main content

Platform

Trait Platform 

Source
pub trait Platform: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn regions(&self) -> &[RegionDef];
    fn max_insn_len(&self) -> usize;
    fn decode(&self, pc: AddressValue, bytes: &[u8]) -> DecodedInsn;

    // Provided methods
    fn entry_points(&self) -> &[EntryPoint] { ... }
    fn canonicalize(
        &self,
        space: AddressSpace,
        offset: AddressValue,
    ) -> CanonicalAddr { ... }
    fn area_header(&self, space: AddressSpace) -> Option<&'static str> { ... }
}
Expand description

A processor driver: decodes bytes and declares the CPU’s address regions and known entry points.

Required Methods§

Source

fn name(&self) -> &str

A short identifier for the CPU ("i8051", "mos6502", …).

Source

fn regions(&self) -> &[RegionDef]

The address regions this CPU exposes, in emission order. May include user-defined regions.

Source

fn max_insn_len(&self) -> usize

The longest instruction in bytes, the fetch window for decoding.

Source

fn decode(&self, pc: AddressValue, bytes: &[u8]) -> DecodedInsn

Decode the instruction starting at pc from bytes (a fetch window of up to max_insn_len bytes). Returns an instruction even for unknown opcodes (with its length), mirroring the underlying decoder, the caller rejects it if it runs past bytes.

Provided Methods§

Source

fn entry_points(&self) -> &[EntryPoint]

Where the hardware begins executing: reset and interrupt vectors. These can be disabled if unused or not appropriate for a given database.

Source

fn canonicalize( &self, space: AddressSpace, offset: AddressValue, ) -> CanonicalAddr

Resolve an address to the storage it aliases (or itself if it is not an alias).

Source

fn area_header(&self, space: AddressSpace) -> Option<&'static str>

The .area header for space, if this driver declares it.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§