-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
I'm trying to allocate a 2MiB huge frame like this:
unsafe impl<T: PageSize> FrameAllocator<T> for GlobalFrameAllocator {
fn allocate_frame(&mut self) -> Option<PhysFrame<T>> {
unsafe {
if let Some(addr) = BITMAP.alloc_contiguous(T::SIZE as usize / Size4KiB::SIZE as usize, 1) {
let addr = PhysAddr::new(addr as u64 * Size4KiB::SIZE);
PhysFrame::from_start_address(addr).ok()
} else {
None
}
}
}
}
impl<T: PageSize> FrameDeallocator<T> for GlobalFrameAllocator {
unsafe fn deallocate_frame(&mut self, frame: PhysFrame<T>) {
let addr = frame.start_address().as_u64() as usize;
BITMAP.dealloc(addr);
}
}I'm very confused on what alloc_contiguous does
Metadata
Metadata
Assignees
Labels
No labels