Expand description
Frame (physical memory page) management.
A frame is an aligned, contiguous range of bytes in physical memory. The sizes of base frames and huge frames (that are mapped as “huge pages”) are architecture-dependent. A frame can be mapped to virtual address spaces using the page table.
Frames can be accessed through frame handles, namely, Frame
. A frame
handle is a reference-counted pointer to a frame. When all handles to a
frame are dropped, the frame is released and can be reused. Contiguous
frames are managed with Segment
.
There are various kinds of frames. The top-level grouping of frame kinds are “typed” frames and “untyped” frames. Typed frames host Rust objects that must follow the visibility, lifetime and borrow rules of Rust, thus not being able to be directly manipulated. Untyped frames are raw memory that can be manipulated directly. So only untyped frames can be
- safely shared to external entities such as device drivers or user-space applications.
- or directly manipulated with readers and writers that neglect Rust’s “alias XOR mutability” rule.
The kind of a frame is determined by the type of its metadata. Untyped
frames have its metadata type that implements the AnyUFrameMeta
trait, while typed frames don’t.
Frames can have dedicated metadata, which is implemented in the meta
module. The reference count and usage of a frame are stored in the metadata
as well, leaving the handle only a pointer to the metadata slot. Users
can create custom metadata types by implementing the AnyFrameMeta
trait.
Re-exports§
pub use allocator::GlobalFrameAllocator;
pub use segment::Segment;
Modules§
- allocator
- The physical memory allocator.
- linked_
list - Enabling linked lists of frames without heap allocation.
- meta
- Metadata management of frames.
- segment
- A contiguous range of frames.
- unique
- The unique frame pointer that is not shared with others.
- untyped
- Untyped physical memory management.