Skip to main content

MemoryArea

Struct MemoryArea 

Source
pub struct MemoryArea<B: MappingBackend> { /* private fields */ }
Expand description

A memory area represents a continuous range of virtual memory with the same flags.

The target physical memory frames are determined by MappingBackend and may not be contiguous.

Implementations§

Source§

impl<B: MappingBackend> MemoryArea<B>

Source

pub fn try_new( start: B::Addr, size: usize, flags: B::Flags, backend: B, ) -> MappingResult<Self>

Fallible counterpart of Self::new. New code that receives untrusted address/length pairs should use this constructor so an overflow is represented as a mapping error instead of a panic.

Source

pub fn try_new_with_reported_flags( start: B::Addr, size: usize, flags: B::Flags, reported_flags: B::Flags, backend: B, ) -> MappingResult<Self>

Fallible constructor with separate operational and reported flags.

Source

pub fn new(start: B::Addr, size: usize, flags: B::Flags, backend: B) -> Self

Creates a new memory area.

§Panics

Panics if start + size overflows.

Source

pub fn new_with_reported_flags( start: B::Addr, size: usize, flags: B::Flags, reported_flags: B::Flags, backend: B, ) -> Self

Creates a new memory area with separate backend and reported flags.

flags are used for page-table/backend operations. reported_flags are metadata exposed through introspection interfaces such as procfs.

§Panics

Panics if start + size overflows.

Source

pub fn new_with_permissions( start: B::Addr, size: usize, flags: B::Flags, reported_flags: B::Flags, max_flags: B::Flags, backend: B, ) -> Self

Creates an area with an explicit maximum permission envelope.

Source

pub fn try_new_with_permissions( start: B::Addr, size: usize, flags: B::Flags, reported_flags: B::Flags, max_flags: B::Flags, backend: B, ) -> MappingResult<Self>

Fallible constructor with an explicit maximum permission envelope.

This is the constructor used at syscall boundaries. The older infallible constructors remain available for trusted boot-time mappings, but user supplied start + size pairs must not be allowed to wrap through AddrRange::from_start_size.

Source

pub const fn va_range(&self) -> AddrRange<B::Addr>

Returns the virtual address range.

Source

pub const fn flags(&self) -> B::Flags

Returns the memory flags, e.g., the permission bits.

Source

pub const fn reported_flags(&self) -> B::Flags

Returns the permission flags reported to user-visible introspection.

Source

pub const fn max_flags(&self) -> B::Flags

Returns the maximum permissions retained for this mapping.

Source

pub const fn start(&self) -> B::Addr

Returns the start address of the memory area.

Source

pub const fn end(&self) -> B::Addr

Returns the end address of the memory area.

Source

pub fn size(&self) -> usize

Returns the size of the memory area.

Source

pub const fn backend(&self) -> &B

Returns the mapping backend of the memory area.

Trait Implementations§

Source§

impl<B: Clone + MappingBackend> Clone for MemoryArea<B>
where B::Addr: Clone, B::Flags: Clone,

Source§

fn clone(&self) -> MemoryArea<B>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<B: MappingBackend> Debug for MemoryArea<B>
where B::Addr: Debug, B::Flags: Debug + Copy,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.