Skip to main content

BiosMemory

Trait BiosMemory 

Source
pub trait BiosMemory {
    // Required methods
    fn read_u8(&mut self, linear: u32) -> Option<u8>;
    fn write_u8(&mut self, linear: u32, value: u8) -> bool;
    fn read(&mut self, linear: u32, out: &mut [u8]) -> bool;
    fn write(&mut self, linear: u32, bytes: &[u8]) -> bool;
}
Expand description

Guest memory access used by the service model.

Addresses are guest-physical (linear) addresses. Every method is bounds-checked by the adapter: an unmapped or out-of-range access returns None/false and never panics.

Required Methods§

Source

fn read_u8(&mut self, linear: u32) -> Option<u8>

Reads one byte. Returns None when the address is not readable.

Source

fn write_u8(&mut self, linear: u32, value: u8) -> bool

Writes one byte. Returns false when the address is not writable.

Source

fn read(&mut self, linear: u32, out: &mut [u8]) -> bool

Reads out.len() bytes. Returns false when the range is not readable.

Source

fn write(&mut self, linear: u32, bytes: &[u8]) -> bool

Writes bytes. Returns false when the range is not writable.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§