pub struct MemoryMapSection { /* private fields */ }

Implementations§

source§

impl MemoryMapSection

source

pub const fn new(virtual_range: Range<u64>, physical_start: u64) -> Self

Construct a MemoryMapSection for normal read/write memory access.

  • All endpoints must be aligned to 1MiB blocks (0x???0_0000).

  • virtual_range must not be empty.

  • virtual_range must be a strict subset of 0..0x1_0000_0000.

  • physical_start is of type u64, but using a large physical address (> 4GiB) isn’t supported yet.

The memory section is configured as a read/writable (but not executable) Normal memory with a Outer and Inner Write-Back, Write-Allocate attribute.

Examples
use r3_port_arm::MemoryMapSection;

// Map VA `0x2000_0000..0x2800_0000` to PA `0xc000_0000.0xc800_0000`
MemoryMapSection::new(0x2000_0000..0x2800_0000, 0xc000_0000);

This function panics if an invalid parameter is supplied.

// Empty range
MemoryMapSection::new(0x2000_0000..0x2000_0000, 0xc000_0000);
// VA is not in range `0..0x1_0000_0000`
MemoryMapSection::new(0x9000_0000..0x11000_0000, 0xc000_0000);
source

pub const fn as_device_memory(self) -> Self

Modify the memory attribute for a Device memory, returning the modified self.

source

pub const fn with_sharable(self, sharable: bool) -> Self

Change the sharability, returning the modified self.

source

pub const fn with_executable(self, executable: bool) -> Self

Change the executability, returning the modified self.

source

pub const fn with_writable(self, writable: bool) -> Self

Change the writability, returning the modified self.

Trait Implementations§

source§

impl Clone for MemoryMapSection

source§

fn clone(&self) -> MemoryMapSection

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for MemoryMapSection

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Copy for MemoryMapSection

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.