Skip to main content

RomMemory

Trait RomMemory 

Source
pub trait RomMemory {
    // Required methods
    fn write(&mut self, linear: u32, bytes: &[u8]) -> bool;
    fn read(&mut self, linear: u32, out: &mut [u8]) -> bool;

    // Provided methods
    fn write_u16(&mut self, linear: u32, value: u16) -> bool { ... }
    fn write_u32(&mut self, linear: u32, value: u32) -> bool { ... }
}
Expand description

Minimal guest low-memory access used by the install helpers.

The real guest memory implementation lives in the kernel loader; tests use a flat Vec<u8>. Addresses are guest-physical (linear) addresses.

Required Methods§

Source

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

Writes bytes at linear. Returns false when the range is not writable or not mapped.

Source

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

Reads out.len() bytes from linear. Returns false when the range is not readable or not mapped.

Provided Methods§

Source

fn write_u16(&mut self, linear: u32, value: u16) -> bool

Writes a little-endian u16 at linear.

Source

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

Writes a little-endian u32 at linear.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§