Skip to main content

Module memobj

Module memobj 

Source
Expand description

Memory objects (IPC ABI v2, Β§9.1).

A MemObject owns zeroed frames registered in the frame ownership table (the SharedRing machinery). Lifetime is reference-counted per frame:

  • the object holds one owner reference per frame, dropped with the last handle;
  • every SYS_MEMOBJ_MAP mapping registers a fresh mapping identity per page, dropped by munmap or address-space teardown.

A frame returns to the allocator only when both kinds of reference are gone, so closing every handle while a mapping exists (or the reverse) can never expose a freed frame.

Accounting: the backing is charged to the creator’s silo at creation (released with the object). Each mapping is additionally charged as a virtual region to the mapping silo, like every other mapping, because munmap and address-space teardown always refund the mapping length: an uncharged (AlreadyCharged) mapping would make that refund credit bytes that were never charged.

Re-exportsΒ§

use super::quota::MemCharge; πŸ”’
use crate::ipc::shared_ring; πŸ”’
use crate::ipc::shared_ring::SharedRing; πŸ”’
use crate::memory::address_space::AddressSpace; πŸ”’
use crate::memory::address_space::SiloCharge; πŸ”’
use crate::memory::address_space::VmaFlags; πŸ”’
use crate::memory::address_space::VmaPageSize; πŸ”’
use crate::memory::address_space::VmaType; πŸ”’
use crate::syscall::error::SyscallError; πŸ”’
use alloc::vec::Vec; πŸ”’
use strat9_abi::ipc_v2::MEMOBJ_MAX_SIZE; πŸ”’
use strat9_abi::ipc_v2::MEMOBJ_PROT_EXEC; πŸ”’
use strat9_abi::ipc_v2::MEMOBJ_PROT_READ; πŸ”’
use strat9_abi::ipc_v2::MEMOBJ_PROT_WRITE; πŸ”’
use strat9_abi::ipc_v2::MEM_EXEC; πŸ”’
use strat9_abi::ipc_v2::MEM_READ; πŸ”’
use strat9_abi::ipc_v2::MEM_WRITE; πŸ”’

StructsΒ§

MemObject
A shareable, mappable memory object.

ConstantsΒ§

PAGE πŸ”’

FunctionsΒ§

page_round
Validate a requested size and round it up to whole pages.