mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
Create a generic BootInfoFrameAllocator type
This commit is contained in:
@@ -63,3 +63,19 @@ impl FrameAllocator<Size4KiB> for EmptyFrameAllocator {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub struct BootInfoFrameAllocator<I>
|
||||
where
|
||||
I: Iterator<Item = PhysFrame>,
|
||||
{
|
||||
frames: I,
|
||||
}
|
||||
|
||||
impl<I> FrameAllocator<Size4KiB> for BootInfoFrameAllocator<I>
|
||||
where
|
||||
I: Iterator<Item = PhysFrame>,
|
||||
{
|
||||
fn allocate_frame(&mut self) -> Option<PhysFrame> {
|
||||
self.frames.next()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user