Expand description
A free-list-based page/frame allocator.
The main type of this crate is FreeList
, which allocates PageRange
s.
§Examples
use free_list::{FreeList, PageLayout};
let mut free_list = FreeList::<16>::new();
unsafe {
free_list.deallocate((0x1000..0x5000).try_into().unwrap()).unwrap();
}
assert_eq!(free_list.free_space(), 0x4000);
let layout = PageLayout::from_size(0x4000).unwrap();
assert_eq!(free_list.allocate(layout).unwrap(), (0x1000..0x5000).try_into().unwrap());
Structs§
- Alloc
Error - Allocation failure.
- Free
List - A free-list-based page/frame allocator.
- Page
Layout - Layout of a range of pages.
- Page
Layout Error - Invalid parameters used in
PageLayout
construction. - Page
Range - A non-empty page-aligned memory range.
- Page
Range Error - Invalid parameters in
PageRange
construction.
Enums§
- Page
Range Sub - The output of
PageRange::sub
.
Constants§
- PAGE_
SIZE - The base page size.