Skip to main content

Module memory

Module memory 

Source

Re-exportsΒ§

use crate::boot::entry::MemoryRegion; πŸ”’
use crate::capability::CapId; πŸ”’
use crate::process::get_task_by_pid; πŸ”’
use crate::sync::IrqDisabledToken; πŸ”’
use core::sync::atomic::AtomicU64; πŸ”’
use core::sync::atomic::AtomicUsize; πŸ”’
use core::sync::atomic::Ordering; πŸ”’
use spin::Once; πŸ”’
pub use crate::sync::with_irqs_disabled;
pub use address_space::kernel_address_space;
pub use address_space::AddressSpace;
pub use address_space::EffectiveMapping;
pub use address_space::VmaFlags;
pub use address_space::VmaPageSize;
pub use address_space::VmaType;
pub use block::BlockHandle;
pub use block::BuddyReserved;
pub use block::Exclusive;
pub use block::MappedExclusive;
pub use block::MappedShared;
pub use block::PhysBlock;
pub use block::Released;
pub use block_meta::get_block_meta;
pub use block_meta::resolve_handle;
pub use buddy::buddy_alloc_fail_counts_snapshot;
pub use buddy::get_allocator;
pub use buddy::poison_quarantine_pages_snapshot;
pub use frame::block_phys_has_poison_guard;
pub use frame::frame_meta_debug_snapshot;
pub use frame::get_meta;
pub use frame::get_meta_slot;
pub use frame::invoke_vtable_on_last_ref;
pub use frame::invoke_vtable_on_unmap;
pub use frame::meta_generation_matches;
pub use frame::meta_guard;
pub use frame::AllocError;
pub use frame::FrameAllocOptions;
pub use frame::FrameAllocator;
pub use frame::FrameMeta;
pub use frame::FrameMetaVtable;
pub use frame::FramePurpose;
pub use frame::MetaSlot;
pub use frame::PhysFrame;
pub use frame::DEFAULT_FRAME_META_VTABLE;
pub use frame::META_SLOT_REFCOUNT_BYTE_OFFSET;
pub use mapping_index::MappingIndex;
pub use mapping_index::MappingRef;
pub use ownership::BlockState;
pub use ownership::OwnerEntry;
pub use ownership::OwnerError;
pub use ownership::OwnershipTable;
pub use ownership::RemoveRefResult;
pub use region_cap::MemoryRegionRegistry;
pub use region_cap::PublicMemoryRegionInfo;
pub use region_cap::RegionCapError;
pub use region_cap::ReleaseRegionResult;
pub use userslice::UserSliceError;
pub use userslice::UserSliceRead;
pub use userslice::UserSliceReadWrite;
pub use userslice::UserSliceWrite;

ModulesΒ§

address_space
Per-process address spaces for Strat9-OS.
block
Block-oriented physical memory handles.
block_meta
Compatibility layer for the block-oriented metadata API.
boot_alloc
Allocateur physique de boot pour les structures permanentes du noyau.
buddy
cow
Copy-on-Write (COW) support for fork()
frame
Physical frame allocator abstraction.
heap
mapping_index
Reverse mapping index for memory capabilities.
ownership
Central ownership tracking for physical blocks.
paging
Virtual Memory Management (Paging) for Strat9-OS
physical_access
Architecture aware access to physical RAM.
region_cap
Public memory-region capability registry.
typed_mem
Named typed-memory objects.
userslice
Userspace pointer validation for Strat9-OS.
vmalloc
VM-backed allocator for large heap objects.
zone

StructsΒ§

PhysContiguousDiag
Snapshot of contiguous-physical-allocation telemetry.

StaticsΒ§

CONTIGUOUS_ALLOC_FAIL_COUNT πŸ”’
Total failed contiguous allocation attempts (fragmentation indicator).
CONTIGUOUS_ALLOC_PAGES πŸ”’
Total pages handed out by allocate_phys_contiguous (in units of 4 KiB pages, summed across orders).
CONTIGUOUS_FREE_PAGES πŸ”’
Total pages returned via free_phys_contiguous.
GLOBAL_MAPPING_INDEX πŸ”’
HHDM_OFFSET πŸ”’
Higher Half Direct Map offset. Set by UEFI bootloader entry (non-zero) or left at 0 for BIOS/identity-mapped boot. All physical-to-virtual conversions must add this offset.
MEMORY_REGION_REGISTRY πŸ”’
OWNERSHIP_TABLE πŸ”’

FunctionsΒ§

allocate_frame
Allocate a single zeroed physical frame with KernelData purpose.
allocate_frame_for_purpose
Allocate a single zeroed 4 KiB frame for an explicit purpose.
allocate_framesDeprecated
Allocate 2^order contiguous physical frames (raw, no zeroing).
allocate_kernel_stack_frames
Allocate physically contiguous pages for a kernel stack.
allocate_kernel_virtual
Allocate virtually contiguous kernel memory backed by fragmented physical pages.
allocate_mapping_cap_id
Allocates a fresh internal mapping capability identifier.
allocate_phys_contiguous πŸ”’
Allocate a physically contiguous block of 2^order pages.
allocate_user_frame
Allocate a single zeroed 4 KiB frame intended for user-space memory.
allocate_zeroed_frame
Allocate a single zeroed 4 KiB frame.
free_frame
Free a single physical frame. Requires an IrqDisabledToken proving that IRQs are disabled on the calling CPU. The caller must ensure that the frame is not currently mapped anywhere and that the buddy allocator’s internal metadata is consistent with the frame’s state (e.g. refcount = 0). Prefer free_frames() for multi-frame blocks or when the buddy allocator’s internal state may need to be updated. This raw path is kept for symmetry with allocate_frames() and for special cases where the caller manages zeroing and metadata explicitly. For standard single-frame deallocation, prefer release_owned_block() which also handles ownership table updates and safety checks.
free_framesDeprecated
Free 2^order contiguous physical frames.
free_kernel_stack_frames
Free pages previously returned by allocate_kernel_stack_frames.
free_kernel_virtual
Free memory previously returned by allocate_kernel_virtual.
free_phys_contiguous πŸ”’
Free a physically contiguous block previously returned by allocate_phys_contiguous.
hhdm_offset
Get the current HHDM offset
init_cow_subsystem
Initialize copy-on-write metadata.
init_memory_manager
Initialize the memory management subsystem
invalidate_local_page
Invalidate a local translation-cache entry through the architecture ABI.
mapping_index
Returns the global reverse mapping index used by the memory runtime.
memory_region_registry
Returns the global public memory-region registry.
ownership_table
Returns the global ownership table used by the memory runtime.
phys_contiguous_diag
Read current contiguous-allocation telemetry without locking.
phys_to_virt
Convert a physical address to a virtual address using the HHDM offset
register_mapping_identity
Records that cap_id now names handle in the ownership table.
release_owned_block
Releases a block back to the buddy allocator.
revoke_mapping_cap_id
Revokes every live mapping associated with cap_id.
set_hhdm_offset
Store the HHDM offset (call once, early in boot)
shootdown_range
Invalidate a virtual-address range on all CPUs through the architecture ABI.
try_register_mapping_identity
Fallible variant of mapping identity registration for transactional callers.
unregister_mapping_identity
Removes cap_id from the ownership table entry associated with handle.
virt_to_phys
Convert a virtual address back to a physical address (reverse of phys_to_virt)