Struct r3_port_arm::MemoryMapSection
source · pub struct MemoryMapSection { /* private fields */ }
Implementations§
source§impl MemoryMapSection
impl MemoryMapSection
sourcepub const fn new(virtual_range: Range<u64>, physical_start: u64) -> Self
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 of0..0x1_0000_0000
. -
physical_start
is of typeu64
, 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);
sourcepub const fn as_device_memory(self) -> Self
pub const fn as_device_memory(self) -> Self
Modify the memory attribute for a Device memory, returning the modified
self
.
sourcepub const fn with_sharable(self, sharable: bool) -> Self
pub const fn with_sharable(self, sharable: bool) -> Self
Change the sharability, returning the modified self
.
sourcepub const fn with_executable(self, executable: bool) -> Self
pub const fn with_executable(self, executable: bool) -> Self
Change the executability, returning the modified self
.
sourcepub const fn with_writable(self, writable: bool) -> Self
pub const fn with_writable(self, writable: bool) -> Self
Change the writability, returning the modified self
.
Trait Implementations§
source§impl Clone for MemoryMapSection
impl Clone for MemoryMapSection
source§fn clone(&self) -> MemoryMapSection
fn clone(&self) -> MemoryMapSection
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more