You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The kernel will need a simple page frame allocator to start allocating the initial frames that we'll use permanently, before we set up a page frame allocator with bookkeeping. It's okay for this allocator to leak frames, as we'll never want to de-allocate these initial frame allocations for e.g. re-mapping the kernel.
It seems to me that the easiest and possibly the most compose-able way to write this allocator is just to implement FrameAllocator for Iterator<Item=Frame>. The various architecture-specific memory map providers in the kernel can all return iterators over memory areas, and we can map them into a frame representation and then use that iterator as an allocator.
it should:
on calls to allocate(), call iter.next() and return Ok(frame) if next() returns Some or Err(AllocErr::Exhausted) if iter.next() returns None.
on calls to deallocate(), panic. (or silently do nothing; but i think if we ever try to deallocate these frames that's worthy of a kernel oops).
if/when we add an allocate_range() type API, return AllocErr::Unsupported on all calls to that function
The text was updated successfully, but these errors were encountered:
The kernel will need a simple page frame allocator to start allocating the initial frames that we'll use permanently, before we set up a page frame allocator with bookkeeping. It's okay for this allocator to leak frames, as we'll never want to de-allocate these initial frame allocations for e.g. re-mapping the kernel.
It seems to me that the easiest and possibly the most compose-able way to write this allocator is just to implement
FrameAllocator
forIterator<Item=Frame>
. The various architecture-specific memory map providers in the kernel can all return iterators over memory areas, and we can map them into a frame representation and then use that iterator as an allocator.it should:
allocate()
, calliter.next()
and returnOk(frame)
ifnext()
returnsSome
orErr(AllocErr::Exhausted)
ifiter.next()
returnsNone
.deallocate()
, panic. (or silently do nothing; but i think if we ever try to deallocate these frames that's worthy of a kernel oops).allocate_range()
type API, returnAllocErr::Unsupported
on all calls to that functionThe text was updated successfully, but these errors were encountered: