buddy_system_allocator
buddy_system_allocator
is a crate implementing a basic buddy system
allocator. It can be used both to implement GlobalAlloc
(using
LockedHeap
) so you can use the standard alloc
crate (as we saw
before), or for allocating other address space (using
FrameAllocator
) . For example, we might want to allocate MMIO space for
PCI BARs:
Speaker Notes
- PCI BARs always have alignment equal to their size.
- Run the example with
cargo run
undersrc/bare-metal/useful-crates/allocator-example/
. (It won’t run in the Playground because of the crate dependency.)