pub struct SharedRegion { /* private fields */ }Expand description
Shared memory region descriptor
Implementations§
Sourcepub fn new(
owner: ProcessId,
size: usize,
_permissions: Permission,
) -> Result<Self>
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.
Sourcepub fn new_with_policy(
owner: ProcessId,
size: usize,
cache_policy: CachePolicy,
numa_node: Option<u32>,
) -> Result<Self>
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.
Sourcepub fn physical_base(&self) -> PhysicalAddress
pub fn physical_base(&self) -> PhysicalAddress
Get the physical base address of the backing memory
Sourcepub fn map(
&self,
process: ProcessId,
virtual_base: VirtualAddress,
permissions: Permission,
) -> Result<()>
pub fn map( &self, process: ProcessId, virtual_base: VirtualAddress, permissions: Permission, ) -> Result<()>
Map region into a process address space
Sourcepub fn unmap(&self, process: ProcessId) -> Result<()>
pub fn unmap(&self, process: ProcessId) -> Result<()>
Unmap region from a process and flush the TLB for the affected range.
Sourcepub fn transfer_ownership(&mut self, new_owner: ProcessId) -> Result<()>
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.
Sourcepub fn get_mapping(&self, process: ProcessId) -> Option<VirtualAddress>
pub fn get_mapping(&self, process: ProcessId) -> Option<VirtualAddress>
Get virtual address for a specific process
Sourcepub fn create_capability(
&self,
target_process: ProcessId,
mode: TransferMode,
) -> u64
pub fn create_capability( &self, target_process: ProcessId, mode: TransferMode, ) -> u64
Create a capability for this shared region
Sourcepub fn new_numa(
owner: ProcessId,
size: usize,
_permissions: Permission,
numa_node: usize,
) -> Result<Self>
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.