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

SharedRegion

Struct SharedRegion 

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

Shared memory region descriptor

Implementations§

Source§

impl SharedRegion

Source

pub fn new( owner: ProcessId, size: usize, _permissions: Permission, ) -> Result<Self>

Create a new shared memory region (convenience wrapper).

Returns an error if physical memory cannot be allocated for the region.

Source

pub fn new_with_policy( owner: ProcessId, size: usize, cache_policy: CachePolicy, numa_node: Option<u32>, ) -> Result<Self>

Create a new shared memory region backed by real physical frames.

Allocates contiguous physical frames from the global frame allocator to back the shared region. Returns IpcError::OutOfMemory if the allocation fails.

Source

pub fn id(&self) -> u64

Get region ID

Source

pub fn size(&self) -> usize

Get region size

Source

pub fn physical_base(&self) -> PhysicalAddress

Get the physical base address of the backing memory

Source

pub fn map( &self, process: ProcessId, virtual_base: VirtualAddress, permissions: Permission, ) -> Result<()>

Map region into a process address space

Source

pub fn unmap(&self, process: ProcessId) -> Result<()>

Unmap region from a process and flush the TLB for the affected range.

Source

pub fn transfer_ownership(&mut self, new_owner: ProcessId) -> Result<()>

Transfer ownership of region to another process.

Validates that the target process exists before transferring.

Source

pub fn get_mapping(&self, process: ProcessId) -> Option<VirtualAddress>

Get virtual address for a specific process

Source

pub fn create_capability( &self, target_process: ProcessId, mode: TransferMode, ) -> u64

Create a capability for this shared region

Source

pub fn numa_node(&self) -> usize

Get the NUMA node for this region

Source

pub fn new_numa( owner: ProcessId, size: usize, _permissions: Permission, numa_node: usize, ) -> Result<Self>

Create a new shared memory region with specific NUMA node.

Returns an error if physical memory cannot be allocated for the region.

Trait Implementations§

Source§

impl Debug for SharedRegion

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for SharedRegion

§

impl !RefUnwindSafe for SharedRegion

§

impl Send for SharedRegion

§

impl Sync for SharedRegion

§

impl Unpin for SharedRegion

§

impl UnwindSafe for SharedRegion

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.