Function frame_allocator::init
source · pub fn init<F, R, P>(
free_physical_memory_areas: F,
reserved_physical_memory_areas: R
) -> Result<fn(_: FrameRange) -> UnmappedFrames, &'static str>where
P: Borrow<PhysicalMemoryRegion>,
F: IntoIterator<Item = P>,
R: IntoIterator<Item = P> + Clone,
Expand description
Initialize the frame allocator with the given list of available and reserved physical memory regions.
Any regions in either of the lists may overlap, this is checked for and handled properly. Reserved regions take priority – if a reserved region partially or fully overlaps any part of a free region, that portion will be considered reserved, not free.
The iterator (R
) over reserved physical memory regions must be cloneable,
as this runs before heap allocation is available, and we may need to iterate over it multiple times.
Return
Upon success, this function returns a callback function that allows the caller
(the memory subsystem init function) to convert a range of unmapped frames
back into an UnmappedFrames
object.