Memory

Struct Memory 

Source
pub struct Memory { /* private fields */ }
Expand description

An efficient implementation of main memory.

Implementations§

Source§

impl Memory

Source

pub fn new<'d>(data: &'d mut [u64]) -> &'d mut Memory

Converts a slice to be used as memory for a hart.

Source

pub const fn size(&self) -> usize

Gets the size of memory in bytes.

Source

pub fn data(&mut self) -> &mut [u8]

Gets a reference to the inner data. You cannot get an immutable reference, since &u8 is Send+Sync, while &Memory is not. In other words, an immutable reference to the slice obtained through some other way than this method would invoke undefined behavior.

Trait Implementations§

Source§

impl Bus<u64, u16> for Memory

Source§

fn load(&self, address: u64) -> Result<u16, BusError>

Loads the value located at the given address.
Source§

fn store(&self, address: u64, value: u16) -> Result<(), BusError>

Stores the given value to the given address.
Source§

impl Bus<u64, u32> for Memory

Source§

fn load(&self, address: u64) -> Result<u32, BusError>

Loads the value located at the given address.
Source§

fn store(&self, address: u64, value: u32) -> Result<(), BusError>

Stores the given value to the given address.
Source§

impl Bus<u64, u64> for Memory

Source§

fn load(&self, address: u64) -> Result<u64, BusError>

Loads the value located at the given address.
Source§

fn store(&self, address: u64, value: u64) -> Result<(), BusError>

Stores the given value to the given address.
Source§

impl Bus<u64, u8> for Memory

Source§

fn load(&self, address: u64) -> Result<u8, BusError>

Loads the value located at the given address.
Source§

fn store(&self, address: u64, value: u8) -> Result<(), BusError>

Stores the given value to the given address.

Auto Trait Implementations§

§

impl Freeze for Memory

§

impl RefUnwindSafe for Memory

§

impl !Send for Memory

§

impl !Sized for Memory

§

impl !Sync for Memory

§

impl Unpin for Memory

§

impl UnwindSafe for Memory

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