⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

MemoryRegion

Struct MemoryRegion 

Source
pub struct MemoryRegion {
    pub start: VirtualAddress,
    pub end: VirtualAddress,
    pub region_type: MemoryRegionType,
    pub flags: PageFlags,
    pub physical_pages: Option<Vec<PhysicalAddress>>,
    pub file_mapping: Option<FileMapping>,
}
Expand description

Memory region in a process’s address space

Fields§

§start: VirtualAddress

Starting virtual address

§end: VirtualAddress

Ending virtual address (exclusive)

§region_type: MemoryRegionType

Region type

§flags: PageFlags

Access permissions

§physical_pages: Option<Vec<PhysicalAddress>>

Physical pages backing this region (if any)

§file_mapping: Option<FileMapping>

File mapping info (if mapped file)

Implementations§

Source§

impl MemoryRegion

Source

pub fn new( start: VirtualAddress, size: usize, region_type: MemoryRegionType, flags: PageFlags, ) -> Self

Create a new memory region

Source

pub fn size(&self) -> usize

Get region size

Source

pub fn contains(&self, addr: VirtualAddress) -> bool

Check if address is within this region

Source

pub fn overlaps(&self, other: &MemoryRegion) -> bool

Check if region overlaps with another

Trait Implementations§

Source§

impl Debug for MemoryRegion

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for MemoryRegion

§

impl RefUnwindSafe for MemoryRegion

§

impl Send for MemoryRegion

§

impl Sync for MemoryRegion

§

impl Unpin for MemoryRegion

§

impl UnwindSafe for MemoryRegion

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.