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§
Sourcefn regions(&self) -> &[RegionDef]
fn regions(&self) -> &[RegionDef]
The address regions this CPU exposes, in emission order. May include user-defined regions.
Sourcefn max_insn_len(&self) -> usize
fn max_insn_len(&self) -> usize
The longest instruction in bytes, the fetch window for decoding.
Sourcefn decode(&self, pc: AddressValue, bytes: &[u8]) -> DecodedInsn
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§
Sourcefn entry_points(&self) -> &[EntryPoint]
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.
Sourcefn canonicalize(
&self,
space: AddressSpace,
offset: AddressValue,
) -> CanonicalAddr
fn canonicalize( &self, space: AddressSpace, offset: AddressValue, ) -> CanonicalAddr
Resolve an address to the storage it aliases (or itself if it is not an alias).
Sourcefn area_header(&self, space: AddressSpace) -> Option<&'static str>
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".